FCKEditor工具条定制

FCkEditor确实是一个非常优秀的HTML在线编辑器,它的功能确实很强大,而且也非常的灵活,具有很强的定制性。

FCKEditor默认的工具栏项目很多,我们完全可以对其进行自定制,以满足自己的需求。

网上也有很多介绍定制工具栏的方法。下面就是其中的一种:

在fckconfig.js中找到FCKConfig.ToolbarSets 段,默认有两个工具条样式,一个是Default,一个是Basic(我的版本是2.5)。

增加如下一段:
 1FCKConfig.ToolbarSets["Custom"= [
 2    ['FontFormat','FontName','FontSize'],
 3    ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
 4    ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'],
 5    ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
 6    ['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
 7    ['Link','Unlink','Anchor'],
 8    ['TextColor','BGColor'],'/'
 9    ['Cut','Copy','Paste','PasteText','PasteWord'],
10    ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
11    ['FitWindow','ShowBlocks','-','Source','About']        // No comma for the last row.
12] ;


然后再调用代码中做如下更改

注意第7行是新增的,指定所要使用的工具栏

 1<%
 2    Dim oFCKeditor
 3    Set oFCKeditor = New FCKeditor
 4    oFCKeditor.BasePath    = "edit/"
 5    oFCKeditor.Value    = ""
 6    oFCKeditor.Config("SkinPath")="/website/manage/edit/editor/skins/silver/"
 7    oFCKeditor.ToolbarSet = "Custom"
 8    oFCKeditor.Create "txtcontent"
 9%>
10


其定制语法很简单
[]  表示一个工具条,
[]  中的短横线'-'表示一个垂直分割线
''  两个单引号中间加一个标识符表示一个工具栏按钮,具体的对应关系可以自己找。
'/' 作用类似于一个回车。使该符号后面的工具栏新起一行排列。

我最终的定制效果如下:


posted on 2008-03-16 17:06  antistone  阅读(2780)  评论(0编辑  收藏  举报