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