FCKeditor编辑器的配置文件

Configuration File  配置文件

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.
FCKeditor编辑器提供了很丰富的配置选项,这些选项可以方便的自定义它的外观,功能和行为。主要的配置文件是 "fckconfig.js" 。在您的FCKeditor 安装的根目录下就可以找到该文件。
Available Configuration Options  可用的配置选项。

Check out the configuration options list  to have a complete overview of each setting.  您可以通过 configuration options list  该链接查看到完整的配置选项的列表。

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.  您既可以通过编辑主配置文件来改变原始的配置,也可以在一个单独的文件里写入您自己的配置。一般习惯于使用 javascript 的语法来配置 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.  如果想更方便快捷的更新FCKeditor 。最好的方式就是 前面提到的,在编辑器解压的目录外 再新建个单独的文件,然后将自己所有的相关配置都写入该文件,这样一来,您只需在更新时 覆盖编辑器所在的目录即可。

Step 1  步骤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: 例如,创建一个 "myconfig.js" 的文件,保存到网站的根目录或其他目录下。你的配置信息将写入该文件中。例如,假设你想让编辑器的界面使用法语。可以在该文件中写入 如下的代码:

FCKConfig.AutoDetectLanguage = false ; //关闭自动语言检测
FCKConfig.DefaultLanguage = "fr" ;  //使用 fr 表示使用法语作为默认语言。 
Step 2  步骤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  方法1

Find the following line in the main configuration file (fckconfig.js): 在主配置文件 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.
上面的方法是不错,但是,你可能已经意识到了 ---- 这样做 必须要修改原始的文件,这样一来,你必须记住 当升级后,还必须再次修改该文件的这一行。虽然这并不难记,但如果你觉得不方便,可以试试下面提到的方法2 。

Method 2   方法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:  有个更好的方法可以解决上面提到的问题-----即不用修改fckconfig.js文件。你可以在使用 编辑器的 网页中,在创建编辑器实例时,使用以前说过的 Config数组来设置自定义的配置文件的路径,下面以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.  你可以在 PHP之类的服务端脚本中使用类似的方法,可以查看对应脚本的例子来找出具体操作的方式。

Configurations Loading Precedence    配置加载的优先权

When overriding configurations, the following steps are taken:   当重设配置时,会按以下的步骤的顺序来执行:

1 . The configurations in the main configuration file (fckconfig.js) are loaded.  1 。首先会加载 fckconfig.js 这个主配置文件里的配置选项。

2  . The configurations are overridden by the settings in the custom configuration file (if provided).  2 。如果提供了自定义的配置文件的话,就会以自定义文件里的设置覆盖掉 先前加载的配置。

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.  3 。最后,在使用编辑器的网页 创建编辑器实例时,所进行的配置,如使用 Config数组进行的设置 会成为最终的配置。除了,"CustomConfigurationsPath" 这个配置选项,如果在第一步即 fckconfig.js文件里设置了话,后面就不会被覆盖了。因为如果在 第一步进行了设置,那么第二步自定义文件就会被加载,所以第三步也就没有设置这个选项的必要了。

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.  注意:你必须保留 编辑器所在目录的原始的配置文件,"fckconfig.js",不可以删除它,否则你的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:
注意:当修改了配置文件后,要记得清空浏览器的缓存,否则你可能看不到配置文件改变后的效果,当使用代理的时候,会长时间的缓存你的 js 脚本文件,所以要记得清空缓存,下面有几个技巧可以快速的加载更改后的配置文件 同时又可以避免那些麻烦的清空浏览器缓存的操作:

• 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. 如果你使用的是IE 浏览器,可以 按 ctrl + F5 就可以重新加载脚本文件了,不需要手工去清理浏览器的缓存。

• 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).
如果你使用的是 火狐 或 其他的Mozilla 系列的子产品,可以 按 Shift+CTRL + R  就可以重新加载脚本了,如果这个方法失效,那时就只有手工清理缓存了。

• 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() ;

OK,FCKeditor的配置部分先讲到这,休息,休息哈。

转载于:https://www.cnblogs.com/yehu/archive/2010/09/04/1817754.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
最近做了一个文章管理的系统,用到在线编辑器,修改了一下现在能实现音频,视频,图片,附件,Flash等文件的上传。费了好大的功夫。。 FCKeditor应用在ASP.NET上,需要两组文件,一组是FCKeditor本身,另一个是用于ASP.NET的FCKeditor控件(分为1.1和2.0两个版本,这里使用2.0版本)。 1. 将FCKeditor加入到项目中 解压FCKeditor编辑器,得到文件夹fckeditor,复制此文件夹到Web应用的项目下(也可以是子孙目录下)。 解压FCKeditor控件,在其子目录bin/Release/2.0下有一个程序集。在Web应用的项目中引用该程序集。 2. 在页面中使用FCKeditor 有两种方式。 (1)手工编码 在页面中加入ASP.NET指令: 然后在需要的地方加入FCKeditor控件: (2)集成到Visual Studio工具箱 打开一ASP.NET页面,展开Toolbox,打开右键菜单,选择“Choose Items ...”,在出现的“Choose Toolbox Items”会话框的“.NET Framework Components”选项卡中选择“Browse”,找到并选中FCKeditor程序集,打开后回到“Choose Toolbox Items”窗口,点击“OK”,完成控件导入。 这时,在Toolbox的General分类下出现了一个名为FCKeditor的控件,可以像使用Visual Studio内置控件一样使用它。 3. 配置FCKeditor编辑器路径 在页面中,使用的是FCKeditor控件,该控件需要知道FCKeditor编辑器文件组的路径。有两种配置方法。 (1)配置web.config 在appSettings配置节中加入 使用这种配置方法后,对于项目中任何一个页面中用到的FCKeditor控件,都不用再配置其BasePath属性。 (2)直接对用到的FCKeditor控件进行配置 在页面代码中设置FCKeditor的属性BasePath为FCKeditor编辑器文件组的路径,或者在Page_Init事件处理器中设置其BasePath的值。 4. 配置FCKeditor编辑器文件上传路径 在web.config的appSettings配置节中加入 或者 这样,就完成了FCKeditor向ASP.NET页面的集成工作。 二、配置FCKeditor 按照FCKeditor的默认配置,可以完成一些常用的HTML可视化编辑工作,但在实际应用中,还需要对其做进一步的配置。FCKeditor控件的可配置属性不多,且配置后只能作用于一个单一实例。实际上,需要对FCKeditor编辑器文件组中的通用配置文件/fckconfig.js和ASP.NET专用文件上传管理代码文件/editor/filemanager/connectors/aspx/config.ascx进行配置。 1. 配置控件语言 FCKeditor是自动探测浏览器所使用的语言编码的,其默认语言是英文。修改配置行"FCKConfig.DefaultLanguage = 'en';"为'zh-cn',采用中文为默认语言。 2. 配置控件应用技术 FCKeditor默认是用于php技术的。修改配置行"var _FileBrowserLanguage = 'php';"和"var _

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值