CKEditor自动增长功能问题

时间:2012-08-01 13:47:28

标签: jquery ajax model-view-controller ckeditor

我遇到了CKEditor自动增长功能的问题,我在使用MVC和ajax帖子返回部分视图的页面中使用它,当我触发某些$ ajax帖子时(特别是那些在没有重新加载页面的情况下返回部分的帖子)我我收到以下错误:未捕获[CKEDITOR.resourceManager.add]资源名称“autogrow”已经注册。

我想知道是否有一种方法可以“取消注册”自动增长功能,并在该过程完成后重新注册。或者,除了location.reload(true)之外,还有一种方法可以避免这种情况。

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

您应该在“ plugins”文件夹中为“ ckeditor”创建一个名称为您的按钮的文件夹,并在该文件夹中创建文件“ plugin.js”,然后您可以为新按钮添加代码。例如 :  -ckeditor / plugins / timestamp / plugin.js

那是我的代码:

CKEDITOR.plugins.add( 'timestamp', {
init: function( editor ) {
    editor.addCommand( 'insertTimestamp', {
        exec: function( editor ) {
    editor.insertHtml( 'text' );
        }
    });
    editor.ui.addButton( 'Timestamp', {
        label: 'Insert Timestamp',
        command: 'insertTimestamp',
        toolbar: 'insert.0'
    });
}

});