Detect when user switched edit modes in CKEditor

Is there an event in CKEditor that might be related to what fires when the user switches between the WYSIWYG view and the source view?

If not, I need to enable / disable some other controls on the page when changing the view; what's my best strategy?

+3
source share
2 answers

I still can’t find any documentation, but after poking the insides of the CKEditor instance, I managed to find the event I'm looking for:

instance.on('mode', function() {
     // Code to execute when the user switches editing modes
}

. , , source ( instance.execCommand(...), , source).

+9

,

CKEDITOR.instances['terms_and_conditions'].on('mode', function() {
    console.log(this.mode); // outputs: source, wysiwyg
});
0

Source: https://habr.com/ru/post/1750887/


All Articles