diff --git a/package-lock.json b/package-lock.json index 00286b16e..f42dad8ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "trilium", - "version": "0.33.0-beta", + "version": "0.33.1-beta", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/public/javascripts/services/tree_context_menu.js b/src/public/javascripts/services/tree_context_menu.js index cda8f958e..d6a4cb373 100644 --- a/src/public/javascripts/services/tree_context_menu.js +++ b/src/public/javascripts/services/tree_context_menu.js @@ -33,46 +33,47 @@ class TreeContextMenu { const parentNote = await treeCache.getNote(branch.parentNoteId); const isNotRoot = note.noteId !== 'root'; const isHoisted = note.noteId === await hoistedNoteService.getHoistedNoteId(); + const noSelectedNotes = treeService.getSelectedNodes().length === 0; const insertNoteAfterEnabled = isNotRoot && !isHoisted && parentNote.type !== 'search'; const insertChildNoteEnabled = note.type !== 'search'; return [ - { title: "Open in new tab", cmd: "openInTab", uiIcon: "empty" }, + { title: "Open in new tab", cmd: "openInTab", uiIcon: "empty", enabled: noSelectedNotes }, { title: "Insert note after Ctrl+O", cmd: "insertNoteAfter", uiIcon: "plus", items: insertNoteAfterEnabled ? this.getNoteTypeItems("insertNoteAfter") : null, - enabled: insertNoteAfterEnabled }, + enabled: insertNoteAfterEnabled && noSelectedNotes }, { title: "Insert child note Ctrl+P", cmd: "insertChildNote", uiIcon: "plus", items: insertChildNoteEnabled ? this.getNoteTypeItems("insertChildNote") : null, - enabled: insertChildNoteEnabled }, + enabled: insertChildNoteEnabled && noSelectedNotes }, { title: "Delete Delete", cmd: "delete", uiIcon: "trash", enabled: isNotRoot && !isHoisted && parentNote.type !== 'search' }, { title: "----" }, - isHoisted ? null : { title: "Hoist note Ctrl-H", cmd: "hoist", uiIcon: "empty" }, + isHoisted ? null : { title: "Hoist note Ctrl-H", cmd: "hoist", uiIcon: "empty", enabled: noSelectedNotes }, !isHoisted || !isNotRoot ? null : { title: "Unhoist note Ctrl-H", cmd: "unhoist", uiIcon: "arrow-up" }, { title: "Edit branch prefix F2", cmd: "editBranchPrefix", uiIcon: "empty", - enabled: isNotRoot && parentNote.type !== 'search'}, + enabled: isNotRoot && parentNote.type !== 'search' && noSelectedNotes}, { title: "----" }, - { title: "Protect subtree", cmd: "protectSubtree", uiIcon: "shield-check" }, - { title: "Unprotect subtree", cmd: "unprotectSubtree", uiIcon: "shield-close" }, + { title: "Protect subtree", cmd: "protectSubtree", uiIcon: "shield-check", enabled: noSelectedNotes }, + { title: "Unprotect subtree", cmd: "unprotectSubtree", uiIcon: "shield-close", enabled: noSelectedNotes }, { title: "----" }, { title: "Copy / clone Ctrl+C", cmd: "copy", uiIcon: "files", enabled: isNotRoot }, { title: "Cut Ctrl+X", cmd: "cut", uiIcon: "scissors", enabled: isNotRoot }, { title: "Paste into Ctrl+V", cmd: "pasteInto", uiIcon: "clipboard", - enabled: !clipboard.isEmpty() && note.type !== 'search' }, + enabled: !clipboard.isEmpty() && note.type !== 'search' && noSelectedNotes }, { title: "Paste after", cmd: "pasteAfter", uiIcon: "clipboard", - enabled: !clipboard.isEmpty() && isNotRoot && parentNote.type !== 'search' }, + enabled: !clipboard.isEmpty() && isNotRoot && parentNote.type !== 'search' && noSelectedNotes }, { title: "----" }, { title: "Export", cmd: "export", uiIcon: "empty", - enabled: note.type !== 'search' }, + enabled: note.type !== 'search' && noSelectedNotes }, { title: "Import into note", cmd: "importIntoNote", uiIcon: "empty", - enabled: note.type !== 'search' }, + enabled: note.type !== 'search' && noSelectedNotes }, { title: "----" }, - { title: "Collapse subtree Alt+-", cmd: "collapseSubtree", uiIcon: "align-justify" }, - { title: "Force note sync", cmd: "forceNoteSync", uiIcon: "refresh" }, - { title: "Sort alphabetically Alt+S", cmd: "sortAlphabetically", uiIcon: "empty" } + { title: "Collapse subtree Alt+-", cmd: "collapseSubtree", uiIcon: "align-justify", enabled: noSelectedNotes }, + { title: "Force note sync", cmd: "forceNoteSync", uiIcon: "refresh", enabled: noSelectedNotes }, + { title: "Sort alphabetically Alt+S", cmd: "sortAlphabetically", uiIcon: "empty", enabled: noSelectedNotes } ].filter(row => row !== null); }