Rewrite
This commit is contained in:
parent
42b66714aa
commit
ac8b334eee
35 changed files with 541 additions and 675 deletions
|
|
@ -8,20 +8,28 @@ const html = htm.bind(h)
|
|||
export class Notes2 {
|
||||
constructor() {//{{{
|
||||
this.startNode = null
|
||||
this.tree = createRef()
|
||||
this.tree = null
|
||||
this.nodeUI = createRef()
|
||||
this.nodeModified = signal(false)
|
||||
this.setStartNode()
|
||||
}//}}}
|
||||
render() {//{{{
|
||||
return html`
|
||||
<button onclick=${() => API.logout()}>Log out</button>
|
||||
<${Tree} ref=${this.tree} app=${this} />
|
||||
<${NodeUI} app=${this} ref=${this.nodeUI} />
|
||||
<div class="nodeui">
|
||||
<${NodeUI} app=${this} ref=${this.nodeUI} />
|
||||
</div>
|
||||
`
|
||||
}//}}}
|
||||
setStartNode() {//{{{
|
||||
/*
|
||||
const urlParams = new URLSearchParams(window.location.search)
|
||||
const nodeID = urlParams.get('node')
|
||||
*/
|
||||
|
||||
const parts = document.URL.split('#')
|
||||
const nodeID = parts[1]
|
||||
|
||||
this.startNode = new Node(this, nodeID ? Number.parseInt(nodeID) : 0)
|
||||
}//}}}
|
||||
|
||||
|
|
@ -43,6 +51,7 @@ class Tree extends Component {
|
|||
this.treeNodeComponents = {}
|
||||
this.treeTrunk = []
|
||||
this.selectedTreeNode = null
|
||||
this.props.app.tree = this
|
||||
|
||||
this.retrieve()
|
||||
}//}}}
|
||||
|
|
@ -100,6 +109,7 @@ class Tree extends Component {
|
|||
.catch(e => { console.log(e); console.log(e.type, e.error); alert(e.error) })
|
||||
}//}}}
|
||||
setSelected(node) {//{{{
|
||||
return // TODO
|
||||
if (this.selectedTreeNode)
|
||||
this.selectedTreeNode.selected.value = false
|
||||
|
||||
|
|
@ -109,6 +119,7 @@ class Tree extends Component {
|
|||
this.expandToTrunk(node.ID)
|
||||
}//}}}
|
||||
crumbsUpdateNodes(node) {//{{{
|
||||
console.log('crumbs', this.props.app.startNode.Crumbs)
|
||||
for (const crumb in this.props.app.startNode.Crumbs) {
|
||||
// Start node is loaded before the tree.
|
||||
const node = this.treeNodes[crumb.ID]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue