m (FCKeditor 2.x/Developers Guide/Setting Configurations moved to FCKeditor 2.x/Developers Guide/Configuration File) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 54: | Line 54: | ||
=== Browser Caching === | === 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. | + | '''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: |
− | 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 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: | ||
+ | <pre> | ||
+ | var oFCKeditor = new FCKeditor( "FCKeditor1" ) ; | ||
+ | oFCKeditor.Config["CustomConfigurationsPath"] = "/myconfig.js?" + ( new Date() * 1 ) ; | ||
+ | oFCKeditor.Create() ; | ||
+ | </pre> |
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.
Contents
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:
- The configurations in the main configuration file (fckconfig.js) are loaded.
- The configurations are overridden by the settings in the custom configuration file (if provided).
- 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() ;