我正在尝试创建一个包含 CKEditor 实例的 Bootstrap 模式,但是有很多问题......
所以基本上这些字段没有启用,它们看起来不像,但我无法与它们交互。有人对这种奇怪的行为有解决方案吗?
最佳答案
FWIW,我无法获得 Peter's solution可以工作,但是以下内容对我有用,并且仍然将 hack 保存在单独的文件中,因此您不必编辑任何 Bootstrap 源文件:
// bootstrap-ckeditor-modal-fix.js
// hack to fix ckeditor/bootstrap compatiability bug when ckeditor appears in a bootstrap modal dialog
//
// Include this AFTER both bootstrap and ckeditor are loaded.
$.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()
}
})
};
关于twitter-bootstrap - 带有 CKEditor 的 Bootstrap 等于问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14420300/