Skip to content

Build your personal knowledge base with Trilium Notes

feat(tree_context_menu): disable "Convert to attachment" if no eligible notes

Elian Doran5fd488e21072
diff --git a/apps/client/src/menus/tree_context_menu.ts b/apps/client/src/menus/tree_context_menu.ts
index 901a165591..51f9912b32 100644
--- a/apps/client/src/menus/tree_context_menu.ts
+++ b/apps/client/src/menus/tree_context_menu.ts
@@ -140,7 +140,13 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree
uiIcon: "bx bx-rename",
enabled: isNotRoot && parentNotSearch && notOptionsOrHelp
},
- { title: t("tree-context-menu.convert-to-attachment"), command: "convertNoteToAttachment", uiIcon: "bx bx-paperclip", enabled: isNotRoot && !isHoisted && notOptionsOrHelp },
+ {
+ title:
+ t("tree-context-menu.convert-to-attachment"),
+ command: "convertNoteToAttachment",
+ uiIcon: "bx bx-paperclip",
+ enabled: isNotRoot && !isHoisted && notOptionsOrHelp && selectedNotes.some(note => note.isEligibleForConversionToAttachment())
+ },
{ kind: "separator" },