Work on special pages
This commit is contained in:
parent
d9adfd3a91
commit
da7999fb24
7 changed files with 185 additions and 95 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { ROOT_NODE } from 'node_store'
|
||||
import { ROOT_NODE, ORPHANED_NODE , DELETED_NODE} from 'node_store'
|
||||
import { Node } from 'node'
|
||||
import { CustomHTMLElement } from './lib/custom_html_element.mjs'
|
||||
import { Color, Solver } from './lib/css_colorize.mjs'
|
||||
|
||||
|
|
@ -156,8 +157,15 @@ export class N2Sidebar extends CustomHTMLElement {
|
|||
this.expandedNodes[ROOT_NODE] = true
|
||||
const startnode = await nodeStore.get(ROOT_NODE)
|
||||
const starttreenode = new N2TreeNode(this, startnode, null)
|
||||
|
||||
const deletednode = await nodeStore.get(DELETED_NODE)
|
||||
const deletedtreenode = new SpecialNodeDeleted(this, deletednode, null)
|
||||
|
||||
this.treeNodeComponents[startnode.UUID] = starttreenode
|
||||
this.treeNodeComponents[deletednode.UUID] = deletedtreenode
|
||||
|
||||
this.elTreenodes.appendChild(await starttreenode.render())
|
||||
this.elTreenodes.appendChild(await deletedtreenode.render())
|
||||
|
||||
// Notify the application that the initial tree is rendered (with children)
|
||||
// and that initial node selection can take place. App will check URL to
|
||||
|
|
@ -668,6 +676,12 @@ export class N2TreeNode extends CustomHTMLElement {
|
|||
// The expand icon <img> is only changed to not get a flickering when re-rendering.
|
||||
if (this.node.UUID === ROOT_NODE)
|
||||
this.setImgSrc(this.elExpand, `/images/${window._VERSION}/icon_home.svg`)
|
||||
|
||||
else if (this.node.UUID === '00000000-0000-0000-0000-000000000002') {
|
||||
this.setImgSrc(this.elExpand, `/images/${window._VERSION}/leaf_deleted.svg`)
|
||||
this.elExpand.classList.add('deleted')
|
||||
}
|
||||
|
||||
else if (!this.node.hasChildren())
|
||||
this.setImgSrc(this.elExpand, `/images/${window._VERSION}/leaf.svg`)
|
||||
else if (this.sidebar.getNodeExpanded(this.node.UUID))
|
||||
|
|
@ -703,7 +717,15 @@ export class N2TreeNode extends CustomHTMLElement {
|
|||
}// }}}
|
||||
}
|
||||
|
||||
class SpecialNodeDeleted extends N2TreeNode {
|
||||
constructor(sidebar, node, parent) {//{{{
|
||||
super(sidebar, node, parent)
|
||||
this.removeAttribute('draggable')
|
||||
}//}}}
|
||||
}
|
||||
|
||||
customElements.define('n2-sidebar', N2Sidebar)
|
||||
customElements.define('n2-treenode', N2TreeNode)
|
||||
customElements.define('n2-specialnodedeleted', SpecialNodeDeleted)
|
||||
|
||||
// vim: foldmethod=marker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue