This commit is contained in:
zadam
2020-01-18 18:01:16 +01:00
parent b25c1d6fa8
commit b00a9f4415
12 changed files with 91 additions and 102 deletions

View File

@@ -127,6 +127,8 @@ class AppContext {
activateNote(notePath) {
const activeTabContext = this.getActiveTabContext();
console.log("Setting activeTabContext to " + notePath);
activeTabContext.setNote(notePath);
this._setTitleBar();
@@ -209,36 +211,6 @@ class AppContext {
}
}
async showTab(tabId) {
for (const ctx of this.tabContexts) {
if (ctx.tabId === tabId) {
await ctx.show();
} else {
ctx.hide();
}
}
const oldActiveNode = this.getMainNoteTree().getActiveNode();
if (oldActiveNode) {
oldActiveNode.setActive(false);
}
const newActiveTabContext = this.getActiveTabContext();
if (newActiveTabContext && newActiveTabContext.notePath) {
const newActiveNode = await this.getMainNoteTree().getNodeFromPath(newActiveTabContext.notePath);
if (newActiveNode) {
if (!newActiveNode.isVisible()) {
await this.getMainNoteTree().expandToNote(newActiveTabContext.notePath);
}
newActiveNode.setActive(true, {noEvents: true});
}
}
}
/**
* @return {NoteTreeWidget}
*/
@@ -343,10 +315,6 @@ class AppContext {
this.openEmptyTab();
}
async activeTabChangedListener({tabId}) {
await this.showTab(tabId);
}
async tabRemoveListener({tabId}) {
this.tabContexts.filter(nc => nc.tabId === tabId)
.forEach(tc => tc.remove());