1
0
mirror of https://github.com/zadam/trilium.git synced 2025-03-01 14:22:32 +01:00

more actions triggering new tab should respect current hoisting

This commit is contained in:
zadam 2023-07-14 18:15:31 +02:00
parent 3adab07ddb
commit 4d00404f55
2 changed files with 8 additions and 12 deletions
src/public/app

@ -18,7 +18,7 @@ export default class RootCommandExecutor extends Component {
async showSQLConsoleCommand() { async showSQLConsoleCommand() {
const sqlConsoleNote = await dateNoteService.createSqlConsole(); 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}); appContext.triggerEvent('focusOnDetail', {ntxId: noteContext.ntxId});
} }
@ -29,12 +29,8 @@ export default class RootCommandExecutor extends Component {
// force immediate search // force immediate search
await froca.loadSearchNote(searchNote.noteId); await froca.loadSearchNote(searchNote.noteId);
const activeNoteContext = appContext.tabManager.getActiveContext(); const noteContext = await appContext.tabManager.openTabWithNoteWithHoisting(searchNote.noteId, {
const hoistedNoteId = activeNoteContext?.hoistedNoteId || 'root'; activate: true
const noteContext = await appContext.tabManager.openContextWithNote(searchNote.noteId, {
activate: true,
hoistedNoteId
}); });
appContext.triggerCommand('focusOnSearchDefinition', {ntxId: noteContext.ntxId}); appContext.triggerCommand('focusOnSearchDefinition', {ntxId: noteContext.ntxId});
@ -83,7 +79,7 @@ export default class RootCommandExecutor extends Component {
} }
async showBackendLogCommand() { async showBackendLogCommand() {
await appContext.tabManager.openContextWithNote('_backendLog', { activate: true }); await appContext.tabManager.openTabWithNoteWithHoisting('_backendLog', { activate: true });
} }
async showLaunchBarSubtreeCommand() { async showLaunchBarSubtreeCommand() {
@ -124,7 +120,7 @@ export default class RootCommandExecutor extends Component {
const notePath = appContext.tabManager.getActiveContextNotePath(); const notePath = appContext.tabManager.getActiveContextNotePath();
if (notePath) { if (notePath) {
await appContext.tabManager.openContextWithNote(notePath, { await appContext.tabManager.openTabWithNoteWithHoisting(notePath, {
activate: true, activate: true,
viewScope: { viewScope: {
viewMode: 'source' viewMode: 'source'
@ -137,7 +133,7 @@ export default class RootCommandExecutor extends Component {
const notePath = appContext.tabManager.getActiveContextNotePath(); const notePath = appContext.tabManager.getActiveContextNotePath();
if (notePath) { if (notePath) {
await appContext.tabManager.openContextWithNote(notePath, { await appContext.tabManager.openTabWithNoteWithHoisting(notePath, {
activate: true, activate: true,
viewScope: { viewScope: {
viewMode: 'attachments' viewMode: 'attachments'
@ -150,7 +146,7 @@ export default class RootCommandExecutor extends Component {
const notePath = appContext.tabManager.getActiveContextNotePath(); const notePath = appContext.tabManager.getActiveContextNotePath();
if (notePath) { if (notePath) {
await appContext.tabManager.openContextWithNote(notePath, { await appContext.tabManager.openTabWithNoteWithHoisting(notePath, {
activate: true, activate: true,
viewScope: { viewScope: {
viewMode: 'attachments' viewMode: 'attachments'

@ -79,7 +79,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
this.openTabWithNote = async (notePath, activate) => { this.openTabWithNote = async (notePath, activate) => {
await ws.waitForMaxKnownEntityChangeId(); await ws.waitForMaxKnownEntityChangeId();
await appContext.tabManager.openContextWithNote(notePath, { activate }); await appContext.tabManager.openTabWithNoteWithHoisting(notePath, { activate });
if (activate) { if (activate) {
await appContext.triggerEvent('focusAndSelectTitle'); await appContext.triggerEvent('focusAndSelectTitle');