@@ -46,7 +46,7 @@ const props = withDefaults(
4646 autofocus? : boolean ;
4747 value? : Object ;
4848 bordered? : boolean ;
49- placeholder: string ;
49+ placeholder? : string ;
5050 tools: string [];
5151 folder? : string ;
5252 font: ' sans-serif' | ' monospace' | ' serif' ;
@@ -57,9 +57,7 @@ const props = withDefaults(
5757 autofocus: false ,
5858 value : () => null ,
5959 bordered: true ,
60- placeholder: null ,
6160 tools : () => [' header' , ' nestedlist' , ' code' , ' image' , ' paragraph' , ' delimiter' , ' checklist' , ' quote' , ' underline' ],
62- folder: null ,
6361 font: ' sans-serif' ,
6462 }
6563);
@@ -126,12 +124,7 @@ onUnmounted(() => {
126124watch (
127125 () => props .value ,
128126 async (newVal : any , oldVal : any ) => {
129- if (! editorjsInstance .value || ! editorjsInstance .value .isReady ) return ;
130-
131- if (isInternalChange .value ) {
132- isInternalChange .value = false ;
133- return ;
134- }
127+ if (! editorjsInstance .value || ! editorjsInstance .value .isReady || isInternalChange .value ) return ;
135128
136129 // Do not render if there is uploader active operation.
137130 if (fileHandler .value !== null ) return ;
@@ -142,17 +135,19 @@ watch(
142135 await editorjsInstance .value .isReady ;
143136 const value = getSanitizedValue (newVal );
144137 if (value ) {
145- editorjsInstance .value .render (value );
138+ await editorjsInstance .value .render (value );
146139 } else {
147140 editorjsInstance .value .clear ();
148141 }
149142 } catch (error ) {
150143 window .console .warn (' editorjs-extension: %s' , error );
151144 }
145+
146+ isInternalChange .value = false ;
152147 }
153148);
154149
155- async function emitValue(context : EditorJS .API , targetBlock : EditorJS . BlockAPI ) {
150+ async function emitValue(context : EditorJS .API , event : CustomEvent ) {
156151 if (props .disabled || ! context || ! context .saver ) return ;
157152 isInternalChange .value = true ;
158153
@@ -166,9 +161,9 @@ async function emitValue(context: EditorJS.API, targetBlock: EditorJS.BlockAPI)
166161 return ;
167162 }
168163
164+ if (isEqual (result .blocks , props .value ?.blocks )) return ;
169165 emit (' input' , result );
170166 } catch (error ) {
171- isInternalChange .value = false ;
172167 window .console .warn (' editorjs-extension: %s' , error );
173168 }
174169}
0 commit comments