Skip to content

Instantly share code, notes, and snippets.

@manhlinhng
Created April 12, 2019 09:40
Show Gist options
  • Save manhlinhng/73dcd7e64f7513348e3f300e3059d931 to your computer and use it in GitHub Desktop.
Save manhlinhng/73dcd7e64f7513348e3f300e3059d931 to your computer and use it in GitHub Desktop.
Vấn đề khi CKEditor nằm trong modal bootstrap, chúng ta bật CKFinder và không thể tương tác trên popup của CKFinder.
$.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
// add whatever conditions you need here:
&&
!$(e.target.parentNode).hasClass('cke_dialog_ui_input_select') && !$(e.target.parentNode).hasClass('cke_dialog_ui_input_text')) {
modal_this.$element.focus()
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment