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
split window WIP
zadama3847842cbee
diff --git a/src/public/app/widgets/containers/pane_container.js b/src/public/app/widgets/containers/pane_container.jsindex 197305e4fe..f2ee3d037c 100644--- a/src/public/app/widgets/containers/pane_container.js+++ b/src/public/app/widgets/containers/pane_container.js@@ -16,15 +16,33 @@ export default class PaneContainer extends FlexContainer {this.css('flex-grow', '1');}+ doRender() {+ super.doRender();++ this.$widget.find("div").on("click", () => {+ const activeTabContext = appContext.tabManager.getActiveTabContext();++ const tabId = activeTabContext.parentTabId || activeTabContext.tabId;++ appContext.tabManager.activateTab(tabId);+ });+ }+async openNewPaneCommand() {const newWidget = this.widgetFactory();- this.$widget.append(newWidget.render());+ const $rendered = newWidget.render();++ this.$widget.append($rendered);const tabContext = new TabContext();appContext.tabManager.tabContexts.push(tabContext);appContext.tabManager.child(tabContext);+ $rendered.on('click', () => {+ appContext.tabManager.activateTab(tabContext.tabId);+ });+tabContext.parentTabId = appContext.tabManager.getActiveTabContext().tabId;await newWidget.handleEvent('setTabContext', { tabContext });diff --git a/src/public/app/widgets/tab_row.js b/src/public/app/widgets/tab_row.jsindex ecb2bbdda0..dfb0086903 100644--- a/src/public/app/widgets/tab_row.js+++ b/src/public/app/widgets/tab_row.js@@ -427,12 +427,16 @@ export default class TabRowWidget extends BasicWidget {}activeTabChangedEvent() {- const activeTabContext = appContext.tabManager.getActiveTabContext();+ let activeTabContext = appContext.tabManager.getActiveTabContext();if (!activeTabContext) {return;}+ if (activeTabContext.parentTabId) {+ activeTabContext = appContext.tabManager.getTabContextById(activeTabContext.parentTabId);+ }+const tabEl = this.getTabById(activeTabContext.tabId)[0];const activeTabEl = this.activeTabEl;if (activeTabEl === tabEl) return;@@ -441,7 +445,9 @@ export default class TabRowWidget extends BasicWidget {}newTabOpenedEvent({tabContext}) {- this.addTab(tabContext.tabId);+ if (!tabContext.parentId) {+ this.addTab(tabContext.tabId);+ }}removeTab(tabId) {@@ -606,11 +612,11 @@ export default class TabRowWidget extends BasicWidget {tabNoteSwitchedAndActivatedEvent({tabContext}) {this.activeTabChangedEvent();- this.updateTabById(tabContext.tabId);+ this.updateTabById(tabContext.parentTabId || tabContext.tabId);}tabNoteSwitchedEvent({tabContext}) {- this.updateTabById(tabContext.tabId);+ this.updateTabById(tabContext.parentTabId || tabContext.tabId);}updateTabById(tabId) {