diff --git a/src/public/app/services/entrypoints.js b/src/public/app/services/entrypoints.js index 116877976..e18691c0f 100644 --- a/src/public/app/services/entrypoints.js +++ b/src/public/app/services/entrypoints.js @@ -7,6 +7,7 @@ import Component from "../widgets/component.js"; import toastService from "./toast.js"; import ws from "./ws.js"; import bundleService from "./bundle.js"; +import froca from "./froca.js"; export default class Entrypoints extends Component { constructor() { @@ -46,14 +47,15 @@ export default class Entrypoints extends Component { appContext.triggerEvent('focusAndSelectTitle', {isNewNote: true}); } - async toggleNoteHoistingCommand() { - const noteContext = appContext.tabManager.getActiveContext(); + async toggleNoteHoistingCommand({noteId = appContext.tabManager.getActiveContextNoteId()}) { + const noteToHoist = await froca.getNote(noteId); + const activeNoteContext = appContext.tabManager.getActiveContext(); - if (noteContext.note.noteId === noteContext.hoistedNoteId) { - await noteContext.unhoist(); + if (noteToHoist.noteId === activeNoteContext.hoistedNoteId) { + await activeNoteContext.unhoist(); } - else if (noteContext.note.type !== 'search') { - await noteContext.setHoistedNoteId(noteContext.note.noteId); + else if (noteToHoist.type !== 'search') { + await activeNoteContext.setHoistedNoteId(noteId); } } diff --git a/src/public/app/services/tree_context_menu.js b/src/public/app/services/tree_context_menu.js index cafb08ab7..f9843f8c4 100644 --- a/src/public/app/services/tree_context_menu.js +++ b/src/public/app/services/tree_context_menu.js @@ -133,6 +133,7 @@ class TreeContextMenu { this.treeWidget.triggerCommand(command, { node: this.node, notePath: notePath, + noteId: this.node.data.noteId, selectedOrActiveBranchIds: this.treeWidget.getSelectedOrActiveBranchIds(this.node), selectedOrActiveNoteIds: this.treeWidget.getSelectedOrActiveNoteIds(this.node) });