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

@@ -11,10 +11,11 @@ class TabContext extends Component {
/**
* @param {string|null} tabId
*/
constructor(tabId = null) {
constructor(tabId = null, hoistedNoteId = 'root') {
super();
this.tabId = tabId || utils.randomString(4);
this.hoistedNoteId = hoistedNoteId;
}
setEmpty() {
@@ -123,10 +124,24 @@ class TabContext extends Component {
return {
tabId: this.tabId,
notePath: this.notePath,
hoistedNoteId: this.hoistedNoteId,
active: this.isActive()
}
}
async unhoist() {
await this.setHoistedNoteId('root');
}
async setHoistedNoteId(noteIdToHoist) {
this.hoistedNoteId = noteIdToHoist;
await this.triggerEvent('hoistedNoteChanged', {
noteId: noteIdToHoist,
tabId: this.tabId
});
}
async entitiesReloadedEvent({loadResults}) {
if (loadResults.isNoteReloaded(this.noteId)) {
const note = await treeCache.getNote(this.noteId);