Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(tree): spotlighted note has + button & insert child context menu
Elian Dorane2da8c28cadd
diff --git a/apps/client/src/menus/tree_context_menu.ts b/apps/client/src/menus/tree_context_menu.tsindex 4f28cc1f4b..777f4a74cb 100644--- a/apps/client/src/menus/tree_context_menu.ts+++ b/apps/client/src/menus/tree_context_menu.ts@@ -73,6 +73,7 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Treeconst notSearch = note?.type !== "search";const hasSubtreeHidden = note?.isLabelTruthy("subtreeHidden") ?? false;+ const isSpotlighted = this.node.extraClasses.includes("spotlighted-node");const notOptionsOrHelp = !note?.noteId.startsWith("_options") && !note?.noteId.startsWith("_help");const parentNotSearch = !parentNote || parentNote.type !== "search";const insertNoteAfterEnabled = isNotRoot && !isHoisted && parentNotSearch;@@ -113,7 +114,7 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<TreekeyboardShortcut: "createNoteInto",uiIcon: "bx bx-plus",items: notSearch ? await noteTypesService.getNoteTypeItems("insertChildNote") : null,- enabled: notSearch && noSelectedNotes && notOptionsOrHelp && !hasSubtreeHidden,+ enabled: notSearch && noSelectedNotes && notOptionsOrHelp && !hasSubtreeHidden && !isSpotlighted,columns: 2},diff --git a/apps/client/src/widgets/note_tree.ts b/apps/client/src/widgets/note_tree.tsindex 80089a546b..d7ac85d6b8 100644--- a/apps/client/src/widgets/note_tree.ts+++ b/apps/client/src/widgets/note_tree.ts@@ -1940,6 +1940,7 @@ function buildEnhanceTitle() {&& !note.isLaunchBarConfig()&& !note.noteId.startsWith("_help")&& !isSubtreeHidden+ && !node.extraClasses.includes("spotlighted-node")) {const createChildItem = createChildTemplate.cloneNode();createChildItem.addEventListener("click", cancelClickPropagation);