简体   繁体   中英

TinyMCE - window.blur function firing on editor focus

I have a window.blur function as follows

$(window).blur(function(){  
    _doing_something_wrong.resume();
    $('#_put_an_eye_on_users_activity_modal').modal({show : true, keyboard: false,backdrop: 'static'});
}); 

and TinyMCE init as follows

 tinymce.init({
    selector:'._editor_statement_question',
    setup: function (_editor) {
        _editor.on("focus", function () {
            $(this.contentAreaContainer.parentElement).find("div.mce-toolbar-grp").show();
        });
    }
 });

but whenever I am trying to type some content in editor ( _editor.on('focus',function(){} ) the window.blur function is firing, I mean the modal is showing up, How can I avoid this only for editor focus,

I tried unbinding the blur function, but need a simple and clean solution, some hints please

TinyMCE vesrion - 4.x

thanks

I figured it out, Its because of the TinyMCE Iframe , So I managed my blur function as follows

$(window).blur(function(){
    if($('iframe').is(':focus')) {
        //do nothing
    } 
    else {
        _doing_something_wrong.resume();
        $('#_put_an_eye_on_users_activity_modal').modal({show : true, keyboard: false,backdrop: 'static'});
    }
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM