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
using enhanceTitle event instead of renderNode per https://github.com/mar10/fancytree/issues/927
azivner927415838cee
diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.jsindex affcd7022f..8be2a0b9cf 100644--- a/src/public/javascripts/services/tree.js+++ b/src/public/javascripts/services/tree.js@@ -81,9 +81,6 @@ async function setNodeTitleWithPrefix(node) {const title = (prefix ? (prefix + " - ") : "") + noteTitle;node.setTitle(utils.escapeHtml(title));-- // workaround for this: https://github.com/mar10/fancytree/issues/927- node.render(true, false);}function getNode(childNoteId, parentNoteId) {@@ -429,13 +426,17 @@ function initFancyTree(tree) {clones: {highlightActiveClones: true},- renderNode: async function (event, data) {+ enhanceTitle: async function (event, data) {const node = data.node;+ const $span = $(node.span);++ if (node.data.noteId !== 'root'+ && node.data.noteId === await hoistedNoteService.getHoistedNoteId()+ && $span.find('.unhoist-button').length === 0) {- if (node.data.noteId !== 'root' && node.data.noteId === await hoistedNoteService.getHoistedNoteId()) {const unhoistButton = $('<span> (<a class="unhoist-button">unhoist</a>)</span>');- $(node.span).append(unhoistButton);+ $span.append(unhoistButton);}}});