TinyMCE 4 insert link form fields disabled

后端 未结 3 986
误落风尘
误落风尘 2021-01-27 02:42

I\'m using the tinymce-rails gem which uses TinyMCE 4 and I\'m loading the link plugin and all this is initiated after/in a colorbox popup.

TinyMCE editor i

相关标签:
3条回答
  • 2021-01-27 03:10

    Depending on the version of TinyMCE, the solution would be:

    $(document).on('focusin', function(e) {
        var target = $(e.target);
        if (target.closest(".mce-window").length || target.closest(".tox-dialog").length) {
            e.stopImmediatePropagation();
            target = null;
        }
    });
    

    And of course the answer from Sparkmasterflex

    0 讨论(0)
  • 2021-01-27 03:10

    TinyMCE5 and MagnificPopup compatibility:

    $.magnificPopup.instance._onFocusIn = function( e ) {
        try {
            if( $( e.target ).attr( 'class' ).indexOf( 'tox-' ) >= 0 ) {
                return true;
            }
        } catch( e ) {}
    
        $.magnificPopup.proto._onFocusIn.call( this, e );
    }
    
    0 讨论(0)
  • 2021-01-27 03:34

    I found the answer once I narrowed down the actual issue was that I was loading the TinyMCE into a jquery.colorbox popup. Colorbox prevents any type of focus event/action to happen outside of its defined container. Where as TinyMCE pops its stuff up through iframes, not actually in the colorbox container.

    the fix was simple: in colorbox options set trapFocus: false and all works as it should. Understand tho, this means the user can tab out of the focused colorbox to elements behind the overlay.

    via John Naegle on stackoverflow

    0 讨论(0)
提交回复
热议问题