FCKeditor Plugin Development Reference Document _ Web Editor

Source: Internet
Author: User

One: The directory structure of the plugin
The name of the plug-in directory must be the same as the name of the plug-in, and the directory must contain a fckplugin.js file. Optional includes a lang directory to internationalize the interface. Each file defines a language, the filename does not contain. js, and is registered with FCKCONFIG.PLUGINS.ADD (). If you implement a plug-in command that does not have an interface, you may not need to support any language.
For example: The directory structure of the FindReplace plugin is as follows:
/editor/plugins/findreplace/fckplugin.js
/editor/plugins/findreplace/lang/en.js
/editor/plugins/findreplace/lang/zh.js
Define your plugin in the Fckplugin.js file, and you should also register the change command and create a toolbar button.
Registration Code Description:

Copy Code code as follows:

Register command, Registercommand (command name, command)
Fckcommands.registercommand (
' My_find ',
New Fckdialogcommand (
fcklang[' Dlgmyfindtitle '],
fcklang[' Dlgmyfindtitle '],
Fckconfig.pluginspath + ' findreplace/find.html ', 340, 170));

Fckcommands.registercommand (' My_replace ',
New Fckdialogcommand (
fcklang[' Dlgmyreplacetitle '],
fcklang[' Dlgmyreplacetitle '],
Fckconfig.pluginspath + ' findreplace/replace.html ', 340, 200));

Create a toolbar button, now create, and then register.
var ofinditem = new Fcktoolbarbutton (' My_find ', fcklang[' dlgmyfindtitle ');
Ofinditem.iconpath = Fckconfig.pluginspath + ' findreplace/find.gif ';
Fcktoolbaritems.registeritem (' My_find ', ofinditem);

var oreplaceitem = new Fcktoolbarbutton (' My_replace ', fcklang[' dlgmyreplacetitle ');
Oreplaceitem.iconpath = Fckconfig.pluginspath + ' findreplace/replace.gif ';
Fcktoolbaritems.registeritem (' My_replace ', oreplaceitem);

Two: Install the plugin:
Before installation, copy the unpacked package to the Editor/plugins directory, and then follow these steps:
1, first determine the button in the toolbar position
It's a good idea to write a new toolbar to include a new plugin in a custom profile.

To customize the configuration file:
Copy Code code as follows:

fckconfig.toolbarsets[' plugintest '] = [
[' Source '],
[' Placeholder '],
[' My_find ', ' my_replace '],
[' Table ', '-', '
' Tableinsertrow ', ' tabledeleterows ',
' Tableinsertcolumn ', ' tabledeletecolumns ',
' Tableinsertcell ', ' tabledeletecells ',
' Tablemergecells ', ' Tablesplitcell '
],
[' Bold ', ' Italic ', '-', ' orderedlist ', ' unorderedlist ', '-', ' Link ', ' Unlink ', '-', ' about ']
] ;

2: Add plugins Also, you can add plug-ins directly to the custom file. You can either place the plugin directly in the default directory, or specify the location of the plug-in in the third parameter in the FCKConfig.Plugins.Add method.
Code Analysis:
Reference content
Copy Code code as follows:

FCKCONFIG.PLUGINS.ADD (Pluginname, Availablelanguages, Pathtoplugin)

Pluginname: Plug-in name or plug-in directory name.
Availablelanguages: comma-separated list of available languages.
Pathtoplugin: Absolute path, refers to the directory of Plug-ins, including the plug-in itself a level of directory

Add a plugin in the default location
Reference content
Copy Code code as follows:

FCKCONFIG.PLUGINS.ADD (' FindReplace ', ' en,it ');

Add a plugin in another location, passing the absolute path of the plug-in in the Add method.
Reference content
Copy Code code as follows:

Fckconfig.pluginspath = FCKConfig.BasePath.substr (0, fckconfig.basepath.length-7) + ' _samples/_plugins/';
var sotherpluginpath = FCKConfig.BasePath.substr (0, fckconfig.basepath.length-7) + ' editor/plugins/';
FCKCONFIG.PLUGINS.ADD (' placeholder ', ' en,it ', sotherpluginpath);
FCKCONFIG.PLUGINS.ADD (' tablecommands ', null, Sotherpluginpath);


Http://www.jb51.net/article/18660.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.