Line 5: | Line 5: | ||
* '''fckpkugin.js''' file<pre> | * '''fckpkugin.js''' file<pre> | ||
− | ///fckplugin.js | + | ///fckplugin.js /* |
− | /* | + | |
− | * your plugin must be put in the 'editor/plugins/#plug-in name#' (the name is specified in fckconfig.js - | + | * your plugin must be put in the 'editor/plugins/#plug-in name#' (the name is specified in fckconfig.js -> addPlugin, see below) |
* in my case this is 'editor/plugins/insertvariables/' | * in my case this is 'editor/plugins/insertvariables/' | ||
* | * | ||
Line 13: | Line 13: | ||
* @author: Tim Struyf, Roots Software (http://www.roots.be), tim.struyf@roots.be | * @author: Tim Struyf, Roots Software (http://www.roots.be), tim.struyf@roots.be | ||
*/ | */ | ||
+ | |||
var InsertVariableCommand=function(){ | var InsertVariableCommand=function(){ | ||
− | + | ||
− | }; | + | //create our own command, we dont want to use the FCKDialogCommand because it uses the default fck layout and not our own |
− | InsertVariableCommand.prototype.Execute=function(){ | + | |
− | } | + | }; InsertVariableCommand.prototype.Execute=function(){ } InsertVariableCommand.GetState=function() { |
− | InsertVariableCommand.GetState=function() { | + | |
− | + | return FCK_TRISTATE_OFF; //we dont want the button to be toggled | |
− | } | + | |
− | InsertVariableCommand.Execute=function() { | + | } InsertVariableCommand.Execute=function() { |
− | + | ||
− | + | //open a popup window when the button is clicked | |
− | } | + | window.open('insertVariable.do', 'insertVariable', 'width=500,height=400,scrollbars=no,scrolling=no,location=no,toolbar=no'); |
− | FCKCommands.RegisterCommand('Insert_Variables', InsertVariableCommand ); //otherwise our command will not be found | + | |
− | var oInsertVariables = new FCKToolbarButton('Insert_Variables', 'insert variable'); | + | } FCKCommands.RegisterCommand('Insert_Variables', InsertVariableCommand ); //otherwise our command will not be found var oInsertVariables = new FCKToolbarButton('Insert_Variables', 'insert variable'); oInsertVariables.IconPath = FCKConfig.PluginsPath + 'insertvariables/variable.gif'; //specifies the image used in the toolbar FCKToolbarItems.RegisterItem( 'Insert_Variables', oInsertVariables ); |
− | oInsertVariables.IconPath = FCKConfig.PluginsPath + 'insertvariables/variable.gif'; //specifies the image used in the toolbar | ||
− | FCKToolbarItems.RegisterItem( 'Insert_Variables', oInsertVariables ); | ||
− |
Revision as of 15:17, 17 January 2008
Example on how to access the editor from a popup window
This example shows how to insert text in the FCKeditor:
- fckpkugin.js file
///fckplugin.js /*
* your plugin must be put in the 'editor/plugins/#plug-in name#' (the name is specified in fckconfig.js -> addPlugin, see below) * in my case this is 'editor/plugins/insertvariables/' * * insert variable editor * @author: Tim Struyf, Roots Software (http://www.roots.be), tim.struyf@roots.be */
var InsertVariableCommand=function(){
//create our own command, we dont want to use the FCKDialogCommand because it uses the default fck layout and not our own
}; InsertVariableCommand.prototype.Execute=function(){ } InsertVariableCommand.GetState=function() {
return FCK_TRISTATE_OFF; //we dont want the button to be toggled
} InsertVariableCommand.Execute=function() {
//open a popup window when the button is clicked window.open('insertVariable.do', 'insertVariable', 'width=500,height=400,scrollbars=no,scrolling=no,location=no,toolbar=no');} FCKCommands.RegisterCommand('Insert_Variables', InsertVariableCommand ); //otherwise our command will not be found var oInsertVariables = new FCKToolbarButton('Insert_Variables', 'insert variable'); oInsertVariables.IconPath = FCKConfig.PluginsPath + 'insertvariables/variable.gif'; //specifies the image used in the toolbar FCKToolbarItems.RegisterItem( 'Insert_Variables', oInsertVariables );