-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OnChange event not firing when using ck-editor in source mode #36
Comments
I'm wrapping my ckeditor component in a another vue component which is a modal dialog. I ended out getting around this issue by having the ckeditor component emit an event containing the ckeditor instance when it's mounted. Then when the parent component responds to the mounted event emitted by the ckeditor vue component, it saves a reference to the underlying ckeditor instance passed with the event. When the modal is closed, I can call getData on the ckeditor instance and update the v-model. This has the added benefit of not calling getData() on the ckeditor with every keystroke. |
Hi @wittsparks Can you post your code in here. I can see problem. |
Hi @dangvanthanh , Here's the component where I'm using the ckeditor:
In ckeditor.vue, I added a console.log in this.instance.on('change') as shown in my original post. When I run the code, I see my log message when making changes in regular mode, but not in source mode. From my research, it sounds like the underlying ckeditor instance itself does not emit on-changed events in source mode. It does emit an event when you switch back to regular mode. As I said above, I solved the problem for my purposes by calling getData() on the ckeditor instance after the user closes the modal containing the editor, and that's working for me. So as far as I'm concerned this can be closed. Thanks, |
Hi @wittsparks. Thank you very much. I will close thread. You can open new issues when you working with vue-ckeditor. |
In case anyone comes across this I have a solution here:
By adding this extra event listener to the mounted method of the main ckeditor vue component it will update when inputs change when the source view is selected. AJ |
Thank you very much @MugenFTW I will be adding the extra event listeners to this case. |
Why do not just add a change event... Above solutions are so tedious. |
@tbwork It has to be done this way because the change event isn't fired by ck-editor when the editor is changed to source mode. |
Hello @dangvanthanh - Thanks for creating this!!
I added a console.log in ckeditor.vue here:
I see my log message whenever I make a change in ck-editor's 'normal' mode, but I don't see when in 'source' mode.
Update: looks like ck-editor itself doesn't fire change events in source mode:
Sounds like there are some valid reasons for that behavior, but it leaves me unable to detect the changed content if a user makes a change in ck-editor source mode. Anyone know of a workaround for this?
Thanks for any help!!
The text was updated successfully, but these errors were encountered: