Listen to ckeditor widget events

I tried to extend a simple widget widget ( http://docs.ckeditor.com/#!/guide/widget_sdk_tutorial_1 ) with some events, but I really don't understand. One of my goals is to trigger an event if the focused editable field (for example, name-element-title) is inside the widget. But, unfortunately, I can only listen if the widget itself is focused:

editor.widgets.add('simplebox', {
            // definitions for
            // button, template, etc
            init: function() {
                this.on('focus', function(ev){
                    console.log('focused this');
                });
            }
        });

or if the data is changed:

CKEDITOR.plugins.add('simplebox', {
// my plugin code
init: function (editor) {    
    editor.widgets.on( 'instanceCreated', function( evt ) {
        var widget = evt.data;
        widget.on('data', function(evt){
            console.log("data changed");
        });
    });
}
//even more code
});

How to listen to editable fields in widgets? Another problem for me is to fire an event if the widget is deleted. Maybe someone also knows how to listen to this event?

+4
source share
1 answer

?

. , , - , editor#change.

- , .

widget#destroy , . , , .

backspace , - , . .

backspace, , . CKEditor , , . , editor.widgets.checkWidgtes() - . editor#change, . .

+9

All Articles