FCKeditor 外掛程式開發

來源:互聯網
上載者:User

外掛程式功能:可以給選定的一段文字增加擴充資訊,展示時,點擊此段文字,頁面側邊欄展示擴充資訊
開發思路:給選定文字增加a標籤,在a標籤上註冊事件,該事件可在文章展示時,點擊觸發頁面側邊欄展示擴充資訊
版本:2.6.3

開發步驟:一、複製%fckeditor%/editor/dialog/fck_link.html 與 %fckeditor%/editor/dialogfck_link/fck_link.js 到建立檔案夾%fckeditor%/editor/plugins/extinfo ,作為模板,適當修改檔案名稱和檔案內容

二、 修改 %fckeditor%/fckconfig.js在該檔案中搜尋FCKConfig.ToolbarSets["Default"],向其中加入新的外掛程式名稱:ExtInfo

三、語言根據需要修改 %fckeditor%/editor/lang 中的檔案如:中文語言
英文語言:

四、註冊外掛程式修改檔案 %fckeditor%/editor/js/fckeditorcode_gecko.js、fckeditorcode_ie.js在FCKCommands.RegisterCommand方法中的switch結構中,加入如下代碼:case 'ExtInfo':B=new FCKDialogCommand('ExtInfo',FCKLang.ExtInfoProp,'plugins/extinfo/fck_extinfo.jsp?UL',550,300);break;
在FCKToolbarItems.GetItem方法中的switch結構中,加入如下代碼:case 'ExtInfo':B=new FCKToolbarButton('ExtInfo',FCKLang.ExtInfo,null,null,null,true,72);(72表示的是表徵圖的位置,表徵圖檔案%fckeditor%\editor\skins\office2003\fck_strip.gif)
成果展示:



註:擴充資訊的內容儲存在資料庫裡,a連結只保留id

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.