How to use CKEditor in a Bootstrap Modal?

后端 未结 14 1338
名媛妹妹
名媛妹妹 2020-11-30 04:14

If I use the CKEditor plugin in an HTML page based on a Bootstrap template, it works great, however if I insert the editor on a Bootstrap Modal like this

<         


        
14条回答
  •  迷失自我
    2020-11-30 04:33

    For Bootstrap 4, this line will no longer work. They will need to figure out that it changed to:

    $.fn.modal.Constructor.prototype._enforceFocus = function() {};
    

    Instead of

    $.fn.modal.Constructor.prototype.enforceFocus = function() {};
    

    So, Code should be like this:

    $.fn.modal.Constructor.prototype._enforceFocus  = function() {
            modal_this = this
            $(document).on('focusin.modal', function (e) {
              if (modal_this.$element[0] !== e.target && !modal_this.$element.has(e.target).length 
              && !$(e.target.parentNode).hasClass('cke_dialog_ui_input_select') 
              && !$(e.target.parentNode).hasClass('cke_dialog_ui_input_text')) {
                modal_this.$element.focus()
              }
            })
          };
    

提交回复
热议问题