WIP per-tab hoisting

This commit is contained in:
zadam
2020-11-22 23:05:02 +01:00
parent 5bbec118e4
commit 4bd86a6dfa
11 changed files with 64 additions and 66 deletions

View File

@@ -93,7 +93,7 @@ export default class TabManager extends Component {
await this.tabsUpdate.allowUpdateWithoutChange(async () => {
for (const tab of filteredTabs) {
await this.openTabWithNote(tab.notePath, tab.active, tab.tabId);
await this.openTabWithNote(tab.notePath, tab.active, tab.tabId, tab.hoistedNoteId);
}
});
}
@@ -184,8 +184,8 @@ export default class TabManager extends Component {
await tabContext.setEmpty();
}
async openEmptyTab(tabId) {
const tabContext = new TabContext(tabId);
async openEmptyTab(tabId, hoistedNoteId) {
const tabContext = new TabContext(tabId, hoistedNoteId);
this.child(tabContext);
await this.triggerEvent('newTabOpened', {tabContext});
@@ -193,7 +193,7 @@ export default class TabManager extends Component {
return tabContext;
}
async openTabWithNote(notePath, activate, tabId = null) {
async openTabWithNote(notePath, activate, tabId = null, hoistedNoteId = 'root') {
const tabContext = await this.openEmptyTab(tabId);
if (notePath) {
@@ -336,16 +336,4 @@ export default class TabManager extends Component {
this.triggerCommand('openInWindow', {notePath});
}
async hoistedNoteChangedEvent({hoistedNoteId}) {
if (hoistedNoteId === 'root') {
return;
}
for (const tc of this.tabContexts.splice()) {
if (tc.notePath && !tc.notePath.split("/").includes(hoistedNoteId)) {
await this.removeTab(tc.tabId);
}
}
}
}