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
feat(tree): add title for subnote count badge
Elian Doranee52e16a75d4
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 457f01eb60..33e69ba0f6 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1772,7 +1772,8 @@"clone-indicator-tooltip": "This note has {{- count}} parents: {{- parents}}","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}}"+ "shared-indicator-tooltip-with-url": "This note is shared publicly at: {{- url}}",+ "subtree-hidden-tooltip": "{{count}} child notes that are hidden from the tree"},"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.tsindex 29ddd10701..470f19dd0d 100644--- a/apps/client/src/widgets/note_tree.ts+++ b/apps/client/src/widgets/note_tree.ts@@ -1891,8 +1891,10 @@ function buildEnhanceTitle() {}// Add a badge with the number of items if it hides children.- if (isSubtreeHidden) {- const $badge = $(`<span class="note-indicator-icon subtree-hidden-badge">${note.getChildNoteIds().length}</span>`);+ const count = note.getChildNoteIds().length;+ if (isSubtreeHidden && count > 0) {+ const $badge = $(`<span class="note-indicator-icon subtree-hidden-badge">${count}</span>`);+ $badge.attr("title", t("note_tree.subtree-hidden-tooltip", { count }));$span.find(".fancytree-title").append($badge);}};