mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	split window WIP
This commit is contained in:
		| @@ -16,15 +16,33 @@ export default class PaneContainer extends FlexContainer { | |||||||
|         this.css('flex-grow', '1'); |         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() { |     async openNewPaneCommand() { | ||||||
|         const newWidget = this.widgetFactory(); |         const newWidget = this.widgetFactory(); | ||||||
|  |  | ||||||
|         this.$widget.append(newWidget.render()); |         const $rendered = newWidget.render(); | ||||||
|  |  | ||||||
|  |         this.$widget.append($rendered); | ||||||
|  |  | ||||||
|         const tabContext = new TabContext(); |         const tabContext = new TabContext(); | ||||||
|         appContext.tabManager.tabContexts.push(tabContext); |         appContext.tabManager.tabContexts.push(tabContext); | ||||||
|         appContext.tabManager.child(tabContext); |         appContext.tabManager.child(tabContext); | ||||||
|  |  | ||||||
|  |         $rendered.on('click', () => { | ||||||
|  |             appContext.tabManager.activateTab(tabContext.tabId); | ||||||
|  |         }); | ||||||
|  |  | ||||||
|         tabContext.parentTabId = appContext.tabManager.getActiveTabContext().tabId; |         tabContext.parentTabId = appContext.tabManager.getActiveTabContext().tabId; | ||||||
|  |  | ||||||
|         await newWidget.handleEvent('setTabContext', { tabContext }); |         await newWidget.handleEvent('setTabContext', { tabContext }); | ||||||
|   | |||||||
| @@ -427,12 +427,16 @@ export default class TabRowWidget extends BasicWidget { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     activeTabChangedEvent() { |     activeTabChangedEvent() { | ||||||
|         const activeTabContext = appContext.tabManager.getActiveTabContext(); |         let activeTabContext = appContext.tabManager.getActiveTabContext(); | ||||||
|  |  | ||||||
|         if (!activeTabContext) { |         if (!activeTabContext) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         if (activeTabContext.parentTabId) { | ||||||
|  |             activeTabContext = appContext.tabManager.getTabContextById(activeTabContext.parentTabId); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         const tabEl = this.getTabById(activeTabContext.tabId)[0]; |         const tabEl = this.getTabById(activeTabContext.tabId)[0]; | ||||||
|         const activeTabEl = this.activeTabEl; |         const activeTabEl = this.activeTabEl; | ||||||
|         if (activeTabEl === tabEl) return; |         if (activeTabEl === tabEl) return; | ||||||
| @@ -441,8 +445,10 @@ export default class TabRowWidget extends BasicWidget { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     newTabOpenedEvent({tabContext}) { |     newTabOpenedEvent({tabContext}) { | ||||||
|  |         if (!tabContext.parentId) { | ||||||
|             this.addTab(tabContext.tabId); |             this.addTab(tabContext.tabId); | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     removeTab(tabId) { |     removeTab(tabId) { | ||||||
|         const tabEl = this.getTabById(tabId)[0]; |         const tabEl = this.getTabById(tabId)[0]; | ||||||
| @@ -606,11 +612,11 @@ export default class TabRowWidget extends BasicWidget { | |||||||
|     tabNoteSwitchedAndActivatedEvent({tabContext}) { |     tabNoteSwitchedAndActivatedEvent({tabContext}) { | ||||||
|         this.activeTabChangedEvent(); |         this.activeTabChangedEvent(); | ||||||
|  |  | ||||||
|         this.updateTabById(tabContext.tabId); |         this.updateTabById(tabContext.parentTabId || tabContext.tabId); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     tabNoteSwitchedEvent({tabContext}) { |     tabNoteSwitchedEvent({tabContext}) { | ||||||
|         this.updateTabById(tabContext.tabId); |         this.updateTabById(tabContext.parentTabId || tabContext.tabId); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     updateTabById(tabId) { |     updateTabById(tabId) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user