Rabeel
Rabeel

Reputation: 331

CKEditor: Button is not appearing

I want to add a button in toolbar of CKEditor but button is not appearing.This is code for creation of plugin saved in _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
            });
    }
});

And this is code of config.js

CKEDITOR.editorConfig = function( config )

{

    config.toolbar = 'MyToolbar';

    config.extraPlugins = 'footnote';

    config.toolbar_MyToolbar =
      [

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

    ];

};

Just bold and italic are appearing in toolbar.But footnote button is not appearing. Thanks for your help.

Upvotes: 5

Views: 4553

Answers (2)

dom
dom

Reputation: 87

The button must have the same name (case sensitive).

Thus replace editor.ui.addButton('Footnote', by editor.ui.addButton('footnote',

Upvotes: 3

r3mark
r3mark

Reputation: 526

You are not providing an icon:

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
            });
    }
});

Be sure to create an icon at /plugins/footnote/icons/myfootnote.png.

Only PNGs are accepted.

Upvotes: 6

Related Questions