0
votes

I am using ckeditor , and I have added 1 dialog where on button click i want to check whether cursor is inside table in ckeditor dialog ?

this is dialog code where on click of button i need to check the above condition

 CKEDITOR.dialog.add( 'NDFSRSDialog', function( editor ) {

    return {
        title: 'Formula Editor',

        contents: [
            {
                id: 'tab-basic',
                label: 'Basic condition',
                elements: [
                    {
                        type: 'text',
                        id: 'NDFSRS',
                        label: 'FIELD',
                        validate: CKEDITOR.dialog.validate.notEmpty( " field cannot be empty" )
                    },
                    {
                        type: 'button',
                        id: 'title',
                        label: 'CONDITION',
                        validate: CKEDITOR.dialog.validate.notEmpty( " field cannot be empty" ),
                        onclick : function(  )
                                {
                                    alert(0);
                                }
                    }
                ]
            }
        ],
        onOk: function() {
            var dialog = this;


            dialog.getElement('tab-basic', 'NDFSRS' ).hide();

        }
    };
});
2
What have you already tried? - BenM
$("td").click(function() { console.log("inside table"); }); - bpbhat77
I updated the question :) - bpbhat77

2 Answers

1
votes

Like this ?

if($("#ckeditor").is(":focus")){
  //do stuff here
}
0
votes
$( '#save' ).on( 'click', function () {
      var editor = CKEDITOR.instances.ficeditor,
  sel = editor.getSelection(),tbchk;
  tbchk = sel.getStartElement();
  while(tbchk!=null){
   if(tbchk!=null && tbchk.getName()=="table"){
    console.log("inside table");
   }
   tbchk=tbchk.getParent();
  }
    });