fix note hoisting

This commit is contained in:
zadam 2021-07-21 22:47:52 +02:00
parent 74d0626dc9
commit 9da8d466b8
2 changed files with 22 additions and 14 deletions

View File

@ -1174,25 +1174,25 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
async hoistedNoteChangedEvent({ntxId}) { async hoistedNoteChangedEvent({ntxId}) {
if (this.isNoteContext(ntxId)) { if (this.isNoteContext(ntxId)) {
this.filterHoistedBranch(); await this.filterHoistedBranch();
} }
} }
async filterHoistedBranch() { async filterHoistedBranch() {
if (this.noteContext) { if (!this.noteContext) {
// make sure the hoisted node is loaded (can be unloaded e.g. after tree collapse in another tab) return;
const hoistedNotePath = await treeService.resolveNotePath(this.noteContext.hoistedNoteId); }
await this.getNodeFromPath(hoistedNotePath);
if (this.noteContext.hoistedNoteId === 'root') { const hoistedNotePath = await treeService.resolveNotePath(this.noteContext.hoistedNoteId);
this.tree.clearFilter(); await this.getNodeFromPath(hoistedNotePath);
}
else { if (this.noteContext.hoistedNoteId === 'root') {
// hack when hoisted note is cloned then it could be filtered multiple times while we want only 1 this.tree.clearFilter();
this.tree.filterBranches(node => } else {
node.data.noteId === this.noteContext.hoistedNoteId // optimization to not having always resolve the node path // hack when hoisted note is cloned then it could be filtered multiple times while we want only 1
&& treeService.getNotePath(node) === hoistedNotePath); this.tree.filterBranches(node =>
} node.data.noteId === this.noteContext.hoistedNoteId // optimization to not having always resolve the node path
&& treeService.getNotePath(node) === hoistedNotePath);
} }
} }

View File

@ -2,6 +2,14 @@ ul.fancytree-container {
padding-left: 0; padding-left: 0;
} }
ul.fancytree-container li {
list-style: none;
}
span.fancytree-node.fancytree-hide {
display: none;
}
.fancytree-title { .fancytree-title {
margin-left: 7px !important; margin-left: 7px !important;
} }