Work on sync element, now a custom HTML element
This commit is contained in:
parent
99063d34be
commit
9fc4a14ce3
10 changed files with 190 additions and 1001 deletions
|
|
@ -1,8 +1,7 @@
|
|||
import { ROOT_NODE } from 'node_store'
|
||||
import { CustomHTMLElement } from './lib/custom_html_element.mjs'
|
||||
import { N2Tree } from 'tree'
|
||||
import { NodeUINative, Node } from 'node'
|
||||
import { SyncProgress } from 'sync'
|
||||
import { Node } from 'node'
|
||||
|
||||
export class App {
|
||||
constructor() {// {{{
|
||||
|
|
@ -10,7 +9,7 @@ export class App {
|
|||
this.treeNative = new N2Tree()
|
||||
this.crumbs = new N2Crumbs()
|
||||
this.crumbsElement = document.getElementById('crumbs')
|
||||
this.nodeUI = new NodeUINative(document.getElementById('note'))
|
||||
this.nodeUI = document.getElementById('note')
|
||||
|
||||
_mbus.subscribe('TREE_TRUNK_FETCHED', async () => {
|
||||
document.getElementById('tree').append(this.treeNative.render())
|
||||
|
|
@ -36,11 +35,12 @@ export class App {
|
|||
document.getElementById('node-content')?.focus()
|
||||
})
|
||||
|
||||
const syncProgress = document.getElementById('sync-progress')
|
||||
new SyncProgress(syncProgress)
|
||||
|
||||
window._sync = new Sync()
|
||||
window._sync.run()
|
||||
|
||||
// I think it is uncomfortable having the sync running as soon as the page load.
|
||||
// I haven't gotten the time to look at the page before stuff jumps around.
|
||||
// There a slight delay to initiate sync seems reasonable.
|
||||
setTimeout(() => window._sync.run(), 1000)
|
||||
}// }}}
|
||||
|
||||
keyHandler(event) {//{{{
|
||||
|
|
@ -55,9 +55,9 @@ export class App {
|
|||
switch (event.key.toUpperCase()) {
|
||||
case 'T':
|
||||
if (document.activeElement.id === 'tree-nodes')
|
||||
document.getElementById('node-content').focus()
|
||||
this.nodeUI.takeFocus()
|
||||
else
|
||||
document.getElementById('tree-nodes').focus()
|
||||
this.nodeUI.takeFocus()
|
||||
break
|
||||
|
||||
case 'F':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue