内容管理系统中不可避免的会涉及到内容的在线编辑问题,这两天看了不少在线的HTML编辑器。我主要是从车东的内容管理系统(CMS)的设计和选型一文中提到的一篇文章TTW WYSIWYG Editors里面介绍的那些编辑器开始的。虽然文中列举了不少的编辑器,但是也没发现特别满意的。车东推荐的是aynhtml,但是我看了一下,发现它只支持Internet Explorer 5.5以上,并且已经停止开发了似乎(最新版本是2002年的)。我觉得在线编辑器的最重要的一个特性就是TTW WYSIWYG Editors一文中列出的cross platform特性,因为B/S相对与C/S的一个很大优势就在于B/S部署方便,如果编辑器强迫用户使用IE,那么这一优势也就荡然无存了。
于是自己又找寻和比较了一阵,最后感觉比较好的如下:
This HTML text editor brings to the web many of the powerful functionalities of known desktop editors like Word. It’s really lightweight and doesn’t require any kind of installation on the client computer.
As it is Open Source, you are allowed to use it for free wherever you want.
2 Kupu
Kupu is a ‘document-centric’ open source client-side editor for Mozilla, Netscape and Internet Explorer. Inspired by Maik Jablonski’s Epoz editor, it was written by Paul Everitt, Guido Wesdorp and Philipp von Weitershausen (and several other contributors, for a complete list refer to the CREDITS.txt file) to improve the JavaScript code and architecture, pluggability, standards support, support for other webservers than Zope (which was the original target platform for Epoz), configurability and a lot of other issues.
3 Cross-Browser Rich Text Editor
The cross-browser rich-text editor implements the Mozilla Rich Text Editing API included with Mozilla 1.3+. There is NO LICENSE, so just take the code and use it for any purpose. This code is 100% free. Enjoy!
Requires: IE5+/Mozilla 1.3+/Mozilla Firebird/Firefox 0.6.1+/Netscape 7.1+ for all rich-text features to function properly. If browser does not support rich-text, it should display a standard textarea box.
4 TinyMCE
TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances. TinyMCE is very easy to integrate into other CMS systems.
推荐FCKeditor,是sourceforge.net上面最活跃的项目之一,功能十分强大,外观做的也很不错,还支持多语言,最重要的跨平台或者说跨浏览器也还不错。现在出到FCKeditor 2.0 RC2,就是bug似乎还多了一点,希望能尽快改善到稳定的可用版本。
部署FCKeditor时注意,如果部署为客户端Javascript的话,需要:
1. 修改fckeditor.js中的BasePath变量为editor目录所在的目录路径。
2. 调用页面中可以参照_samples目录里面的例子,不过也需要将页面中JavaScript的调用的BasePath做如上更改。同时,页面中的css样式表的路径要使用绝对路径(这个我在一般打开时相对路径可以用,但是部署为Struts应用时就不行了,改成绝对路径才可以,不知道为什么还,应该是和Struts有关)