mirror of
https://github.com/zadam/trilium.git
synced 2024-11-11 18:08:13 +08:00
using enhanceTitle event instead of renderNode per https://github.com/mar10/fancytree/issues/927
This commit is contained in:
parent
d72fcefdc7
commit
927415838c
1 changed files with 7 additions and 6 deletions
|
@ -81,9 +81,6 @@ async function setNodeTitleWithPrefix(node) {
|
||||||
const title = (prefix ? (prefix + " - ") : "") + noteTitle;
|
const title = (prefix ? (prefix + " - ") : "") + noteTitle;
|
||||||
|
|
||||||
node.setTitle(utils.escapeHtml(title));
|
node.setTitle(utils.escapeHtml(title));
|
||||||
|
|
||||||
// workaround for this: https://github.com/mar10/fancytree/issues/927
|
|
||||||
node.render(true, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNode(childNoteId, parentNoteId) {
|
function getNode(childNoteId, parentNoteId) {
|
||||||
|
@ -429,13 +426,17 @@ function initFancyTree(tree) {
|
||||||
clones: {
|
clones: {
|
||||||
highlightActiveClones: true
|
highlightActiveClones: true
|
||||||
},
|
},
|
||||||
renderNode: async function (event, data) {
|
enhanceTitle: async function (event, data) {
|
||||||
const node = data.node;
|
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>');
|
const unhoistButton = $('<span> (<a class="unhoist-button">unhoist</a>)</span>');
|
||||||
|
|
||||||
$(node.span).append(unhoistButton);
|
$span.append(unhoistButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue