mirror of
https://github.com/zadam/trilium.git
synced 2025-11-05 04:45:47 +01:00
split window WIP
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user