mirror of
https://github.com/zadam/trilium.git
synced 2025-11-04 20:36:13 +01:00
WIP per-tab hoisting
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user