请帮助我 - 我需要完全重新初始化 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');
我的方法加载编辑器,但某些插件在重新加载后不起作用。感谢您的帮助!
最佳答案
我有插件,我也不需要完全重新初始化 CKEditor,只是实例,你做得正确吗?
要删除我的实例(我的文本区域由 ID txt_postMsg 引用):
$('#btn_cancelPost').click(function(){
CKEDITOR.remove(CKEDITOR.instances.txt_postMsg);
$('#txt_postMsg').remove();
$('#cke_txt_postMsg').remove();
});
然后我重新创建文本区域,50 毫秒超时后,我再次使用文本区域调用构造函数,插件重新加载正常。我们有一些非常复杂的 Flash/图像编辑插件,所以也许您的插件有问题?
关于ckeditor - 如何使CKEditor完全重新初始化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5663859/