mirror of
https://github.com/zadam/trilium.git
synced 2025-01-17 12:39:51 +08:00
tree fixes
This commit is contained in:
parent
0bb548d0d1
commit
0a896cc19c
4 changed files with 15 additions and 8 deletions
|
@ -20,8 +20,6 @@ class Branch {
|
|||
/** @param {boolean} */
|
||||
this.isExpanded = !!row.isExpanded;
|
||||
/** @param {boolean} */
|
||||
this.isDeleted = !!row.isDeleted;
|
||||
/** @param {boolean} */
|
||||
this.fromSearchNote = !!row.fromSearchNote;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import TabAwareWidget from "./tab_aware_widget.js";
|
||||
import NoteListRenderer from "../services/note_list_renderer.js";
|
||||
import utils from "../services/utils.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="note-list-widget">
|
||||
|
@ -11,6 +10,10 @@ const TPL = `
|
|||
min-height: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.note-list-widget .note-list {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="note-list-widget-content">
|
||||
|
|
|
@ -21,6 +21,12 @@ function getNotesAndBranchesAndAttributes(noteIds) {
|
|||
collectEntityIds(branch.parentNote);
|
||||
}
|
||||
|
||||
for (const childNote of note.children) {
|
||||
const childBranch = noteCache.getBranch(childNote.noteId, note.noteId);
|
||||
|
||||
collectedBranchIds.add(childBranch.branchId);
|
||||
}
|
||||
|
||||
for (const attr of note.ownedAttributes) {
|
||||
collectedAttributeIds.add(attr.attributeId);
|
||||
|
||||
|
@ -51,7 +57,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
|
|||
isProtected: note.isProtected,
|
||||
type: note.type,
|
||||
mime: note.mime,
|
||||
isDeleted: note.isDeleted
|
||||
isDeleted: false // FIXME
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -106,16 +112,16 @@ function getNotesAndBranchesAndAttributes(noteIds) {
|
|||
|
||||
function getTree(req) {
|
||||
const subTreeNoteId = req.query.subTreeNoteId || 'root';
|
||||
const collectedNoteIds = new Set(['root']);
|
||||
const collectedNoteIds = new Set([subTreeNoteId]);
|
||||
|
||||
function collect(parentNote) {
|
||||
for (const childNote of parentNote.children || []) {
|
||||
for (const childNote of parentNote.children) {
|
||||
collectedNoteIds.add(childNote.noteId);
|
||||
|
||||
const childBranch = noteCache.getBranch(childNote.noteId, parentNote.noteId);
|
||||
|
||||
if (childBranch.isExpanded) {
|
||||
collect(childBranch);
|
||||
collect(childBranch.childNote);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ class Attribute {
|
|||
}
|
||||
|
||||
/** @param {string} */
|
||||
this.value = row.type === 'label' ? row.value.toLowerCase() : row.value;
|
||||
this.value = row.value;
|
||||
/** @param {boolean} */
|
||||
this.isInheritable = !!row.isInheritable;
|
||||
|
||||
|
|
Loading…
Reference in a new issue