File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
packages/app/modules/editor/components Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,10 @@ const emit = defineEmits(['update:modelValue'])
20
20
const el = ref <HTMLElement >()
21
21
const innerModel = ref (' ' )
22
22
23
- const textHaveVariable = computed (() => props .modelValue .includes (' {{' ))
23
+ const textHaveVariable = computed (() => {
24
+ // have {{ }} in text
25
+ return / \{\{ . * \}\} / .test (props .modelValue )
26
+ })
24
27
25
28
function setInnerModel() {
26
29
let text = props .modelValue
@@ -44,17 +47,15 @@ function update() {
44
47
emit (' update:modelValue' , text )
45
48
}
46
49
47
- const onInput = debounce (() => {
48
- if (textHaveVariable .value ) return
50
+ // const onInput = debounce(() => {
51
+ // if (textHaveVariable.value) return
49
52
50
- update ()
51
- }, 100 )
53
+ // update()
54
+ // }, 100)
52
55
53
56
const editMode = ref (false )
54
57
55
58
function onBlur() {
56
- if (! textHaveVariable .value ) return
57
-
58
59
update ()
59
60
60
61
editMode .value = false
@@ -143,15 +144,14 @@ defineExpose({
143
144
:is =" componentData"
144
145
v-if =" textHaveVariable"
145
146
class =" absolute left-0 top-0 transition-opacity w-full h-full"
146
- :class =" [textHaveVariable && editMode ? 'opacity-0' : '']"
147
+ :class =" [editMode ? 'opacity-0' : '']"
147
148
/>
148
149
149
150
<div
150
151
ref =" el"
151
152
contenteditable
152
153
class =" outline-none transition-opacity"
153
154
:class =" [textHaveVariable && !editMode ? 'opacity-0' : '']"
154
- @input =" onInput"
155
155
@blur =" onBlur"
156
156
@focus =" editMode = true"
157
157
@click =" editMode = true"
You can’t perform that action at this time.
0 commit comments