views:

245

answers:

1

I have a blur function attached to my ckeditor like so

editor = CKEDITOR.instances.fck;
editor.on("blur",function(e){
    alert("hello");
});

you with me ?

now when I click on the flash button the editor blurs and causes the alert to show.

how to I stop that from happening and still get the alert to appear other times like when the user leave the editor area

thanks again

A: 

The blur event is firing when you click on a button like flash after the up click when the dialog is presented. The blur event that you want on happens right after mouse down outside the editor. This is dirty but by tracking the mouse state you can achieve your goal.

$(function() {
    var mouseState = 0;
    $(document).mousedown(function(){ mouseState = 1; });
    $(document).mouseup(  function(){ mouseState = 0; });

    var editor = CKEDITOR.instances.editor1;
    editor.on("blur", function(e) {
        if (mouseState == 1) console.log("blur");
    });
});
Ryan Zachry