From 9da8d466b87203e10debf0acef789397bc2c5b8a Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 21 Jul 2021 22:47:52 +0200 Subject: [PATCH] fix note hoisting --- src/public/app/widgets/note_tree.js | 28 ++++++++++++++-------------- src/public/stylesheets/tree.css | 8 ++++++++ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js index 625f2fc55..7e32863b8 100644 --- a/src/public/app/widgets/note_tree.js +++ b/src/public/app/widgets/note_tree.js @@ -1174,25 +1174,25 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { async hoistedNoteChangedEvent({ntxId}) { if (this.isNoteContext(ntxId)) { - this.filterHoistedBranch(); + await this.filterHoistedBranch(); } } async filterHoistedBranch() { - if (this.noteContext) { - // make sure the hoisted node is loaded (can be unloaded e.g. after tree collapse in another tab) - const hoistedNotePath = await treeService.resolveNotePath(this.noteContext.hoistedNoteId); - await this.getNodeFromPath(hoistedNotePath); + if (!this.noteContext) { + return; + } - if (this.noteContext.hoistedNoteId === 'root') { - this.tree.clearFilter(); - } - else { - // hack when hoisted note is cloned then it could be filtered multiple times while we want only 1 - this.tree.filterBranches(node => - node.data.noteId === this.noteContext.hoistedNoteId // optimization to not having always resolve the node path - && treeService.getNotePath(node) === hoistedNotePath); - } + const hoistedNotePath = await treeService.resolveNotePath(this.noteContext.hoistedNoteId); + await this.getNodeFromPath(hoistedNotePath); + + if (this.noteContext.hoistedNoteId === 'root') { + this.tree.clearFilter(); + } else { + // hack when hoisted note is cloned then it could be filtered multiple times while we want only 1 + this.tree.filterBranches(node => + node.data.noteId === this.noteContext.hoistedNoteId // optimization to not having always resolve the node path + && treeService.getNotePath(node) === hoistedNotePath); } } diff --git a/src/public/stylesheets/tree.css b/src/public/stylesheets/tree.css index 8f1103e32..624dc9f1d 100644 --- a/src/public/stylesheets/tree.css +++ b/src/public/stylesheets/tree.css @@ -2,6 +2,14 @@ ul.fancytree-container { padding-left: 0; } +ul.fancytree-container li { + list-style: none; +} + +span.fancytree-node.fancytree-hide { + display: none; +} + .fancytree-title { margin-left: 7px !important; }