mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 19:49:01 +01:00 
			
		
		
		
	Use Ctrl + Shift + Click on the launcher pane to open and activate in a new tab.
This commit is contained in:
		
							parent
							
								
									d3a6079d9b
								
							
						
					
					
						commit
						9765f2f6d7
					
				| @ -277,10 +277,18 @@ export default class TabManager extends Component { | ||||
|         return noteContext; | ||||
|     } | ||||
| 
 | ||||
|     async openInNewTab(targetNoteId: string, hoistedNoteId: string | null = null) { | ||||
|     async openInNewTab(targetNoteId: string, hoistedNoteId: string | null = null, activate: boolean = false) { | ||||
|         const noteContext = await this.openEmptyTab(null, hoistedNoteId || this.getActiveContext()?.hoistedNoteId); | ||||
| 
 | ||||
|         await noteContext.setNote(targetNoteId); | ||||
| 
 | ||||
|         if (activate && noteContext.notePath) { | ||||
|             this.activateNoteContext(noteContext.ntxId, false); | ||||
|             await this.triggerEvent("noteSwitchedAndActivated", { | ||||
|                 noteContext, | ||||
|                 notePath: noteContext.notePath | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     async openInSameTab(targetNoteId: string, hoistedNoteId: string | null = null) { | ||||
|  | ||||
| @ -53,11 +53,12 @@ export default class NoteLauncher extends AbstractLauncher { | ||||
|             await appContext.tabManager.openInSameTab(targetNoteId, hoistedNoteId); | ||||
|         } else { | ||||
|             const ctrlKey = utils.isCtrlKey(evt); | ||||
|             const activate = evt.shiftKey ? true : false; | ||||
| 
 | ||||
|             if ((evt.which === 1 && ctrlKey) || evt.which === 2) { | ||||
|                 // TODO: Fix once tabManager is ported.
 | ||||
|                 //@ts-ignore
 | ||||
|                 await appContext.tabManager.openInNewTab(targetNoteId, hoistedNoteId); | ||||
|                 await appContext.tabManager.openInNewTab(targetNoteId, hoistedNoteId, activate); | ||||
|             } else { | ||||
|                 // TODO: Fix once tabManager is ported.
 | ||||
|                 //@ts-ignore
 | ||||
|  | ||||
| @ -28,15 +28,21 @@ export default class OpenNoteButtonWidget extends OnClickButtonWidget { | ||||
|         if (evt.which === 3) { | ||||
|             return; | ||||
|         } | ||||
|         const hoistedNoteId = this.getHoistedNoteId(); | ||||
|         const ctrlKey = utils.isCtrlKey(evt); | ||||
| 
 | ||||
|         if ((evt.which === 1 && ctrlKey) || evt.which === 2) { | ||||
|             await appContext.tabManager.openInNewTab(this.noteToOpen.noteId); | ||||
|             const activate = evt.shiftKey ? true : false; | ||||
|             await appContext.tabManager.openInNewTab(this.noteToOpen.noteId, hoistedNoteId, activate); | ||||
|         } else { | ||||
|             await appContext.tabManager.openInSameTab(this.noteToOpen.noteId); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     getHoistedNoteId() { | ||||
|         return this.noteToOpen.getRelationValue("hoistedNote") || appContext.tabManager.getActiveContext()?.hoistedNoteId; | ||||
|     } | ||||
| 
 | ||||
|     initialRenderCompleteEvent() { | ||||
|         // we trigger refresh above
 | ||||
|     } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 SiriusXT
						SiriusXT