CKEditor:按钮没有出现

时间:2012-12-06 03:28:12

标签: ckeditor

我想在CKEditor的工具栏中添加一个按钮,但按钮没有出现。这是用于创建保存在_source/plugins/footnote/

中的插件的代码
CKEDITOR.plugins.add('footnote',
{
    init: function(editor)
    {
        var pluginName = 'footnote';
        CKEDITOR.dialog.add(pluginName, this.path + 'dialogs/footnote.js');
        editor.addCommand(pluginName, new CKEDITOR.dialogCommand(pluginName));
        editor.ui.addButton('Footnote',
            {
                label: 'Footnote or Citation',
                command: pluginName
            });
    }
});

这是config.js的代码

CKEDITOR.editorConfig = function( config )

{

    config.toolbar = 'MyToolbar';

    config.extraPlugins = 'footnote';

    config.toolbar_MyToolbar =
      [

    ['Bold','Footnote','Italic']

    ];

};

粗体和斜体显示在工具栏中。但是没有出现脚注按钮。 谢谢你的帮助。

2 个答案:

答案 0 :(得分:6)

您没有提供图标:

CKEDITOR.plugins.add('footnote', 
{
    icons: 'myfootnote',
    init: function (editor) {
        var pluginName = 'footnote';
        CKEDITOR.dialog.add(pluginName, this.path + 'dialogs/footnote.js');
        editor.addCommand(pluginName, new CKEDITOR.dialogCommand(pluginName));
        editor.ui.addButton('Footnote',
            {
                label: 'Footnote or Citation',
                icon: 'myfootnote',
                command: pluginName
            });
    }
});

请务必在/plugins/footnote/icons/myfootnote.png创建一个图标。

只接受PNG。

答案 1 :(得分:2)

该按钮必须具有相同的名称(区分大小写)。

因此,editor.ui.addButton('Footnote',

取代editor.ui.addButton('footnote',