fixes to entries (#6464)

* fixes to entries
fix delete first notebook entry
fix select unfocused on create
* do not blur if nothing is focused
This commit is contained in:
David Tsay 2023-03-17 15:14:15 -07:00 committed by GitHub
parent 201c669328
commit 453b1f3009
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 9 deletions

View File

@ -236,7 +236,7 @@ export default {
sidebarCoversEntries: false,
filteredAndSortedEntries: [],
notebookAnnotations: {},
selectedEntryId: '',
selectedEntryId: undefined,
activeTransaction: false,
savingTransaction: false
};
@ -381,8 +381,10 @@ export default {
});
},
updateSelection(selection) {
if (selection?.[0]?.[0]?.context?.targetDetails?.entryId === undefined) {
this.selectedEntryId = '';
const keyString = this.openmct.objects.makeKeyString(this.domainObject.identifier);
if (selection?.[0]?.[0]?.context?.targetDetails?.[keyString]?.entryId === undefined) {
this.selectedEntryId = undefined;
}
},
async loadAnnotations() {
@ -522,6 +524,8 @@ export default {
this.openmct.notifications.alert('Warning: unable to delete entry');
console.error(`unable to delete entry ${entryId} from section ${this.selectedSection}, page ${this.selectedPage}`);
this.cancelTransaction();
return;
}
@ -534,10 +538,15 @@ export default {
emphasis: true,
callback: () => {
const entries = getNotebookEntries(this.domainObject, this.selectedSection, this.selectedPage);
if (entries) {
entries.splice(entryPos, 1);
this.updateEntries(entries);
this.filterAndSortEntries();
this.removeAnnotations(entryId);
} else {
this.cancelTransaction();
}
dialog.dismiss();
}
},

View File

@ -54,7 +54,7 @@
class="c-ne__remove c-icon-button c-icon-button--major icon-trash"
title="Delete this entry"
tabindex="-1"
@click="deleteEntry"
@click.stop.prevent="deleteEntry"
>
</button>
</span>
@ -466,8 +466,11 @@ export default {
if (!this.isSelectedEntry) {
$event.preventDefault();
// blur the previous focused entry if clicking on non selected entry input
const focusedElementId = document.activeElement?.id;
if (focusedElementId !== this.entry.id) {
document.activeElement.blur();
}
}
},
editingEntry() {
this.editMode = true;