mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 07:10:41 +00:00
20 lines
589 B
TypeScript
20 lines
589 B
TypeScript
import { AbstractNode, NodeMods } from './AbstractNode'
|
|
import { Path } from '../model/Path'
|
|
import { DataModel } from '../model/DataModel'
|
|
import { TreeView } from '../view/TreeView'
|
|
|
|
export class StringNode extends AbstractNode<string> {
|
|
constructor(mods?: NodeMods<string>) {
|
|
super(mods)
|
|
}
|
|
|
|
updateModel(el: Element, path: Path, model: DataModel) {
|
|
model.set(path, el.querySelector('input')?.value)
|
|
}
|
|
|
|
render(path: Path, value: string, view: TreeView) {
|
|
return this.wrap(path, view,
|
|
`<span>${path.last()}</span> <input value="${value || ''}"></input>`)
|
|
}
|
|
}
|