FCKeditor 插件开发

来源:互联网 发布:恋狱月狂病 知乎 编辑:程序博客网 时间:2024/05/16 06:49
插件功能:可以给选定的一段文字增加扩展信息,展示时,点击此段文字,页面侧边栏展示扩展信息

开发思路:给选定文字增加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


1 0
原创粉丝点击