FCKeditor脚本压缩
Scripts Compression 脚本压缩
The editor scripts source code can be found in the package at the "editor/_source/" directory. It is "human readable" as well as commented. There are a lot of files there, organized by groups. 编辑器的脚本源代码存放在 "editor/_source" 目录中。在这些文件里做了不少注释,具有较强的可读性。这个目录中有很多的文件,并且按类型组织在不同的子目录中。
To maximize loading and execution performance, the production distribution code in compressed to fewer and smaller files, as described in "Performance". These files are found at the "editor/js/" directory. 为了加快文件的加载速度和执行速度,编辑器的发布版代码被压缩为几个脚本文件,并存放在 "editor/js/" 目录中。
Using the "_source" files 使用"_source"目录里的文件
It is possible to run the editor using the original scripts in the "_source" directory. It is useful when developing or debugging the editor. It is quite easy to do that. 可以使用"_source" 目录中的原始脚本来运行编辑器,当对编辑器进行开发和调试时,这样做很有用而且很容易做到。
Using a special URL parameter 使用一个特定的URL 参数
The first way is the easiest on, but it depends on the integration files you are using. For now, only the JavaScript integration can do this. 第一种方法最简单,不过这种方法依赖于你集成编辑器所使用的语言,目前只支持JavaScript 脚本集成方式。
Just add the "fcksource=true" parameter (QueryString) to the URL of the page where the editor is loaded. 只需要在加载编辑器的页面的URL 中添加一个 "fcksource=true" 的参数(即查询字符串也就是 网址后面的 ? 或 & 的部分)。
Using the "original" file 使用 "original" 文件
There is also a definitive way to tell the editor to use the "_source" files. 还有种预定义好的的方式来使用 "_source"目录中的文件。
Just go the "editor" directory and overwrite fckeditor.html with fckeditor.original.html (remember to backup the first one).只需要进入"editor"目录,然后使用fckeditor.orginal.html 文件的内容覆盖掉fckeditor.html文件里的内容。(记得要先备份 fckeditor.html文件,其实,前面的URL参数的方法跟这个方法本质是一样的,前面的方法根据url 参数 fcksource为 true 就加载 fckeditor.original.html,否则默认就加载 fckeditor.html 文件)
To restart using the "compressed" files again, just recover the backed-up "fckeditor.html" file. 要回到使用压缩文件的方式,只需要从备份中恢复"fckeditor.html"文件即可。
Generating the compressed scripts 生成压缩的脚本
An application has been developed to make it easy to update the compressed file in the "js" directory with the changes you may do in the "_source" files. Since version 2.4 there's a new version created in PHP, named FCKpackager and available at: 有个名为"FCKpackager" 的程序可以将 "_source"目录里的文件进行压缩,并更新 "js" 目录中的压缩文件,当你对"_source"目录的源码文件作修改后,就可以使用这个程序来更新压缩文件,自从2.4版本以来,该程序使用PHP程序创作了一个新的版本,可以在下面的链接中下载:
http://www.fckeditor.net/fckpackager
Using FCKpackager 使用FCKpackager
FCKpackager is a simple command line application. Here's a step by step instruction of how to use it: FCKpackager 是一个简单的命令行程序。下面一步步告诉你如何使用它:
1 。Make the changes you want in the "_source" files. 1。在"_source"中对你需要的文件做修改。
2 。Copy the FCKpackager executable or PHP file into the FCKeditor main directory. 2 。将FCKpackager 的exe可执行文件或PHP文件拷贝到FCKeditor的主目录中。
3 。Run the program "fckpackager.exe" or "php fckpackager.php". 3 。运行 "fckpackager.exe" 或 "php fckpackager.php" 。
You will see that the application is running and adding the code from the "_source" files to the "js" files.
你将看到该程序的运行,他会将"_source"文件里的代码添加到"js" 中的文件里。
TIP: When working on Windows, if you simply run fckpackager.exe from Windows Explorer, the program will run in a command prompt window and close immediately. If you want to view the information about the compressing process statistics (number of file processed, original size, output file size) run the program from the command prompt manually (cmd.exe).
小提示:当你在Windows 中运行时,如果你直接在windows 资源管理器里运行 fckpackager.exe 程序(比如直接双击执行),那么程序会在一个弹出的命令提示窗口中运行,并且很快就关闭掉。所以如果你想查看压缩进程的有关信息(比如压缩的文件数目,原始文件的大小,输出文件的大小等),那么就需要在命令提示窗口(运行cmd.exe)中手动执行程序(进入exe所在目录,再输入 exe 文件名来执行)。