@@ -114,11 +114,12 @@ const JsonEditorVue = defineComponent({
114
114
const stringifiedComputed = computed ( ( ) => conclude ( [ props . stringified , propsGlobal . stringified , true ] , {
115
115
type : Boolean as PropType < boolean > ,
116
116
} ) )
117
+ let parse = JSON . parse
117
118
const onChange = debounce ( ( updatedContent : { json ?: any , text ?: string } ) => {
118
119
preventUpdatingContent . value = true
119
120
if ( ! stringifiedComputed . value && updatedContent . text ) {
120
121
if ( jsonEditor . value && ! jsonEditor . value . validate ( ) ) {
121
- updatedContent . json = JSON . parse ( updatedContent . text )
122
+ updatedContent . json = parse ( updatedContent . text )
122
123
}
123
124
updatedContent . text = undefined
124
125
}
@@ -173,6 +174,8 @@ const JsonEditorVue = defineComponent({
173
174
} ,
174
175
)
175
176
177
+ parse = initialAttrs . parser ?. parse || JSON . parse
178
+
176
179
jsonEditor . value = new JSONEditor ( {
177
180
target : currentInstance ?. $refs . jsonEditorRef as Element ,
178
181
props : initialAttrs ,
@@ -231,6 +234,7 @@ const JsonEditorVue = defineComponent({
231
234
if ( newAttrs . onChangeMode || newAttrs [ 'on-change-mode' ] ) {
232
235
defaultFunctionAttrs . onChangeMode = onChangeMode
233
236
}
237
+ parse = ( newAttrs . parser as JSON ) ?. parse || JSON . parse
234
238
jsonEditor . value ?. updateProps (
235
239
Object . getOwnPropertyNames ( defaultFunctionAttrs ) . length > 0
236
240
? conclude ( [ newAttrs , defaultFunctionAttrs ] , {
0 commit comments