在CKEditor 3.6中添加外部插件

时间:2012-12-04 03:20:12

标签: plugins ckeditor

我正在尝试在ckeditor中添加一个外部插件,但它看起来我没有正确注册我的插件而且它没有显示。

1.-我尝试将其直接添加到CKEditor配置文件中,但它不起作用。

CKEDITOR.editorConfig = function(config) {
config.toolbar = [
['Bold'],['Italic'],['myplugin']
]
};

2.-尝试在启动CKEditor时将其添加到html文件中,但也无效。

var editor = CKEDITOR.replace( 'editor1',
{

removePlugins : 'forms,table,tabletools',
extraPlugins : 'msugetprop,msuforms,msutable,msutabletools,msumobile',

toolbar : 
    [
        ['Cut','Copy','PasteText','Preview'],
        ['Undo','Redo','-','SelectAll'],
    ['MsuForm','MsuGetProp','MsuCheckbox', 'MsuRadio', 'MsuTextField',         'MsuTextarea', 'MsuSelect', 'MsuButton', 'MsuTable', 'MsuHiddenField'],
    '/',
    ['Styles','-','NumberedList','BulletedList','-','CreateDiv'],
                                                                                       ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    ['Link','Unlink','Anchor'],
    ['Source','-','About'],
    ['myplugin'],
    ]
});

3.-我的插件位于/ ckeditor / plugins / myplugin下,文件名为plugin.js

(function() {
var o = { exec: function(p) {
url = baseUrl + "/GetSomeData";
$.post(url, function(response) {
alert(response)
});
}
};
CKEDITOR.plugins.add('myplugin', {
init: function(editor) {
editor.addCommand('myplugin', o);
editor.ui.addButton('myplugin', {
label: 'myplugin',
icon: this.path + 'myplugin.png',
command: 'myplugin'
});
}
});
})();

我错过了什么?

1 个答案:

答案 0 :(得分:1)

解决。

忘了在extraPlugins下添加'myplugin'。