用CKEditor进行引导等于问题 [英] Bootstrap with CKEditor equals problems

查看:47
本文介绍了用CKEditor进行引导等于问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个包含CKEditor实例的Bootstrap模态,但是存在很多问题...

I'm trying to create a Bootstrap modal which contains an instance of CKEditor, but there are a lot of problems...

因此,基本上所有字段都保留了未启用,它们看起来不像,但我无法与他们互动。有人能解决这种奇怪的行为吗?

So basically the fields are left unenabled, they don't look like, but I can't interact with them. Does anybody have a solution to this strange behavior?

推荐答案

FWIW,我无法获得Peter的解决方案可以正常工作,但以下内容对我有用,并且仍然将hack保留在单独的文件中,因此您无需编辑任何Bootstrap源文件:

FWIW, I couldn't get Peter's solution to work, but the following worked for me, and still keeps the hack in a separate file so you don't have to edit any Bootstrap source files:

// 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()
    }
  })
};

这篇关于用CKEditor进行引导等于问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆