Refactored tree to sidebar
This commit is contained in:
parent
83abc3f456
commit
b3e5d79403
4 changed files with 25 additions and 25 deletions
|
|
@ -1,12 +1,12 @@
|
|||
import { ROOT_NODE } from 'node_store'
|
||||
import { CustomHTMLElement } from './lib/custom_html_element.mjs'
|
||||
import { N2Tree } from 'tree'
|
||||
import { N2Sidebar } from 'sidebar'
|
||||
import { Node } from 'node'
|
||||
|
||||
export class App {
|
||||
constructor() {// {{{
|
||||
this.currentNode = null
|
||||
this.tree = new N2Tree()
|
||||
this.sidebar = new N2Sidebar() // XXX - rename this.tree
|
||||
this.crumbs = new N2Crumbs()
|
||||
this.crumbsElement = document.getElementById('crumbs')
|
||||
this.nodeUI = document.getElementById('note')
|
||||
|
|
@ -22,7 +22,7 @@ export class App {
|
|||
this.goToNode(startNode.UUID, false, false)
|
||||
})
|
||||
|
||||
document.getElementById('tree').append(await this.tree.render())
|
||||
document.getElementById('tree').append(await this.sidebar.render())
|
||||
document.getElementById('tree-nodes')?.focus()
|
||||
|
||||
if (startNode.UUID == ROOT_NODE)
|
||||
|
|
@ -85,7 +85,7 @@ export class App {
|
|||
if (document.activeElement.id === 'tree-nodes') {
|
||||
this.nodeUI.takeFocus()
|
||||
} else {
|
||||
this.tree.focus()
|
||||
this.sidebar.focus()
|
||||
}
|
||||
break
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ export class App {
|
|||
node.reset() // any modifications are discarded.
|
||||
|
||||
this.currentNode = node
|
||||
this.tree.setSelected(node, dontExpand)
|
||||
this.sidebar.setSelected(node, dontExpand)
|
||||
|
||||
const ancestors = await nodeStore.getNodeAncestry(node)
|
||||
_mbus.dispatch('CRUMBS_SET', ancestors, () => this.crumbsElement.replaceChildren(this.crumbs.render()))
|
||||
|
|
@ -193,7 +193,7 @@ export class App {
|
|||
_mbus.dispatch('TREE_EXPANSION', { expand: false, when: 'narrow' })
|
||||
|
||||
// Scrolls node into view.
|
||||
this.tree.makeVisible(node)
|
||||
this.sidebar.makeVisible(node)
|
||||
}//}}}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue