I'm trying to call close function for CKEditor dialog box from my custom plugin. Just like it happens when you are clicking on smile in "smileys" plugin, but I can't find out how can I do the same in my own plugin. Thanx for reply!
I've got the solution. In my plugin I needed to call close function from "CKEDITOR.dialog.add" in "onLoad" section. So, I have to do this:
CKEDITOR.dialog.add( 'plugin_name', function( editor ){
onLoad: function( event ){
[...some code...]
event.sender.hide();
}
}
I propose you do it the same way it is done by CKEditor Dialog plugin internally. See line 535 in plugin.js
By clicking the button or firing the cancel event you ensure correct handling by the plugin.
Code sample:
// If there's a Cancel button, click it, else just fire the cancel event and hide the dialog.
button = CKEDITOR.dialog.getCurrent().getButton( 'cancel' );
if ( button )
CKEDITOR.tools.setTimeout( button.click, 0, button );
else {
if ( CKEDITOR.dialog.getCurrent().fire( 'cancel', { hide : true } ).hide !== false )
CKEDITOR.dialog.getCurrent().hide();
}
CKEDITOR.dialog.getCurrent().hide()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With