Hi,
I recently came across the following code which I have adjusted to meet my needs, but I am not sure whether the code is correct and also how to install it?
I have read the documentation about installing and adding buttons but I do not quiet understand the button bit. Because it mentions something about adding a myconfig.js does that mean I will no longer be able to see the buttons contained in the fckconfig.js file?
I am quiet confused attached is my plugin code;
Some help would be greatly appreciated.....
I recently came across the following code which I have adjusted to meet my needs, but I am not sure whether the code is correct and also how to install it?
I have read the documentation about installing and adding buttons but I do not quiet understand the button bit. Because it mentions something about adding a myconfig.js does that mean I will no longer be able to see the buttons contained in the fckconfig.js file?
I am quiet confused attached is my plugin code;
/***
* Create blank command
*/
var FCKPixelCaps_command = function()
{
}
/***
* Add Execute prototype
*/
FCKPixelCaps_command.prototype.Execute = function()
{
// get whatever is selected in the FCKeditor window
var selection = FCK.EditorDocument.getSelection();
// if there is a selection, add tags around it
if(selection.length > 0)
{
FCK.InsertHtml('<span class="nolink">' + selection + '</span>');
} else {
// for debugging reasons, I added this alert so I see if nothing is selected
alert('nothing selected');
}
}
/***
* Add GetState prototype
* - This is one of the lines I can't explain
*/
FCKPixelCaps_command.prototype.GetState = function()
{
return;
}
// register the command so it can be use by a button later
FCKCommands.RegisterCommand( 'PixelCaps_command' , new FCKPixelCaps_command() ) ;
/***
* Create the toolbar button.
*/
// create a button with the label "nolink" that calls the nolink_command
var oPixelCaps = new FCKToolbarButton( 'PixelCaps_command', 'Pixels & Pulp Caps' ) ;
nolink.IconPath = FCKConfig.PluginsPath + 'nolink/nolink.jpeg' ;
// register the item so it can added to a toolbar
FCKToolbarItems.RegisterItem( 'PixelCaps', oPixelCaps ) ;Some help would be greatly appreciated.....
