PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : FCK Editor - Buttons anpassen



berny
20.02.2013, 14:09
Ich habe für den Editor (egal ob fck oder ck) ein Plugin erstellt.

Dabei füge ich über einen Klick am Button einen html Code ein
Dieser wird vor und nach dem ausgewählten Text eingefügt.

Jetzt möchte ich, dass beim ersten Klick dieser Text eingefügt wird, beim zweiten Klick dieser wieder entfernt wird.

gleichzeitig sollte sich der Button ändern.


/***
* Create blank command
*/
var FCKtemplateinsert = function()
{

}

/***
* Add Execute prototype
*/
FCKtemplateinsert.prototype.Execute = function()
{
// get whatever is selected in the FCKeditor window

var insertxx = 1;

var selection = FCK.EditorDocument.getSelection();
if ( selection == "")
{
selection = "Newsletter Inhalt";
}

// if there is a selection, add tags around it

FCK.InsertHtml('<div> irgend ein htmlcode ' + selection + 'der andere html code </div>);

}

/***
* Add GetState prototype
* - This is one of the lines I can't explain
*/
FCKtemplateinsert.prototype.GetState = function()
{
return;
}

// register the command so it can be use by a button later
FCKCommands.RegisterCommand( 'templateinsert' , new FCKtemplateinsert() ) ;

/***
* Create the toolbar button.
*/

// create a button with the label "Netnoi" that calls the netnoi_command
var oPixelCaps = new FCKToolbarButton( 'templateinsert', 'Newsletter Template erstellen', null, null, true, true, 1) ;
oPixelCaps.IconPath = FCKConfig.PluginsPath + 'templateinsert/templateinsert.gif' ;


// register the item so it can added to a toolbar
FCKToolbarItems.RegisterItem( 'templateinsert', oPixelCaps ) ;

Wer kann weiterhelfen?