如何使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\');
我的方法加载了编辑器,但某些插件在重新加载后不起作用。谢谢你的帮助!     
已邀请:
我有插件,也不需要完全重新初始化CKEditor,只是实例,您是否做得正确? 要删除我的实例(我的文本区域由ID txt_postMsg引用):
$(\'#btn_cancelPost\').click(function(){
    CKEDITOR.remove(CKEDITOR.instances.txt_postMsg);
    $(\'#txt_postMsg\').remove();
    $(\'#cke_txt_postMsg\').remove();
});
然后,我重新创建textarea,在50ms超时后,我再次使用textarea调用构造函数,插件重新加载正常。我们有一些非常复杂的Flash /图像编辑插件,所以您的插件可能存在问题?     
我的版本:
$$(\"textarea._cke\").each(function(Z) { 
    if (typeof(CKEDITOR.instances[Z.id]) == \'undefined\') { 
        CKEDITOR.replace(Z.id, { customConfig : \"yourconfig.js\"});
    } else {
        CKEDITOR.instances[Z.id].destroy(true);
        CKEDITOR.replace(Z.id, { customConfig : \"yourconfig.js\"});
    } 
});
    
尝试像
for(var instanceName in CKEDITOR.instances)
    CKEDITOR.remove(CKEDITOR.instances[instanceName]);        
CKEDITOR.replaceAll();
    
阿方索 我使用CKeditor动态编辑网站的不同部分。当我单击站点的某个区域时,它会显示带有CKeditor的弹出窗口,其中该区域的内容高于该区域。保存时,我销毁了该编辑器的实例,但是如果在编辑时使用链接插件CKeditor,则在不刷新页面的情况下无法显示编辑器。 Chrome说-未捕获的TypeError:无法调用未定义的方法\'split \',Mozilla-x.config.skin未定义(我尝试设置config.skin并显示另一个错误-z未定义)。 我希望完全重新启动可以提供帮助。 附言抱歉,我可以找到如何回答您的评论...     
我一直在寻找重新初始化编辑器的方法,而最终得到的唯一解决方案是删除实例并创建一个新ID。 这是我的代码。
var editor = \'myeditor\'
var instance = CKEDITOR.instances[editor];

if(typeof instance != \'undefined\')
{
    instance.destroy();
    $(\".cke_editor_\" + editor).remove();

    //make a new id
    editor = (Math.random().toString(36).substr(2, 10););
}

CKEDITOR.replace(editor, 
{
}
它并不完美,但可以。 希望这可以帮助。     

要回复问题请先登录注册