Skip to content

Build your personal knowledge base with Trilium Notes

feat(tree): add tooltip when moving into hidden subtree

Elian Dorandb57f3ff62cb
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 33e69ba0f6..54c10275b2 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1773,7 +1773,11 @@
"clone-indicator-tooltip-single": "This note is cloned (1 additional parent: {{- parent}})",
"shared-indicator-tooltip": "This note is shared publicly",
"shared-indicator-tooltip-with-url": "This note is shared publicly at: {{- url}}",
- "subtree-hidden-tooltip": "{{count}} child notes that are hidden from the tree"
+ "subtree-hidden-tooltip": "{{count}} child notes that are hidden from the tree",
+ "subtree-hidden-moved-title_one": "{{count}} note moved to {{title}}",
+ "subtree-hidden-moved-title_other": "{{count}} notes moved to {{title}}",
+ "subtree-hidden-moved-description-collection": "Items in this collection are managed by its views.",
+ "subtree-hidden-moved-description-other": "Items in this note are intentionally hidden."
},
"title_bar_buttons": {
"window-on-top": "Keep Window on Top"
diff --git a/apps/client/src/widgets/note_tree.ts b/apps/client/src/widgets/note_tree.ts
index a61c454b29..f1ca96569a 100644
--- a/apps/client/src/widgets/note_tree.ts
+++ b/apps/client/src/widgets/note_tree.ts
@@ -555,6 +555,19 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
} else if (data.hitMode === "after") {
branchService.moveAfterBranch(selectedBranchIds, node.data.branchId);
} else if (data.hitMode === "over") {
+ const targetNote = froca.getNoteFromCache(node.data.noteId);
+ if (targetNote?.hasLabel("subtreeHidden")) {
+ toastService.showPersistent({
+ id: `subtree-hidden-moved`,
+ title: t("note_tree.subtree-hidden-moved-title", { count: selectedBranchIds.length, title: targetNote.title }),
+ message: targetNote.type === "book"
+ ? t("note_tree.subtree-hidden-moved-description-collection")
+ : t("note_tree.subtree-hidden-moved-description-other"),
+ icon: "bx bx-hide",
+ timeout: 5_000,
+ });
+ }
+
branchService.moveToParentNote(selectedBranchIds, node.data.branchId);
} else {
throw new Error(`Unknown hitMode '${data.hitMode}'`);