0

我正在使用 CKEditor 4.4.7 问题是当我打开包含 CKEditor 的模态对话框并且我尝试使用背景颜色或文本颜色按钮时,如果我没有从列表中选择任何颜色并关闭它,之后我收到控制台错误:

类型错误:a.contentWindow 为空类型错误:此。。控制板。.iframe.getFrameDocument(...).getById(...) 为空

并且这些按钮不再起作用,每当我尝试按下它们时,它们都不会再次打开任何菜单,直到我不会刷新页面..

这是我的模态对话框的代码。

<form action='' method='post'>
    <textarea id='editor1' name='editor1'></textarea>
    <script type="text/javascript">
        CKEDITOR.replace('editor1');
    </script>
    <input type="submit" name="submitComment" value="Submit" />
</form>

有什么问题以及如何解决?谢谢。

4

1 回答 1

0

这听起来类似于此处描述的问题: https ://forum.jquery.com/topic/can-t-edit-fields-of-ckeditor-in-jquery-ui-modal-dialog#14737000005423723 和此处: http:// /bugs.jqueryui.com/ticket/9087#comment:30(此处描述的解决方案似乎不再起作用)。

我的解决方案如下:

orig_allowInteraction = $.ui.dialog.prototype._allowInteraction;
$.ui.dialog.prototype._allowInteraction = function(event){
    // address interaction issues with general iframes with the dialog
    if (event.target.ownerDocument != this.document[0]){
        return true;
    }
    // address interaction issues with dialog window
    if ($(event.target).closest(".cke_dialog").length){
        return true;
    }
    // address interaction issues with iframe based drop downs in IE
    if ($(event.target).closest(".cke").length){
        return true;
    }
    return orig_allowInteraction.apply(this, arguments);
};

这个解决方案并不完美,因为我在 Firefox 中遇到了“太多递归”错误,但它在大多数情况下都有效。如果您遇到其他问题,我深表歉意。

于 2015-03-25T17:26:27.323 回答