CKEditor 的多个实例(在 Safari 中)
我在 JQuery UI 对话框中创建 CKEditor 的多个实例时遇到问题。该对话框通过 AJAX 加载远程表单,因此目标是能够关闭并重新打开该对话框并拥有编辑器的新实例。使用默认选项,重新打开对话框时会出现错误,指出具有该名称的编辑器已存在。所以我尝试了几种销毁编辑器实例的方法,它们都会导致同样的问题。重新加载编辑器时,文本区域显示为 null,并且按钮不起作用。
目前我正在使用这种销毁实例的方法:
var instance = CKEDITOR.instances['test'];
if (instance) { CKEDITOR.remove(CKEDITOR.instances['test']); }
我通过几个可供下载的简单 html 文件重新创建了该问题 在这里。
编辑:我刚刚尝试使用两个具有不同名称的文本区域的远程文件,并且遇到了同样的问题。当一个对话框打开然后关闭时,另一个对话框在打开时具有“空”CKEditor。
另外,显然这只是 Safari 中的问题。
I'm having a problem creating multiple instances of a CKEditor in a JQuery UI dialog. The dialog loads a remote form via AJAX, so the goal is to be able to close and reopen the dialog and have a new instance of the editor. With the default options, when reopening the dialog it gives an error saying that an editor with that name already exists. So I have tried several methods of destroying the editor instance and they all result in the same problem. When the editor is reloaded, the text area says null and the buttons don't function.
Currently I'm using this method of destroying the instance:
var instance = CKEDITOR.instances['test'];
if (instance) { CKEDITOR.remove(CKEDITOR.instances['test']); }
I recreated the issue with a couple of simple html files available for download here.
EDIT: I just tried using two remote files with a text area that has a different name and I have the same problem. When one dialog is opened and then closed, the other dialog has a "null" CKEditor when it is opened.
Also, apparently this is only a problem in Safari.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这就是我所做的:
然后在ajax成功之后
和表单提交之前(例如使用ajax):
您需要jQuery才能使其正常工作。这是针对 zend_forms 的,但经过几次更正后也应该可以在正常形式下工作。使用 'dst' 来做到这一点。
this is what i've done:
then after ajax succes im doing
and before form submitting (for example using ajax):
you need jQuery to have that working. this is for zend_forms, but after few corrections should work in normal forms too. play with 'dst' to do that.
这是一个老话题了,但我也遇到了类似的问题。
我使用了上面 activ 的解决方案,效果很好!
CKEDITOR.appendTo
对我来说不起作用,但是通过对loadEditors
函数的下一个轻微修改,它做到了:Bit of an old topic, but i had a similar problem.
I used activ's solution above, which worked out great!
CKEDITOR.appendTo
did't work out for me, but with the next slight modification to theloadEditors
function it did:我做什么:
what I do: