Search code examples
javascriptckeditordom-events

CKEditor hook/event fired up on switching to/from source view


I try to convert a div tag into something I can drag and drop in CKEditor (as asked in another question).

Do you know how I can trigger the event when someone switches between source view and WYSIWYG mode?


Solution

  • I think this is what you are looking for:

    CKEDITOR.on('instanceCreated', function(e) {
        e.editor.on('mode', function(e){
            // Do your stuff here
            alert(e.editor.mode);
        });
    });