diff --git a/layouts/v7/resources/application.js b/layouts/v7/resources/application.js index 48308b7eb7cc46e5067a9937088bcd40c910a8ba..a62ae88e2a097596d27c0c9a2254aa5dc95baf59 100644 --- a/layouts/v7/resources/application.js +++ b/layouts/v7/resources/application.js @@ -503,4 +503,16 @@ jQuery(function () { var value = this.valueOf(); return value.charAt(0).toUpperCase()+value.slice(1).toLowerCase() } -}); \ No newline at end of file + /* To push focus on CKEditor Popup when shown with Bootstrap modal */ + /* ref https://stackoverflow.com/a/23667151 */ + jQuery.fn.modal.Constructor.prototype.enforceFocus = function() { + modal_this = this + jQuery(document).on('focusin.modal', function (e) { + if (modal_this.$element[0] !== e.target && !modal_this.$element.has(e.target).length + && !jQuery(e.target.parentNode).hasClass('cke_dialog_ui_input_select') + && !jQuery(e.target.parentNode).hasClass('cke_dialog_ui_input_textarea') + && !jQuery(e.target.parentNode).hasClass('cke_dialog_ui_input_text')) { + modal_this.$element.focus() + } + })}; +});