Updated the native treenode to a custom HTML element

This commit is contained in:
Magnus Åhall 2026-04-29 14:03:08 +02:00
parent d9c82868ab
commit e2b20816c2
3 changed files with 110 additions and 48 deletions

View file

@ -3,7 +3,7 @@ import { signal } from 'preact/signals'
import htm from 'htm'
import { Node, NodeUI } from 'node'
import { ROOT_NODE } from 'node_store'
import { TreeNative, TreeNodeNative } from 'tree'
import { TreeNative } from 'tree'
const html = htm.bind(h)
export class Notes2 extends Component {
@ -542,13 +542,13 @@ class OpSearch extends Op {
for (const r of results) {
const ancestors = r.ancestry.reverse().map(a => {
const div = tmpl(`<div class="ancestor">${a.data.Name}</div>`)
div[0].addEventListener('click', ()=>_notes2.current.goToNode(a.UUID))
div[0].addEventListener('click', () => _notes2.current.goToNode(a.UUID))
return div[0]
})
const div = tmpl(`<div>${r.name}</div>`)
div[0].addEventListener('click', ()=>_notes2.current.goToNode(r.uuid))
div[0].addEventListener('click', () => _notes2.current.goToNode(r.uuid))
rs.push(...div)
const ancDev = tmpl('<div class="ancestors"></div>')