split window WIP

This commit is contained in:
zadam
2021-05-20 23:13:34 +02:00
parent a3847842cb
commit 1a13132a69
9 changed files with 186 additions and 105 deletions

View File

@@ -11,12 +11,12 @@ class TabContext extends Component {
/**
* @param {string|null} tabId
*/
constructor(tabId = null, hoistedNoteId = 'root') {
constructor(tabId = null, hoistedNoteId = 'root', parentTabId = null) {
super();
this.tabId = tabId || utils.randomString(4);
this.hoistedNoteId = hoistedNoteId;
this.parentTabId = null;
this.parentTabId = parentTabId;
}
setEmpty() {
@@ -60,6 +60,19 @@ class TabContext extends Component {
}
}
getAllSubTabContexts() {
return appContext.tabManager.tabContexts.filter(tc => tc.tabId === this.tabId || tc.parentTabId === this.tabId);
}
getMainTabContext() {
if (this.parentTabId) {
return appContext.tabManager.getTabContextById(this.parentTabId);
}
else {
return this;
}
}
saveToRecentNotes(resolvedNotePath) {
setTimeout(async () => {
// we include the note into recent list only if the user stayed on the note at least 5 seconds
@@ -135,6 +148,7 @@ class TabContext extends Component {
return {
tabId: this.tabId,
parentTabId: this.parentTabId,
notePath: this.notePath,
hoistedNoteId: this.hoistedNoteId,
active: this.isActive()