Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/note splits: persist the last focused split between restarts
Adorian Doran80e719be8cc0
diff --git a/apps/client/src/components/note_context.ts b/apps/client/src/components/note_context.tsindex 13f697f374..0dbc637db7 100644--- a/apps/client/src/components/note_context.ts+++ b/apps/client/src/components/note_context.ts@@ -311,7 +311,8 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">hoistedNoteId: this.hoistedNoteId,active: this.isActive(),viewScope: this.viewScope,- pinned: this.pinned+ pinned: this.pinned,+ lastActiveNtxId: this.lastActiveNtxId};}diff --git a/apps/client/src/components/tab_manager.ts b/apps/client/src/components/tab_manager.tsindex 37b43024de..69fc30406c 100644--- a/apps/client/src/components/tab_manager.ts+++ b/apps/client/src/components/tab_manager.ts@@ -25,6 +25,7 @@ interface NoteContextState {active: boolean;viewScope: Record<string, any>;pinned?: boolean;+ lastActiveNtxId?: string | null;}export default class TabManager extends Component {@@ -111,7 +112,7 @@ export default class TabManager extends Component {await this.tabsUpdate.allowUpdateWithoutChange(async () => {for (const tab of filteredNoteContexts) {- await this.openContextWithNote(tab.notePath, {+ const noteContext = await this.openContextWithNote(tab.notePath, {activate: tab.active,ntxId: tab.ntxId,mainNtxId: tab.mainNtxId,@@ -119,6 +120,11 @@ export default class TabManager extends Component {viewScope: tab.viewScope,pinned: tab.pinned});++ // restore which split was last focused in this tab (validated lazily on read)+ if (tab.lastActiveNtxId) {+ noteContext.lastActiveNtxId = tab.lastActiveNtxId;+ }}});