I have found out that I can hook into onOk with this:
editor.on(\'dialogShow\', function (ev)
{
var name = ev.data.getName();
var defini
var oldImplementation = definition.onOk;
definition.onOk = function(e)
{
oldImplementation(e);
console.log( e );
};
Small improvement of maximkou's solution:
var oldImplementation = definition.onOk;
definition.onOk = function( e ) {
oldImplementation.apply( this, [].slice.call( arguments ) );
console.log( e );
};
This solution is ok and AFAIK it's the cleanest one.
Update: I've found a better solution - there's dialog#ok event about which I've just learnt :). So you don't need to change dialog's definition - you can bind your event listener like this:
editor.on('dialogShow', function ( evt ) {
if ( evt.data.getName() == 'image' ) {
var listener = evt.data.on( 'ok', function() {
console.log( 'ok!' );
} );
// We need to remove that listener, to avoid duplicating it on
// next dialogShow.
evt.data.on( 'hide', function() {
listener.removeListener();
} );
}
} );