placeholder working

This commit is contained in:
vabene1111 2024-02-10 10:08:32 +01:00
parent 0827cb387f
commit 3f962345f7

View File

@ -18,15 +18,17 @@ import {defaultKeymap} from "@codemirror/commands"
import {markdown} from "@codemirror/lang-markdown" import {markdown} from "@codemirror/lang-markdown"
import {autocompletion} from "@codemirror/autocomplete" import {autocompletion} from "@codemirror/autocomplete"
class PlaceholderWidget extends WidgetType { //TODO this is not working for some javascript magic reason class PlaceholderWidget extends WidgetType {
name = undefined name = undefined
constructor(name) { constructor(name) {
console.log(name) console.log('name:', name)
super() super()
this.name = name
} }
eq(other) { eq(other) {
return this.name == other.name return this.name === other.name
} }
toDOM() { toDOM() {
@ -37,7 +39,7 @@ class PlaceholderWidget extends WidgetType { //TODO this is not working for some
padding: 0 3px; padding: 0 3px;
background: lightblue;` background: lightblue;`
elt.textContent = "Food" elt.textContent = this.name
return elt return elt
} }
@ -98,6 +100,7 @@ export default {
{label: "Mehl", type: "text", apply: "{{ ingredients[1] }}", detail: "template"}, {label: "Mehl", type: "text", apply: "{{ ingredients[1] }}", detail: "template"},
{label: "Butter", type: "text", apply: "{{ ingredients[2] }}", detail: "template"}, {label: "Butter", type: "text", apply: "{{ ingredients[2] }}", detail: "template"},
{label: "Salz", type: "text", apply: "{{ ingredients[3] }}", detail: "template"}, {label: "Salz", type: "text", apply: "{{ ingredients[3] }}", detail: "template"},
{label: "Scale", type: "text", apply: "{{ scale(100) }}", detail: "simple scalable number"},
] ]
} }
} }