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自訂工具列就是這麼簡單。