Hi,
Is it possible to call a simple external javascript function when clicking a button in FCKEditor. I know it sounds a bit ridiculous to want to do that but I need to call a function supplied by the html page containing an instance of FCKEditor. I created a plungin to add a new button in FCKEditor but I'm stuck at the FCKCommands.RegisterCommand call because every example I have is using FCKDialogCommand as the command.
What I was hoping I could do was
FCKCommands.RegisterCommand('My command name', new FCKMyCustomCommand()) ;
and then add to fck_othercommands.js something like:
FCKMyCustomCommand = function()
{
this.name = 'My command name';
}
FCKMyCustomCommand.prototype.Execute = function()
{
MyjavascriptFunctionCall();
}
FCKMyCustomCommand.prototype.GetState = function()
{
return FCK.GetNamedCommandValue('My command name');
}
Unfortunately, this is not enough for my new command to be recongizes in FCKEditor. I then thought about using FCKNamedCommand because I thought I could get it to call a function having the name of the command but I was wrong again.
So, to make things simple, is it possible to call a javascript function supplied by the containing page from a FCKEditor button?
Thanks.
Is it possible to call a simple external javascript function when clicking a button in FCKEditor. I know it sounds a bit ridiculous to want to do that but I need to call a function supplied by the html page containing an instance of FCKEditor. I created a plungin to add a new button in FCKEditor but I'm stuck at the FCKCommands.RegisterCommand call because every example I have is using FCKDialogCommand as the command.
What I was hoping I could do was
FCKCommands.RegisterCommand('My command name', new FCKMyCustomCommand()) ;
and then add to fck_othercommands.js something like:
FCKMyCustomCommand = function()
{
this.name = 'My command name';
}
FCKMyCustomCommand.prototype.Execute = function()
{
MyjavascriptFunctionCall();
}
FCKMyCustomCommand.prototype.GetState = function()
{
return FCK.GetNamedCommandValue('My command name');
}
Unfortunately, this is not enough for my new command to be recongizes in FCKEditor. I then thought about using FCKNamedCommand because I thought I could get it to call a function having the name of the command but I was wrong again.
So, to make things simple, is it possible to call a javascript function supplied by the containing page from a FCKEditor button?
Thanks.
Re: Call external javascript from FCKEditor
Ok, thanks to Julien Marchal, I finally can do it. For those interested, here's the link for his own plugin code:
http://doc-cri.univ-nancy2.fr/public/?contentId=3086