Closed Lelectrolux closed 7 years ago
Code to reproduce bug :
// TestingBug.vue <template> <div> <ck-editor v-model="text"></ck-editor> <button @click="text = '<p>Lorem ipsum</p>'">Send</button> </div> </template> <script type="text/babel"> import CkEditor from 'vue-ckeditor2' export default { data() { return { text: '<p>dolor sit amet.</p>' } }, components: {CkEditor} } </script>
Once the page is loaded, add something in the ckeditor, then click the button.
From what I've understood, the beforeUpdate of the TestingBug component is called, which in turn calls the beforeUpdate of the CkEditor component, etc.
beforeUpdate
TestingBug
CkEditor
Fix :
Use a watcher instead of a beforeUpdate hook. Replace that hook with :
export default { // ... watch: { value(value) { const { id } = this; if (value !== CKEDITOR.instances[id].getData()) { CKEDITOR.instances[id].setData(value) } } }, // ... }
@Lelectrolux Thank you for contribution.
Code to reproduce bug :
Once the page is loaded, add something in the ckeditor, then click the button.
From what I've understood, the
beforeUpdate
of theTestingBug
component is called, which in turn calls thebeforeUpdate
of theCkEditor
component, etc.Fix :
Use a watcher instead of a
beforeUpdate
hook. Replace that hook with :