FCKeditor自訂工具列和定義多個工具列

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.