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
Use Ctrl + Shift + Click on the launcher pane to open and activate in a new tab.
SiriusXT9765f2f6d7eb
diff --git a/apps/client/src/components/tab_manager.ts b/apps/client/src/components/tab_manager.tsindex 937bd89821..cf2876a5ac 100644--- a/apps/client/src/components/tab_manager.ts+++ b/apps/client/src/components/tab_manager.ts@@ -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) {diff --git a/apps/client/src/widgets/buttons/launcher/note_launcher.ts b/apps/client/src/widgets/buttons/launcher/note_launcher.tsindex 7622df4013..00ba956a1f 100644--- a/apps/client/src/widgets/buttons/launcher/note_launcher.ts+++ b/apps/client/src/widgets/buttons/launcher/note_launcher.ts@@ -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-ignorediff --git a/apps/client/src/widgets/buttons/open_note_button_widget.ts b/apps/client/src/widgets/buttons/open_note_button_widget.tsindex 950ded0a63..c0a4c63340 100644--- a/apps/client/src/widgets/buttons/open_note_button_widget.ts+++ b/apps/client/src/widgets/buttons/open_note_button_widget.ts@@ -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}