Fixed tree reset after sync, optimized sync with IndexedDB
This commit is contained in:
parent
454d065baa
commit
26ca510785
5 changed files with 72 additions and 52 deletions
|
|
@ -6,13 +6,13 @@ import { Node } from 'node'
|
|||
export class App {
|
||||
constructor() {// {{{
|
||||
this.currentNode = null
|
||||
this.treeNative = new N2Tree()
|
||||
this.tree = new N2Tree()
|
||||
this.crumbs = new N2Crumbs()
|
||||
this.crumbsElement = document.getElementById('crumbs')
|
||||
this.nodeUI = document.getElementById('note')
|
||||
|
||||
_mbus.subscribe('TREE_TRUNK_FETCHED', async () => {
|
||||
document.getElementById('tree').append(this.treeNative.render())
|
||||
document.getElementById('tree').append(this.tree.render())
|
||||
document.getElementById('tree-nodes')?.focus()
|
||||
|
||||
const startNode = await this.getStartNode()
|
||||
|
|
@ -188,7 +188,7 @@ export class App {
|
|||
node.reset() // any modifications are discarded.
|
||||
|
||||
this.currentNode = node
|
||||
this.treeNative.setSelected(node, dontExpand)
|
||||
this.tree.setSelected(node, dontExpand)
|
||||
|
||||
const ancestors = await nodeStore.getNodeAncestry(node)
|
||||
_mbus.dispatch('CRUMBS_SET', ancestors, () => this.crumbsElement.replaceChildren(this.crumbs.render()))
|
||||
|
|
@ -196,7 +196,7 @@ export class App {
|
|||
_mbus.dispatch('NODE_UNMODIFIED')
|
||||
|
||||
// Scrolls node into view.
|
||||
this.treeNative.makeVisible(node)
|
||||
this.tree.makeVisible(node)
|
||||
}//}}}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue