我使用CKEditor 4.4.7问题是当我打开我的模态对话框时,包含CKEditor并且我试图使用背景颜色或文本颜色按钮,如果我没有选择任何列表中的颜色并关闭它,之后我收到控制台错误:
TypeError:a.contentWindow为null TypeError: 这个。 .panel。 .iframe.getFrameDocument(...)。getById(...)为null
并且这些按钮不再起作用,每当我尝试按下它们时它们都不会再打开任何菜单,直到我不刷新页面..
这是我的模态对话框的代码。
<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>
问题是什么以及如何解决?感谢。
答案 0 :(得分: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中出现了“过多的递归”错误,但它在大多数情况下都有效。如果你有不同的问题我道歉。