Skip to content

Commit

Permalink
make sure the onChange event is implemented while in the mode source …
Browse files Browse the repository at this point in the history
…view, which doesn't fire the onChange event so we must add it.

https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_editor.html#event-change
  • Loading branch information
chrispelzer committed Oct 18, 2023
1 parent 871616e commit 3d8a569
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions resources/js/components/CKEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ export default {

editor.on( 'change', onChange );

editor.on( 'mode', function() {
if ( this.mode == 'source' ) {
var editable = editor.editable();
editable.attachListener( editable, 'input', function() {
onChange();
} );
}
} );

editor.on( 'focus', evt => {
this.$emit( 'focus', evt, editor );
} );
Expand Down

0 comments on commit 3d8a569

Please sign in to comment.