mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-18 08:13:40 +08:00
when expanding/collpasing, set the flag also to the tree cache
This commit is contained in:
parent
9d8b8e26a1
commit
e08b0141a4
@ -251,8 +251,8 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
this.triggerCommand('setActiveScreen', {screen:'detail'});
|
this.triggerCommand('setActiveScreen', {screen:'detail'});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
expand: (event, data) => this.setExpandedToServer(data.node.data.branchId, true),
|
expand: (event, data) => this.setExpanded(data.node.data.branchId, true),
|
||||||
collapse: (event, data) => this.setExpandedToServer(data.node.data.branchId, false),
|
collapse: (event, data) => this.setExpanded(data.node.data.branchId, false),
|
||||||
hotkeys: utils.isMobile() ? undefined : { keydown: await this.getHotKeys() },
|
hotkeys: utils.isMobile() ? undefined : { keydown: await this.getHotKeys() },
|
||||||
dnd5: {
|
dnd5: {
|
||||||
autoExpandMS: 600,
|
autoExpandMS: 600,
|
||||||
@ -929,12 +929,13 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async setExpandedToServer(branchId, isExpanded) {
|
async setExpanded(branchId, isExpanded) {
|
||||||
utils.assertArguments(branchId);
|
utils.assertArguments(branchId);
|
||||||
|
|
||||||
const expandedNum = isExpanded ? 1 : 0;
|
const branch = treeCache.getBranch(branchId);
|
||||||
|
branch.isExpanded = isExpanded;
|
||||||
|
|
||||||
await server.put('branches/' + branchId + '/expanded/' + expandedNum);
|
await server.put(`branches/${branchId}/expanded/${isExpanded ? 1 : 0}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async reloadTreeFromCache() {
|
async reloadTreeFromCache() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user