FCKeditor Chinese configuration Manual

Source: Internet
Author: User
Performance

First, FCKeditor has excellent performance. Users can load files required by FCKeditor in a short time. for other online editors, this is almost difficult to solve, because too many files need to be loaded when the editor is enabled. for example, although cuteeditor is more powerful than FCKeditor, it is also huge enough. As for freetextbox and so on, there is still a gap between its ease of use and FCKeditor. It can be said that, FCKeditor is an ingenious online editor that integrates the author's advanced object-oriented JavaScript capabilities and integrates ease of use and powerful functions.
[Full text]

Performance

First, FCKeditor has excellent performance. Users can load files required by FCKeditor in a short time. for other online editors, this is almost difficult to solve, because too many files need to be loaded when the editor is enabled. for example, although cuteeditor is more powerful than FCKeditor, it is also huge enough. As for freetextbox and so on, there is still a gap between its ease of use and FCKeditor. It can be said that, FCKeditor is an ingenious online editor that integrates the author's advanced object-oriented JavaScript capabilities and integrates ease of use and powerful functions.

All images, scripts, and call pages related to the editor
. Language file
. Editor skin file
. Tool-like textures, etc.

This will generate a considerable amount of traffic between the server and the client. If many files are called, even if each file is small, it will make users wait impatiently.

In version 2.0, developers can solve this problem in two ways.
That is, specify the loading sequence and script compression.

Loading Sequence
Starting from version 2.0, the editor loads resources by following these steps:
. Basic page (that is, the page where the editor is located) and JS script for loading the editor
. Used to create the editor script
The language and skin of the editor.
. Create an editor.
. Load the preset editing document content.
From now on, you can read and edit the document. However, drag-and-drop support and toolbar are unavailable.
. Load the editor engine script
. Create a toolbar and use it.
From now on, all the functions of the editor have been complete.
. Load toolbar icon

Script Compression

When any new version is packaged, the editor's Js script is preprocessed. The preprocessing steps are as follows:
. Remove all code comments
. Remove all useless white space characters.
. Merge the script into several files.

Using the above method, we can compress the script file to 50% of the original size.
After compression, the original code still exists in a folder named _ source.

How to pack?
Then, copy it to the FCKeditor root folder and run it to automatically package and compress the JS script.
Note that this program is a. Net program and must be installed with. NET Framework.

Want to obtain support?
If you donate 15000 euros, you can get one year of free technical support (more expensive, equivalent to 0.15 million yuan, but the cost of Western Europe is quite amazing)

How to install?

1. download the latest FCKeditor version.
2. decompress the package to the FCKeditor folder in the root folder of your site (the name must be FCKeditor because the FCKeditor location has been identified in the configuration file)
3. Now, the editor can be used. To view the demo, you can access it as follows:
Http: // <your-site>/FCKeditor/_ samples/default.html

Note: You can place FCKeditor in any folder. By default, it is the easiest way to put FCKeditor in the folder. if the folder you put uses another name, modify the basepath parameter in the configuration folder, as shown below:
Ofckeditor. basepath = "/components/FCKeditor /";

In addition, all the folders and files starting with the following line in the FCKeditor folder are optional and can be safely deleted from your release. They are not required when the editor is running.

How can I integrate FCKeditor into my page?

Currently, FCKeditor only provides JavaScript-based integration, so here we only show how to apply JavaScript to integrate FCKeditor into the site. Of course, the integration of other languages, you can refer to the example in the _ samples folder to complete
1. If the editor has been installed in the/FCKeditor/folder of your site. so, the first step we need to do is to add the script tag in the header segment of the page to introduce the Javascript integration module. for example:
<SCRIPT type = "text/JavaScript" src = "/FCKeditor. js"> </SCRIPT>

The path is changeable.

2. Now, the FCKeditor class can be used. There are two ways to create a FCKeditor editor on the page:
Method 1: inline (recommended): Insert the following code to the place where the editor needs to be inserted in the form tag of the page:
Script Type = "text/JavaScript">
VaR ofckeditor = new FCKeditor ('fckeditor1 ');
Ofckeditor. Create ();
</SCRIPT>

Method 2: textarea tag replacement method (not recommended): In the onload event on the page, add the following code to replace an existing textarea tag.

<HTML>
<Head>
<SCRIPT type = "text/JavaScript">
Window. onload = function ()
{
VaR ofckeditor = new FCKeditor ('mytextarea ');
Ofckeditor. replacetextarea ();
}
</SCRIPT>
</Head>
<Body>
<Textarea id = "mytextarea" name = "mytextarea"> This is <B> the </B> initial value. </textarea>
</Body>
</Html>

3. Now, the editor can be used.

FCKeditor class reference:
The following describes the FCKeditor class used to create an editor on the page.

Constructor:
FCKeditor (InstanceName [, width, height, toolbarset, value])
InstanceName: Unique name of the Editor (equivalent to ID)
Width: width
Height: Height
Toolbarset: name of the toolbar set
Value: the initialization content of the editor.

Attribute:
InstanceName: Editor Instance name
Width: width. The default value is 100%.
Height: height. The default value is 200.
Toolbarset: tool set name. For details, refer to fckconfig. js. The default value is default.
Value: Initialize the HTML code of the editor. The default value is null.
Basepath: The base path of the editor. The default path is/FCKeditor/folder. Be sure not to use the relative path. It is best to use the Representation Method Relative to the root path of the site and end /.
Checkbrowser: whether to check the browser compatibility before the editor is displayed. The default value is true.
Displayerrors: Indicates whether an error is displayed. The default value is true;

Set:
Config [Key] = value;
This set is used to change the value of a configuration item, as shown in figure
Ofckeditor. config ["defaultlanguage"] = "Pt-Br ";

Method:
Create ()
Create and output an editor

Repacetextarea (textareaname)
Replace the text box with the editor

How to configure FCKeditor?
FCKeditor provides a set of settings for customizing its appearance, characteristics, and behavior. The main configuration file name is fckconfig. js.
You can edit the main configuration file or define a separate configuration file. The configuration file uses the Javascript syntax.

After modification, you can use the following syntax when creating an Editor:
VaR ofckeditor = new FCKeditor ('fckeditor1 ');
Ofckeditor. config ['customconfigurationspath'] = '/myconfig. js ';
Ofckeditor. Create ();

Reminder: After you modify the configuration, clear the browser cache to view the effect.

Configuration Options:

Autodetectlanguage = true/false automatic language Detection
Basehref = "" Relative Link base address
Contentlangdirection = "LTR/RTL" default text direction
Contextmenu = string array, right-click the menu content
Customconfigurationspath = "" custom configuration file path and name
DEBUG = true/false whether to enable debugging. In this way, when fckdebug. Output () is called, the content is output in the debugging window.
Defaultlanguage = "" default language
Editorareacss = "" style table file in the editing area
When enablesourcexhtml = true/false is true, when the code page is switched from the visual interface to the code page, the HTML is processed as XHTML.
Enablexhtml = true/false: Can I use XHTML to replace HTML?
Fillemptyblocks = true/false use this function to replace empty block-level elements with spaces.
Fontcolors = "" sets the text color list when the color picker is displayed
Fontformats = "" set the name displayed in the text format list
Fontnames = "" fontnames
Fontsizes = "" font size in the font size list
Forcepasteasplaintext = true/false force paste to plain text
Forcesimpleampersand = true/false do not convert & symbol to XML Entity
Formatindentator = "" specifies the characters used to indent the code in the source code format.
Formatoutput = true/false: whether to automatically format the code when output content
Formatsource = true/false whether to automatically format the code when switching to the Code view
Fullpage = true/false: whether to allow editing of the entire HTML file or only the content between the bodies
Geckousespan = true/false: whether to allow the span flag to replace the B, I, u flag
Iespelldownloadurl = "" download the spelling checker URL
Imagebrowser = true/false: whether to allow browsing of server functions
Imagebrowserurl = "" the URL that runs when browsing the server
Imagebrowserwindowheight = "" image browser window height
Imagebrowser1_wwidth = "" image browser window width
Linkbrowser = true/false: whether to allow browsing the server when a link is inserted
Linkbrowserurl = "" browsing the server URL when inserting a link
Linkbrowserwindowheight = "" link target browser window height
Linkbrowserdomainwwidth = "" link target browser window width
Plugins = Object Registration plug-in
Pluginspath = "" plug-in folder
Showborders = true/false merge border
Skinpath = "" skin folder location
Smileycolumns = 12 Number of columns in the graphic operator window
Smileyimages = String Array array of image file names in the graphic character window
Smileypath = "" folder path
Smileywindowheight tumbler window height
Smiley1_wwidth tumbler window width
Spellchecker = "iespell/spellerpages" set the spelling checker
When startupfocus = true/false is enabled, focus to the editor.
Stylesxmlpath = "" set the location of the XML file that defines the CSS style list
Tabspaces = 4 Number of space characters generated by the tab key
Toolbarcancollapse = true/false: whether to enable or disable the toolbar.
Toolbarsets = the toolbar set can be used for objects.
Toolbarstartexpanded = true/false enable indicates whether to expand a toolbar.
Usebroncarriagereturn = true/false when you press enter, whether to generate a br mark or a P or Div mark

How do I customize the style list?
The FCKeditor style toolbar provides predefined styles defined by the XML file. The default XML style file exists in the fckstyls. xml file in the FCKeditor root folder.
The structure of the XML file is analyzed as follows:
<? XML version = "1.0" encoding = "UTF-8"?>
<Styles>
<Style name = "my image" element = "IMG">
<Attribute name = "style" value = "padding: 5px"/>
<Attribute name = "border" value = "2"/>
</Style>
<Style name = "italic" element = "em"/>
<Style name = "title" element = "span">
<Attribute name = "class" value = "title"/>
</Style>
<Style name = "title H3" element = "H3"/>
</Styles>

Each STYLE tag defines a style. Name is the style name displayed in the drop-down list. The element attribute specifies the objects applicable to this style, because the style in FCKeditor is context sensitive, that is, select different objects. Only the styles defined for these objects are displayed.

Spelling check

FCKeditor comes with two spell checking tools, iespell, which is used by default. This method requires the customer to download and install the small software iespell. In addition, spellpager is also provided for spelling checks. However, since spellpager is a server-side script compiled by PHP, your web server must support the PHP scripting language.
For more information about how to change the spelling checker, see the configuration file.

Compression script

To improve the efficiency of Script Loading, FCKeditor uses the following methods to compress the script as much as possible to reduce the script size:
1. Remove the comments from the script.
2. Remove the meaningless blank in the script.
In addition, FCKeditor provides a tool specifically used to compress scripts so that you can reduce the file size during release,
You can copy fckeditor.packager.exe in the _packagerfolder to the FCKeditor root folder to run and compress the script.

Localized FCKeditor
If FCKeditor does not provide all the languages you need (actually all of them are available), you can create a new language by yourself.
, You only need to copy the en. JS. in addition, the language name and the corresponding script file name must follow the RFC 3066 standard, but must be in lower case. For example, the script file name corresponding to Portuguess language must be PT. JS
If you want to target a certain country, you can add a horizontal line and a country abbreviation after the abbreviation.

During use, the system automatically detects the client language and country and uses the appropriate interface language.

After creating a new language, you must create an entry for it in "Edit/lang/fcklanguagemanager. js", as shown below:
Fck1_agemanager. availablelanguages =
{

En: 'English ',
PT: 'portranges'
}

Note that the file must be saved in UTF-8 format

How can I interact with server scripts?
Please check the example to get the relevant content

In addition, use the following steps in ASP. NET:
1. Add FCKeditor to the toolbox
2. Drag the FCKeditor Control to the page
3. Specify a name for it
4. all attributes of the FCKeditor class can be used not only in code, but also directly as attributes of the FCKeditor Control. For example, to change the skin, you can specify skinpath = "/FCKeditor/Editor/skins/office2003" on the UI page. net version can be better, you can find FCKeditor ASP. net 2.1 source file, then modify the control design, expose more useful properties for it, and re-compile it.
5. Use the Value Attribute of the FCKeditor Control to obtain the PostBack data.
6. due to the default status, Asp. net does not allow the submission of HTML and JavaScript content. Therefore, you must set validaterequest to false for pages using FCKeditor. (<% @ page validterequest = "false" %>)

--------------------------------------------------------

Appendix:

I. How to set the language for uploading files

In the fckconfig. js file under the root directory of FCKeditor

VaR _ filebrowserlanguage = 'asp '; // ASP | aspx | CFM | lasso | Perl | PHP | py
VaR _ quickuploadlanguage = 'asp '; // ASP | aspx | CFM | lasso | PHP

The two lines are changed to the editor language you need to call. If Asp.net is used, it is changed to aspx;

2. Solve Chinese problems:
Add the following to Web. config:
<Globalization requestencoding = "gb2312" responseencoding = "gb2312"/>
In this way, Chinese files can be displayed, but the URL address is also Chinese;
If the server does not parse the Chinese address properly, the image may not be browsed;
So modify: Editor \ filemanager \ browser \ Default \ frmresourceslist.html
In openfile function
Window. Top. opener. seturl (fileurl );
To:
Window. Top. opener. seturl (escape (fileurl ));

3. Set the upload directory:
1: Set in Web. config:
<Deleetask>
<Add key = "FCKeditor: userfilespath" value = "/fck/upload/"/>
</Appsettings>

2: Set in session:
Add the following code to editor \ filemanager \ browser \ Default \ connectors \ aspx \ connector. aspx:
<SCRIPT runat = "server" Language = "C #">
Protected override void oninit (eventargs E)
{
Session ["FCKeditor: userfilespath"] = "/fck/upload1 /";
}
</SCRIPT>

Appendix: How do I dynamically set the path of the uploaded image in Asp.net?

1. Modify the value of fckconfig. imagebrowserurl in Javascript as follows:
Fckconfig. imagebrowserurl + = "? Path = path of the file to be uploaded ";
For example, to upload a file to the uploadfile folder in the root directory of the site, set it:
Fckconfig. imagebrowserurl + = "? Path =/uploadfile ";
2. Add the following program to the end of the "editor \ filemanager \ browser \ Default \ connectors \ aspx \ connector. aspx" file:
<SCRIPT runat = "server" Language = "C #">
Protected override void oninit (eventargs E)
{
If (request. querystring ["path"] = NULL ){
Session ["FCKeditor: userfilespath"] = "/uploadfiles/"; // set the default value
} Else {
Session ["FCKeditor: userfilespath"] = request. querystring ["path"];
}
}
</SCRIPT>

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.