Configuration File"

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

 
(One intermediate revision by the same user not shown)
(No difference)

Latest revision as of 18:54, 21 August 2009

The editor comes with a rich set of configurations that makes it possible to customize its appearance, features and behavior. The main configuration file is named "fckconfig.js". You can find this file in the root of the FCKeditor installation folder.

Available Configuration Options

Check out the configuration options list to have a complete overview of each setting.

Overriding the Default Configurations

You can either edit the main configuration file or just override the settings you want to change in a separate file. JavaScript syntax is used to configure FCKeditor.

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.

Step 1

Create a file called, for example, "myconfig.js" and save it in the root directory (or any directory) of your web site. You custom settings will be placed in this file. For example, let's suppose you want to force the editor to always have its interface in French. Simply writte this code into your new file:

FCKConfig.AutoDetectLanguage = false ;
FCKConfig.DefaultLanguage = "fr" ;

Step 2

Now we have to tell the editor that it has to load my custom configuration. There are two methodes to do it:

Method 1

Find the following line in the main configuration file (fckconfig.js):

FCKConfig.CustomConfigurationsPath = '' ;

and put in the path of your custom configuration file:

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 settings changes remain separated.

Method 2

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 directly in the page that uses the editor. This is an example to achive this in JavaScript:

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.

Configurations Loading Precedence

When overriding configurations, the following steps are taken:

  1. The configurations in the main configuration file (fckconfig.js) are loaded.
  2. The configurations are overridden by the settings in the custom configuration file (if provided).
  3. The configurations are finally overridden by the settings done inline in the editor page, except for the "CustomConfigurationsPath", which is set right 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 default one.

NOTE:You need to keep the original configuration file, "fckconfig.js", in the editor directory. Don't delete it or you will break FCKeditor.

Browser Caching

NOTE: 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 update 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 update 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() ;
This page was last edited on 21 August 2009, at 18:54.