From 927415838cee8baa611fce26959e2c993d481f05 Mon Sep 17 00:00:00 2001 From: azivner Date: Fri, 4 Jan 2019 20:18:07 +0100 Subject: [PATCH] using enhanceTitle event instead of renderNode per https://github.com/mar10/fancytree/issues/927 --- src/public/javascripts/services/tree.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.js index affcd7022..8be2a0b9c 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 = $('  (unhoist)'); - $(node.span).append(unhoistButton); + $span.append(unhoistButton); } } });