IE11 CKEDITOR Solutions in Bootstrap Modal in Bootstrap Modal

Recently included in the Bootstrap Modal pop-up box in the project, CKEDITOR.

After initialization CKEDITOR, in IE11, the format / font / color pull-down will disappear, but there is no problem under Chrome and Firefox.

The main reason is that IE11, click CKEDITOR to trigger the focusin.modal event, the IF condition of the original Modal EnforceFocus function is established, bootstrap modal gets the focus, and CKEDITOR pulls off the focus, so pull the flash.

Google has found a solution

, after the judgment is added, it can avoid modal getting the focus, but it seems that Modal will not Trigger.

I made a modification, the following code added to the original Modal Enforcefocus function, added! $ (E.target.parentnode) .closest (“. Cke”). Length judgment condition, that is, in the original Judgment Condition + None Click on CKEDITOR, then Modal gets the focus.

The order of execution of the code is jQuery, bootstrap, execute this code.

$. Fn.modal.constructor.prototype.enforcefocus = function () {$ (document) .off (‘focusin.bs.modal’) .on (‘ Focusin.bs.modal ‘, $ .Proxy (Function (e) {if (Document! == E.TARGET && THIS. $ Element [0]! == E. Target &&! This. $ Element.has (e. Target) .length&&! $ (“…………………………………………… ..
did not find problems in the project.
  A comparison  

MODAL.PROTOTYPE.EnforceFocus = function () {$ (Document) .off (‘Focusin. Bs.Modal ‘) // Guard Against Infinite Focus loop .on (‘ Focusin.bs.Modal ‘, $ .Proxy (Function (E) {IF (Document! == E.TARGET && THIS. $ Element [0]! == E. Target &&! this. $ element.has (e.target) .length) {this. $ Element.trigger (‘focus’)}}, this))}

This. $ ELEMENT represents the Modal object.
 The above is all the content of this article, I hope to help everyone, I hope everyone will support Tumi Cloud.                      
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment