mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 05:11:31 -05:00
partially working replace logic
This commit is contained in:
27
vue/src/utils/cm-widgets.ts
Normal file
27
vue/src/utils/cm-widgets.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import {WidgetType} from "@codemirror/view";
|
||||
|
||||
class PlaceholderWidget extends WidgetType {
|
||||
constructor(readonly name: string) {
|
||||
super()
|
||||
}
|
||||
|
||||
eq(other: PlaceholderWidget) {
|
||||
return this.name == other.name
|
||||
}
|
||||
|
||||
toDOM() {
|
||||
const elt = document.createElement("span")
|
||||
elt.style.cssText = `
|
||||
border: 1px solid blue;
|
||||
border-radius: 4px;
|
||||
padding: 0 3px;
|
||||
background: lightblue;`
|
||||
console.log('reading name', this.name)
|
||||
elt.textContent = this.name
|
||||
return elt
|
||||
}
|
||||
|
||||
ignoreEvent() {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user