The FCK editor configuration file
分类:Java 作者: 秋天 时间: 08-09-2007
Configurations File
The editor comes with a rich set of configurations that makes it possible to customize its appearance, features and behaviors. The main configuration file is named “fckconfig.js“.
You can either edit the main configuration file or just override the stuff you want to change in a separate file. JavaScript syntax is used to configure FCKeditor.
Available configuration options
A list of available configuration options gives descriptions of each option (work in progress).
Overriding the Default Configurations
To simplify updating FCKeditor on your sites, the best approach is to put all your configuration in a separate file, outside the editor’s package directory structure. In this way, you just need to overwrite the editor’s directory to update it to a newer version.
For example, suppose you want to force FCKeditor to always use the French language for its interface. To do so, you just need to create a file called, for example, “myconfig.js” and put it in the root directory of the site (or wherever you want). Just put the following lines into that file:
FCKConfig.AutoDetectLanguage = false ; FCKConfig.DefaultLanguage = “fr” ;
Now we have to tell the editor that it has to load my custom configuration. The first way to do that is changing the following line in the main configuration file (fckconfig.js):
FCKConfig.CustomConfigurationsPath = "/myconfig.js" ;
The above method is good, but, as you can imagine, you lose the facility not to touch the original files. In any case it is easier to remember that you just need to change one line, and all the other things remain separated.
There is an even better way to have the same results as described above, but without touching the fckconfig.js file. You can set the custom configurations path from the page that uses the editor.
For example, with JavaScript, you could do something like this:
var oFCKeditor = new FCKeditor( "FCKeditor1" ) ; oFCKeditor.Config[”CustomConfigurationsPath”] = “/myconfig.js” ; oFCKeditor.Create() ;
The same method can be used with your preferred server side language. Take a look at the samples to find out how to manipulate the configurations by code.
When overriding configurations, the following steps are done:
- The configuration in the main configuration file (fckconfig.js) are loaded.
- The configuration is overridden by the settings in the custom configuration file (if provided).
-
The configuration is overridden by the settings done in the editor page (if provided), except for the “CustomConfigurationsPath”, that is set after step 1.
You don’t need to include all configuration options in your custom file, just those you want to change. Your file will “override” the original one.
You need to keep the original configuration file, “fckconfig.js“, in the editor directory. Don’t delete it.
Browser Caching
Important: remember to clear your browser cache when making changes to the configuration files, otherwise you may not see your changes. This is especially important when working behind a proxy which may cache your .js files more persistently than pages.
There are a few tricks that can be used while developing to retrieve the latest version of the configuration file:
- If you are using Internet Explorer, hitting CTRL + F5 should suffice to fetch the latest versions of the script. No need to manually clear the browser cache.
- If you are using Firefox or other Mozilla’s children, hitting Shift+CTRL + R should fetch the latest version with no need to clear the cache (although this method doesn’t seem to work at all times, if this fails clear cache manually).
- You could add a number or code in the end of the custom configuration path, so the browser would be forced to load it every time:
var oFCKeditor = new FCKeditor( "FCKeditor1" ) ; oFCKeditor.Config[”CustomConfigurationsPath”] = “/myconfig.js?” + ( new Date() * 1 ) ; oFCKeditor.Create() ;