Rename nodes.

This commit is contained in:
Magnus Åhall 2026-05-23 22:55:16 +02:00
parent 0ae8ef939b
commit 068e21c962
2 changed files with 35 additions and 18 deletions

View file

@ -31,6 +31,17 @@ export class N2Tree extends CustomHTMLElement {
this.elSync.addEventListener('click', () => _sync.run())
this.elLogo.addEventListener('click', () => _app.goToNode(ROOT_NODE, false, false))
_mbus.subscribe('NODE_MODIFIED', ({ detail })=>{
const node = detail.data.node
const treenode = this.treeNodeComponents[node.get('UUID')]
if (!treenode)
return
treenode.node = node
treenode.render(true)
})
this.populateFirstLevel()
}// }}}
render() {// {{{
@ -46,14 +57,14 @@ export class N2Tree extends CustomHTMLElement {
this.rendered = true
return this
}// }}}
reset() {
reset() {// {{{
console.log('tree reset')
this.treeNodeComponents = {}
this.treeTrunk = []
this.rendered = false
this.elTreenodes.replaceChildren()
this.populateFirstLevel()
}
}// }}}
populateFirstLevel() {//{{{
nodeStore.get(ROOT_NODE)
.then(node => node.fetchChildren())