From 4d00404f5586509ff505913795ce0023f700689c Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 14 Jul 2023 18:15:31 +0200 Subject: [PATCH] more actions triggering new tab should respect current hoisting --- .../app/components/root_command_executor.js | 18 +++++++----------- src/public/app/services/frontend_script_api.js | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/public/app/components/root_command_executor.js b/src/public/app/components/root_command_executor.js index 8f7d202d4..08db59e62 100644 --- a/src/public/app/components/root_command_executor.js +++ b/src/public/app/components/root_command_executor.js @@ -18,7 +18,7 @@ export default class RootCommandExecutor extends Component { async showSQLConsoleCommand() { const sqlConsoleNote = await dateNoteService.createSqlConsole(); - const noteContext = await appContext.tabManager.openContextWithNote(sqlConsoleNote.noteId, { activate: true }); + const noteContext = await appContext.tabManager.openTabWithNoteWithHoisting(sqlConsoleNote.noteId, { activate: true }); appContext.triggerEvent('focusOnDetail', {ntxId: noteContext.ntxId}); } @@ -29,12 +29,8 @@ export default class RootCommandExecutor extends Component { // force immediate search await froca.loadSearchNote(searchNote.noteId); - const activeNoteContext = appContext.tabManager.getActiveContext(); - const hoistedNoteId = activeNoteContext?.hoistedNoteId || 'root'; - - const noteContext = await appContext.tabManager.openContextWithNote(searchNote.noteId, { - activate: true, - hoistedNoteId + const noteContext = await appContext.tabManager.openTabWithNoteWithHoisting(searchNote.noteId, { + activate: true }); appContext.triggerCommand('focusOnSearchDefinition', {ntxId: noteContext.ntxId}); @@ -83,7 +79,7 @@ export default class RootCommandExecutor extends Component { } async showBackendLogCommand() { - await appContext.tabManager.openContextWithNote('_backendLog', { activate: true }); + await appContext.tabManager.openTabWithNoteWithHoisting('_backendLog', { activate: true }); } async showLaunchBarSubtreeCommand() { @@ -124,7 +120,7 @@ export default class RootCommandExecutor extends Component { const notePath = appContext.tabManager.getActiveContextNotePath(); if (notePath) { - await appContext.tabManager.openContextWithNote(notePath, { + await appContext.tabManager.openTabWithNoteWithHoisting(notePath, { activate: true, viewScope: { viewMode: 'source' @@ -137,7 +133,7 @@ export default class RootCommandExecutor extends Component { const notePath = appContext.tabManager.getActiveContextNotePath(); if (notePath) { - await appContext.tabManager.openContextWithNote(notePath, { + await appContext.tabManager.openTabWithNoteWithHoisting(notePath, { activate: true, viewScope: { viewMode: 'attachments' @@ -150,7 +146,7 @@ export default class RootCommandExecutor extends Component { const notePath = appContext.tabManager.getActiveContextNotePath(); if (notePath) { - await appContext.tabManager.openContextWithNote(notePath, { + await appContext.tabManager.openTabWithNoteWithHoisting(notePath, { activate: true, viewScope: { viewMode: 'attachments' diff --git a/src/public/app/services/frontend_script_api.js b/src/public/app/services/frontend_script_api.js index ba9aed487..9c5a7b18f 100644 --- a/src/public/app/services/frontend_script_api.js +++ b/src/public/app/services/frontend_script_api.js @@ -79,7 +79,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain this.openTabWithNote = async (notePath, activate) => { await ws.waitForMaxKnownEntityChangeId(); - await appContext.tabManager.openContextWithNote(notePath, { activate }); + await appContext.tabManager.openTabWithNoteWithHoisting(notePath, { activate }); if (activate) { await appContext.triggerEvent('focusAndSelectTitle');