如何使CKEditor完全重新初始化?
请帮助我 - 我需要完全重新初始化 CKeditor。我不想重新初始化 CKeditor 实例,但我想完全重新加载它。有没有办法实现呢? 我尝试制作下一步:
delete window.CKEDITOR;
然后:
//clear for old sources
$('script[src*="/includes/contentEditor/ckeditor/"]').each(function() {
$(this).remove();
});
$('link[href*="/includes/contentEditor/ckeditor/"]').each(function() {
$(this).remove();
});
//load CKeditor again
contentEditor.loadjscssfile('/includes/contentEditor/ckeditor/ckeditor.js', 'js');
contentEditor.loadjscssfile('/includes/contentEditor/ckeditor/adapters/jquery.js', 'js');
我的方法加载编辑器,但某些插件在重新加载后不起作用。感谢您的帮助!
Please help me - I need to make full re-initialization of CKeditor. I don't want to make re-initialization of instances of CKeditor, but I want fully reload it. Is there any way to implement it?
I tried to made next:
delete window.CKEDITOR;
and then:
//clear for old sources
$('script[src*="/includes/contentEditor/ckeditor/"]').each(function() {
$(this).remove();
});
$('link[href*="/includes/contentEditor/ckeditor/"]').each(function() {
$(this).remove();
});
//load CKeditor again
contentEditor.loadjscssfile('/includes/contentEditor/ckeditor/ckeditor.js', 'js');
contentEditor.loadjscssfile('/includes/contentEditor/ckeditor/adapters/jquery.js', 'js');
My method loads editor but some plugins does not work after reloading. Thanks for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我有插件,我也不需要完全重新初始化 CKEditor,只是实例,你做得正确吗?
要删除我的实例(我的文本区域由 ID txt_postMsg 引用):
然后我重新创建文本区域,并在 50 毫秒超时后再次使用文本区域调用构造函数,插件重新加载正常。我们有一些非常复杂的 Flash/图像编辑插件,所以也许您的插件有问题?
I have plugins and I don't need to fully reinitialize CKEditor either, just instances, are you doing it properly?
To remove my instance (my textarea is referenced by ID txt_postMsg):
Then I re-create the textarea, and after a 50ms timeout I call the constructor with the textarea again, plugins reload fine. We have some pretty complex plugins for flash/image editing so maybe there's an issue with your plugin?
我的版本:
My version:
尝试类似的东西
try something like
阿方索ML
我使用 CKeditor 动态编辑网站的不同部分。当我单击网站的某些区域时,它会显示带有 CKeditor 的弹出窗口,该区域的内容位于该区域上方。当我保存它时,我会销毁该编辑器的实例,但是如果在编辑时使用链接插件 CKeditor 则无法在不刷新页面的情况下显示编辑器。 Chrome 说 - 未捕获类型错误:无法调用未定义的方法“分割”,Mozilla - x.config.skin 未定义(我尝试设置 config.skin,它显示另一个错误 - z 未定义)。
我希望完整的重新初始化能有所帮助。
PS 抱歉,我可以找到如何回答您的评论......
AlfonsoML
I use CKeditor for dynamically edit different part of site. When I click on some area of the site it shows popup with CKeditor with content of this area above this area. When I save it I destroy instance of this editor, but if while editing I use link plugin CKeditor can't show editor without page refreshing. Chrome says - Uncaught TypeError: Cannot call method 'split' of undefined, Mozilla - x.config.skin is undefined(I try to set config.skin and it show another error - z is undefined).
I hope the full re-init can help.
P.S. Sorry I can find how to answer on your comment...
我一直在寻找一种重新初始化编辑器的方法,最终得到的唯一解决方案是删除实例并创建一个新 ID。
这是我的代码。
它并不完美,但它有效。
希望这有帮助。
I've been looking for a way to re-initialize the editor and the only solution that I end up is to delete the instance and create a new ID.
Here's my code.
It's not perfect but it works.
Hope this helps.
这是我的解决方案:
或者
This is my solution:
OR