我已经包含了一个插件here ,使用 CKEditor 在我的网站上包含代码片段。由此,我发现人们对 CKEditor 对话框和 Bootstrap 的模态窗口存在问题。任何打开的对话框都不会聚焦,并且无法输入文本。
找到解决方案here 。这解决了我与其他对话框的问题,但不是使用此预标记插件打开的对话框。有人对让代码片段在 CKEditor 和 Bootstrap 中正常工作有什么建议吗?
$.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()
}
})
};
最佳答案
解决方案是添加条件
&& !$(e.target.parentNode).hasClass('cke_dialog_ui_input_textarea')
现在可以了!希望这对遇到同样问题的人有所帮助。
关于javascript - Bootstrap 模式窗口顶部的 CKEditor 对话框存在问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26600904/