diff --git a/static/css/notes2.css b/static/css/notes2.css index 743b4b3..b4d7e02 100644 --- a/static/css/notes2.css +++ b/static/css/notes2.css @@ -92,7 +92,7 @@ button { border-right: none; } - n2-tree { + n2-sidebar { display: none; } @@ -164,7 +164,7 @@ button { border-right: 1px solid var(--line-color); - n2-tree { + n2-sidebar { .el-treenodes { margin: 24px 32px 32px 32px; } @@ -508,7 +508,7 @@ dialog.op { } #tree { - n2-tree { + n2-sidebar { .el-treenodes { height: calc(100vh - 64px - 64px); margin: 0px; diff --git a/static/js/app.mjs b/static/js/app.mjs index b444140..2b5cbe1 100644 --- a/static/js/app.mjs +++ b/static/js/app.mjs @@ -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) }//}}} } diff --git a/static/js/tree.mjs b/static/js/sidebar.mjs similarity index 94% rename from static/js/tree.mjs rename to static/js/sidebar.mjs index 6443455..c0ef99e 100644 --- a/static/js/tree.mjs +++ b/static/js/sidebar.mjs @@ -59,12 +59,12 @@ class TreeExpansionHandler {// {{{ } }// }}} -export class N2Tree extends CustomHTMLElement { +export class N2Sidebar extends CustomHTMLElement { static {// {{{ this.tmpl = document.createElement('template') this.tmpl.innerHTML = `