Hello
How can i quickly add a new button to the toolbar, without extending the original (compressed) javascript files. It seems that currently we have to modify different files to add a command. A small sample is appreciated.
Thanks
Marco
How can i quickly add a new button to the toolbar, without extending the original (compressed) javascript files. It seems that currently we have to modify different files to add a command. A small sample is appreciated.
Thanks
Marco
RE: add a new button with own popup window
You could post an example of the code of js class with toString() method?
Thanks.
RE: add a new button with own popup window
check it:
http://sourceforge.net/tracker/index.php?
func=detail&aid=1051555&group_id=75348&atid=543655
hernux
RE: add a new button with own popup window
well, I'm currently adding Flash Dialog to it... its not so dificcult, everything is on its place...
1- first of all, you need to create a new command in _source/internals/fckcommands.js:
FCKCommands[name] = new FCKDialogCommand( name, title, url, width, height, getStateFunction, getStateParam );
this is my flash command:
FCKCommands['Flash'] = new FCKDialogCommand( 'Flash', 'Movie Properties', 'dialog/fck_flash.html', 500, 450, FCK.GetNamedCommandState, 'InsertFlash' ) ;
2- Now, create the toolbar icon definition in _source/internals/fcktoolbar.js:
FCKToolbarItems[name] = new FCKToolbarButton(commandName, label, tooltip, style, sourceView) ;
...and mine is:
FCKToolbarItems['Flash'] = new FCKToolbarButton( 'Flash', 'Flash', 'Insert/Edit Flash Movie' ) ;
your icon should be named toolbar/button.[command_name].gif in lower case.
3- if you want to add context menu to your actions... edit _source/internals/fckcontextmenu.js and add this:
a- menu definition
this.Groups[name] = new FCKContextMenuGroup() ;
with ( this.Groups[name] )
{
// agrego un separador..
Add( new FCKContextMenuSeparator() ) ;
// agrego un item al menu
Add( new FCKContextMenuItemfunction(contextMenu, commandName, label, hasIcon)) ;
}
mine..
// Flash operations.
this.Groups['Flash'] = new FCKContextMenuGroup() ;
with ( this.Groups['Flash'] )
{
Add( new FCKContextMenuSeparator() ) ;
Add( new FCKContextMenuItem( this, 'Flash', FCKLang["FlashProperties"], true ) ) ;
}
b- asociation
this.Groups[name].SetVisible( sTagName == tag ) ;
mine...
this.Groups['Flash'].SetVisible( sTagName == 'OBJECT' || sTagName == 'EMBED' ) ;
4- Compile js source using this script http://sourceforge.net/forum/message.php?msg_id=2754799
5- Now, you only need to create your dialog.. create a file named like you did on FCKCommands[name]::url...
this is it...
RE: add a new button with own popup window
I followed all the steps of this topic to create the function to insert flash, but I am having difficulties to create the dialogue box and .js file. I am not obtaining to insert <object>, <param>, <embed> tags and its parameters in the editor. Please help me!
Thanks.
RE: add a new button with own popup window
I've created a js class to make this run.. my class got object parameters and a toString() method that returns HTML code for the object tag... and insert it into the editor as html..
hernux
RE: add a new button with own popup window
RE: add a new button with own popup window
/**
* Add an additional Context Menu for the "Variable" plugin
* Overwrite the internal function that returns the Context Menu items
*/
FCKContextMenu.__GetGroup = FCKContextMenu._GetGroup;
FCKContextMenu._GetGroup = function( groupName )
{
var oGroup ;
switch ( groupName )
{
case 'Variable' :
oGroup = new FCKContextMenuGroup() ;
oGroup.Add( new FCKContextMenuItem( this, 'Variable', FCKLang.VariableProp, true ) );
/**
* Overwrite the internal function that tells the visibility of items
* in a Context Menu
*/
oGroup.__RefreshState = oGroup.RefreshState;
oGroup.RefreshState = function()
{
// Get the actual selected tag (if any).
var oTag = FCKSelection.GetSelectedElement() ;
var sTagName ;
if ( oTag )
sTagName = oTag.tagName ;
// Set items visibility.
this.SetVisible( sTagName == 'INPUT' && ( oTag.type == 'text' ) ) ;
/**
* Calls the original function
*/
this.__RefreshState();
}
break ;
default:
/**
* Calls the original function
*/
oGroup = this.__GetGroup(groupName);
}
return oGroup;
}