Mari Selvan
Mari Selvan

Reputation: 3792

CKEDITOR : Programatically close Find Dialog Box

I'm creating a new plugin in CKEditor.In this plugin, I want some functionality of Find plugin.

So, I try to trigger it using the below command.

editor.execCommand('find');

Trying to close it with the below command.

if(editor.execCommand('find')){
   $('.cke_dialog_ui_button').click();
  //It will close the dialogBox.
}

But I know this is not the right way to do this.

I want to close it automatically in a right way.How can I do this?

Anyone, Please help me to do this?

Upvotes: 1

Views: 303

Answers (1)

j.swiderski
j.swiderski

Reputation: 2445

Please try below code:

var editor = CKEDITOR.replace( 'editor1', {});
editor.on( 'instanceReady', function( evt ) {
    editor.on( 'dialogShow', function( evt ) {
        evt.data.definition.dialog.hide();
    });                 
    editor.execCommand('find');
}); 

Please see: https://docs.ckeditor.com/ckeditor4/latest/api/CKEDITOR_dialog.html#method-hide

Upvotes: 1

Related Questions