diff --git a/src/public/app/components/tab_manager.js b/src/public/app/components/tab_manager.js index e5ca32c45..b8296e7ef 100644 --- a/src/public/app/components/tab_manager.js +++ b/src/public/app/components/tab_manager.js @@ -293,6 +293,15 @@ export default class TabManager extends Component { const hoistedNoteId = opts.hoistedNoteId || 'root'; const viewMode = opts.viewMode || "default"; + const targetNoteId = await treeService.getNoteIdFromNotePath(notePath); + for (const openedNoteContext of this.getNoteContexts()) { + if (openedNoteContext.note && openedNoteContext.note.noteId === targetNoteId) { + this.activateNoteContext(openedNoteContext.ntxId, true); + + return; + } + } + const noteContext = await this.openEmptyTab(ntxId, hoistedNoteId, mainNtxId); if (notePath) { diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js index 60f7b34a3..bc63ea5b1 100644 --- a/src/public/app/widgets/note_tree.js +++ b/src/public/app/widgets/note_tree.js @@ -363,7 +363,13 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { this.tree.reactivate(true); } else { - node.setActive(); + const noteId = node.data.noteId; + const notePath = treeService.getNotePath(node); + if (noteId.startsWith('_')) { + node.setActive(); + } else { + appContext.tabManager.openTabWithNoteWithHoisting(notePath, true); + } } return false;