I was trying to add my own toolbar button in CKEditor (inside vBulletin). Following is my Code:
CKEDITOR.plugins.add( 'app',
{
init: function( editor )
{
editor.addCommand( 'AppWidget',
{
modes : { source : 1, wysiwyg : 1 },
exec : function( editor )
{
alert("foo");
}
});
editor.ui.addButton( 'app',
{
label: 'App Widget',
command: 'AppWidget',
icon: this.path + 'app.png'
} );
}
} );
Problem is: It will show in WYSIWYG mode, but will be disabled (greyed out) in source mode. But I need this button to be enabled in source mode. If I write:
modes : { source : 1 },
it will be disabled in both modes.
Any hints on this here? Thanks in advance.
Problem is solved. I noticed the editor mode should be: