@@ -59,15 +59,7 @@ export default defineComponent({
59
59
const currentInstance = getCurrentInstance ( ) ?. proxy
60
60
const jsonEditor = ref ( )
61
61
62
- const preventUpdatingContent = ref ( false )
63
- const preventUpdatingModelValue = ref ( false )
64
-
65
62
const onChange = debounce ( ( updatedContent : Content ) => {
66
- if ( preventUpdatingModelValue . value ) {
67
- preventUpdatingModelValue . value = false
68
- return
69
- }
70
- preventUpdatingContent . value = true
71
63
emit (
72
64
updateModelValue ,
73
65
( updatedContent as TextContent ) . text === undefined
@@ -132,21 +124,14 @@ export default defineComponent({
132
124
watch (
133
125
( ) => props [ modelValueProp ] ,
134
126
( newModelValue : any ) => {
135
- if ( preventUpdatingContent . value ) {
136
- preventUpdatingContent . value = false
137
- return
138
- }
139
- if ( jsonEditor . value ) {
140
- preventUpdatingModelValue . value = true
141
- jsonEditor . value . set (
142
- [ undefined , '' ] . includes ( newModelValue )
143
- // `undefined` is not accepted by vanilla-jsoneditor
144
- // The default value is `{ text: '' }`
145
- // Only default value can clear the editor
146
- ? { text : '' }
147
- : { json : newModelValue } ,
148
- )
149
- }
127
+ jsonEditor . value ?. set (
128
+ [ undefined , '' ] . includes ( newModelValue )
129
+ // `undefined` is not accepted by vanilla-jsoneditor
130
+ // The default value is `{ text: '' }`
131
+ // Only default value can clear the editor
132
+ ? { text : '' }
133
+ : { json : newModelValue } ,
134
+ )
150
135
} ,
151
136
{
152
137
deep : true ,
0 commit comments