Zoom plugin.
Plugin that allows to enter a magnification between min_value and max_value percent to enlarge or reduce the display of the active document.
It has been developed starting by combo plugin submitted by Marcus.
=============================================
Changes to your custom fckconfig.js
=============================================
1. Add the following line
FCKConfig.Plugins.Add( 'mycombo' ) ; // you can replace mycombo with zoom
2. Add the 'mycombo' item to your toolbarset.
Eg:
FCKConfig.ToolbarSets["Basic"] = [
['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-'
,'About'],
['mycombo']
] ;
=============================================
Create the plugin
=============================================
1. Copy 'mycombo' dir under plugins dir
your_path_to/FCKeditor/editor/plugins/mycombo
2. In the fckplugin.js i implement zoom function:
//**************************START*********************
/*
1st, define the 'command' to execute when an item from the list is selected
*/
var FCKMyCombo_command = function(name) {
this.Name = name ;
}
//This execute the zoom of editor area
FCKMyCombo_command.prototype.Execute = function(itemText, itemLabel) {
if (itemText != "") {
FCK.EditorDocument.body.style.zoom=itemText;
}
}
//was getting GetState is not a function (or similar) errors, so added this.
FCKMyCombo_command.prototype.GetState = function() {
return;
}
FCKCommands.RegisterCommand( 'mycombocommand' , new FCKMyCombo_command('any_name') ) ;
/*
2nd, create the Combo object with the percentage values
*/
var FCKToolbarMyCombo=function(tooltip,style){
this.Command=FCKCommands.GetCommand('mycombocommand');//the command to execute when an item is selected
this.CommandName = 'mycombocommand';
this.Label=this.GetLabel();
this.Tooltip=tooltip?tooltip:this.Label; //Doesn't seem to work
this.Style=style; //FCK_TOOLBARITEM_ICONTEXT OR FCK_TOOLBARITEM_ONLYTEXT
};
FCKToolbarMyCombo.prototype=new FCKToolbarSpecialCombo;
//Label to appear in the FCK toolbar
FCKToolbarMyCombo.prototype.GetLabel=function(){
return "Zoom";
};
//Add the items to the combo list
FCKToolbarMyCombo.prototype.CreateItems=function(A){
//this._Combo.AddItem(itemText, itemLabel); //see FCKMyCombo_command.prototype.Execute = function(itemText, itemLabel) above
this._Combo.AddItem('50%', '<span style="color:#000000;font-weight: normal; font-size: 10pt;">50%</span>');
this._Combo.AddItem('100%', '<span style="color:#000000;font-weight: normal; font-size: 10pt;">100%</span>');
this._Combo.AddItem('150%', '<span style="color:#000000;font-weight: normal; font-size: 10pt;">150%</span>');
}
//Register the combo with the FCKEditor
FCKToolbarItems.RegisterItem( 'mycombo' , new FCKToolbarMyCombo( 'My Combo', FCK_TOOLBARITEM_ICONTEXT ) ) ; //or FCK_TOOLBARITEM_ONLYTEXT
//********END********