FCKeditor自定义工具栏和定义多个工具栏

FCKeditor 是一个开源的HTML 文本编辑器。可以让web程序拥有如MS Word这样强大的编辑功能.FCKeditor 因其支持当前流行的多种浏览器和开发环境而被广泛的使用。

FCK的工具栏提供了强大编辑的功能,但是在使用中我们可能需要屏蔽工具栏的一些功能,或者在不能得地方使用不同的工具栏。FCK强大的配置功能使我们可以轻松的完成希望的功能。

配置的方法是在FCKeditor中打开fckconfig.js文件。默认的工具栏的配置是

FCKConfig.ToolbarSets["Default"] = [
 ['Source','NewPage','Preview','-'],
 ['Cut','Copy','Paste','PasteText','PasteWord','-'],
 ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
 ['OrderedList','UnorderedList'],
 ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
 ['Link','Unlink'],
 ['Table','Rule','Smiley','SpecialChar'],
 '/',
 ['Style','FontFormat','FontName','FontSize'],
 ['TextColor','BGColor','-','Image'/*,'Flash'*/]  // No comma for the last row.
] ;
修改其中的内容即可。

如果需要定义多个工具栏并在不同的情况上显示,也很简单。将前面的默认工具栏配置复制一份并修改。如:

FCKConfig.ToolbarSets["Simple"] = [
 ['Bold','Italic','-','OrderedList','UnorderedList','-'],
 ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull','-'],
 ['FontName','FontSize','-','TextColor','BGColor','-'] 
] ;

然后在设置ToolbarSet属性

<FCKeditorV2:FCKeditor ID="fck" runat="server" ToolbarSet="Simple">
 </FCKeditorV2:FCKeditor>

OK,实现FCKeditor自定义工具栏就是这么简单。

posted @ 2009-12-24 11:45  ido  阅读(1753)  评论(0编辑  收藏  举报