Hi, I have one problem, how I can add a toolbar button (plugin) without dialog, but only with command, like this:
var s = new FCKNamedCommand("Cmd");
s.execute=function(){alert('cmd');};
FCKCommands.RegisterCommand( 'Cmd', s);
var oItem = new FCKToolbarButton( 'Cmd', FCKLang['CmdTitle'] ) ;
var s = new FCKNamedCommand("Cmd");
s.execute=function(){alert('cmd');};
FCKCommands.RegisterCommand( 'Cmd', s);
var oItem = new FCKToolbarButton( 'Cmd', FCKLang['CmdTitle'] ) ;
RE: toolbar button without dialog
You probably need to do the following things:
// create your plugin object
var FCKYourCommand = function(name)
{
this.Name = name;
}
// not sure if Name property is necessary, but doesn't hurt;)
// tell your plugin what to do
FCKYourCommand.prototype.Execute = function()
{
//your code here
}
// manage the plugins' button behavior
FCKYourCommand.prototype.GetState = function()
{
return FCK_TRISTATE_OFF;
// default behavior, sometimes you wish to have some kind of if statement here
}
// Register your command.
FCKCommands.RegisterCommand( 'YourCommand', new FCKYourCommand('YourCommand')) ;
// Create the "YourCommand" toolbar button
// below are the arguments that FCKToolbarButton constructor can take:
// commandName, label, tooltip, style, sourceView
// only first is obligatory, remember to set sourceView to true if you want the button to be active whe in source view mode
var oYourCommandItem = new FCKToolbarButton( "YourCommand") ;
oYourCommandItem.IconPath = FCKConfig.PluginsPath + 'YourCommand/yourcommand.gif' ;
FCKToolbarItems.RegisterItem( 'YourCommand', oYourCommandItem ) ;
I hope you get the idea now.
RE: toolbar button without dialog