ckeditor4-vue
ckeditor4-vue copied to clipboard
CKEditor data not updated correctly if v-model changes during initialization timing window
Are you reporting a feature request or a bug?
Bug
Provide detailed reproduction steps (if any)
https://codesandbox.io/s/ckeditor4-vue-bug-report-v-model-timing-window-issue-s83ys2
- Use v-model with CKEditor4-Vue.
- Initialize this v-model to some value (the "initial value").
- Set the editor v-model to another value (the "new value") immediately after the
instanceReady
CKEditor event is emitted (or close to this timing window).
Expected result
CKEditor should show the updated model value ("new value").
Actual result
CKEditor shows the original model value ("initial value").
Other details
- Browser: Tested on Chrome and Firefox
- OS: Tested on MacOS
- Integration version: 2.0.0, but also versions before this
- CKEditor version: 4.18.0, but also versions before this
- Installed CKEditor plugins: …
Additional Notes
- If the v-model "initial value" is set to an empty string and the "new value" is set during this timing window:
- CKEditor will be empty
- However, the v-model will contain the "new value." This means that Vue is still aware of what the editor value should be.
- If the v-model "initial value" is not an empty string and the "new value" is set during this timing window:
- CKEditor will show the "initial value"
- The v-model will not contain the "new value", as it is somehow overwritten (perhaps by an errant
input
event?). This means that the "new value" is lost!
We hit this by populating the CKEditor contents upon a page load from an async call (using v-model). It is not consistently reproducible in our app as it depends on hitting what seems to be a narrow timing window. But the provided CodeSandbox appears to consistently reproduce this by changing the v-model on the instanceReady
event.
This could be related to #50.
It's been a while since we last heard from you. We are marking this issue as stale due to inactivity. Please provide the requested feedback or the issue will be closed after next 7 days.
Hello, @wsiota, thanks for the report and I'm sorry for the late reply.
I see, that even giving a zero-latency timeout in the instanceReady()
method for a model update solves the problem. 🤔
For now, I can confirm this issue.