mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix collapse tree
This commit is contained in:
parent
6469937393
commit
397f0d1326
@ -763,7 +763,8 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
|
|
||||||
const {branchIds} = await server.put(`branches/${node.data.branchId}/expanded-subtree/${isExpanded ? 1 : 0}`);
|
const {branchIds} = await server.put(`branches/${node.data.branchId}/expanded-subtree/${isExpanded ? 1 : 0}`);
|
||||||
|
|
||||||
treeCache.getBranches(branchIds, true).forEach(branch => branch.isExpanded = isExpanded);
|
treeCache.getBranches(branchIds, true)
|
||||||
|
.forEach(branch => branch.isExpanded = !!isExpanded);
|
||||||
|
|
||||||
await this.batchUpdate(async () => {
|
await this.batchUpdate(async () => {
|
||||||
await node.load(true);
|
await node.load(true);
|
||||||
|
@ -121,7 +121,8 @@ function moveBranchAfterNote(req) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setExpanded(req) {
|
function setExpanded(req) {
|
||||||
const {branchId, expanded} = req.params;
|
const {branchId} = req.params;
|
||||||
|
const expanded = parseInt(req.params.expanded);
|
||||||
|
|
||||||
if (branchId !== 'root') {
|
if (branchId !== 'root') {
|
||||||
sql.execute("UPDATE branches SET isExpanded = ? WHERE branchId = ?", [expanded, branchId]);
|
sql.execute("UPDATE branches SET isExpanded = ? WHERE branchId = ?", [expanded, branchId]);
|
||||||
@ -137,7 +138,8 @@ function setExpanded(req) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setExpandedForSubtree(req) {
|
function setExpandedForSubtree(req) {
|
||||||
const {branchId, expanded} = req.params;
|
const {branchId} = req.params;
|
||||||
|
const expanded = parseInt(req.params.expanded);
|
||||||
|
|
||||||
let branchIds = sql.getColumn(`
|
let branchIds = sql.getColumn(`
|
||||||
WITH RECURSIVE
|
WITH RECURSIVE
|
||||||
|
@ -22,7 +22,7 @@ function load() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const row of sql.iterateRows(`SELECT branchId, noteId, parentNoteId, prefix, notePosition, isExpanded FROM branches WHERE isDeleted = 0`, [])) {
|
for (const row of sql.iterateRows(`SELECT branchId, noteId, parentNoteId, prefix, notePosition, isExpanded FROM branches WHERE isDeleted = 0`, [])) {
|
||||||
new Branch(noteCache, row);
|
const branch = new Branch(noteCache, row);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const row of sql.iterateRows(`SELECT attributeId, noteId, type, name, value, isInheritable, position FROM attributes WHERE isDeleted = 0`, [])) {
|
for (const row of sql.iterateRows(`SELECT attributeId, noteId, type, name, value, isInheritable, position FROM attributes WHERE isDeleted = 0`, [])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user