keyboard handlers for tabs

This commit is contained in:
zadam
2020-01-20 20:51:22 +01:00
parent 9bc1f5af45
commit c5eac8f438
8 changed files with 57 additions and 49 deletions

View File

@@ -24,7 +24,7 @@ class AttributesWidget extends StandardWidget {
}
async refreshWithNote() {
const attributes = await this.tabContext.attributes.getAttributes();console.log("attributes", attributes);
const attributes = await this.tabContext.attributes.getAttributes();
const ownedAttributes = attributes.filter(attr => attr.noteId === this.tabContext.note.noteId);
if (attributes.length === 0) {

View File

@@ -64,7 +64,7 @@ class NoteInfoWidget extends StandardWidget {
}
syncDataListener({data}) {
if (data.find(sd => sd.entityName === 'notes' && sd.entityId === this.tabContext.note.noteId)) {
if (data.find(sd => sd.entityName === 'notes' && this.isNote(sd.entityId))) {
this.refresh();
}
}

View File

@@ -473,6 +473,10 @@ export default class TabRowWidget extends BasicWidget {
tabEl.setAttribute('active', '');
}
tabOpenedListener({tabId}) {
this.addTab(tabId);
}
removeTab(tabId) {
const tabEl = this.getTabById(tabId)[0];
@@ -595,7 +599,7 @@ export default class TabRowWidget extends BasicWidget {
if (destinationIndex < originIndex) {
tabEl.parentNode.insertBefore(tabEl, this.tabEls[destinationIndex]);
} else {
const beforeEl = this.tabEls[destinationIndex + 1] || this.$newTab;
const beforeEl = this.tabEls[destinationIndex + 1] || this.$newTab[0];
tabEl.parentNode.insertBefore(tabEl, beforeEl);
}