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', {
init: function() {
this.on('focus', function(ev){
console.log('focused this');
});
}
});
or if the data is changed:
CKEDITOR.plugins.add('simplebox', {
init: function (editor) {
editor.widgets.on( 'instanceCreated', function( evt ) {
var widget = evt.data;
widget.on('data', function(evt){
console.log("data changed");
});
});
}
});
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?
source
share