I’ve a CKEditor (ckeditor4-react - npm), and
onBlur we’re saving the text to the field value. But even if
setFieldValue is called one time,
addFieldChangeListener is called two times one with the updated value and the next one with the old value and we can’t save the updated value since it is overridden by the next change to the previous value.
I can’t track where the second
addFieldChangeListener call is coming from. From the documentation(Plugins SDK - SDK Reference - DatoCMS Docs) it says
addFiledChangeListener will be called in two cases,
- External event(eg, when multiple editors are working on the same entry)
I’ve checked that
setFieldValue in our codebase has called one time, but I don’t understand the second case because there’re no other event which triggers update of the field value.
Please see the record, to see the problem.
If we click outside the field, and then click
Save it will work as expected. But content users sometimes may click
Save button directly.