最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
修改增加fck编辑按钮 功能方法
时间:2022-06-25 14:44:55 编辑:袖梨 来源:一聚教程网
第一步:在toolbar中添加功能按钮
fckconfig.js:fckconfig.toolbarsets[“default”] 中添加按钮名称
fckconfig.toolbarsets["default"] = [
['bold','italic','-','about', 'mydiy']
] ;第二步:
为按钮添加中文名称和英文名称
zh-cn.js:为你的按钮起个中文名字
mydiy : “我的自定义按钮"
en.js:为你的按钮起个英文名字
mydiy:"mydiybutton"
第三步:在toolbar中显示该按钮
fckeditorcode_gecko.js(fckeditorcode_ie.js):
查找:
case 'newpage':b=new fcktoolbarbutton('newpage',fcklang.newpage,null,null,true,null,4);break;
在break后插入你的代码
比如case 'mydiy':b=new fcktoolbarbutton('mydiy',fcklang.mydiy,null,null,false,true,50);(这个50是按钮的显示图片,要让你的自定义按钮显示为插入图片那个按钮的图片,可以填入37)
这样就可以在toolbar中显示你的按钮了
第四步:定义按钮功能原型
ckeditorcode_gecko.js(fckeditorcode_ie.js):
查找:
var fcknewpagecommand=function(){this.name='newpage';};
fcknewpagecommand.prototype.execute=function(){fckundo.saveundostep();fck.sethtml('');fckundo.typing=true;};
fcknewpagecommand.prototype.getstate=function(){return fck_tristate_off;};
定义功能原型:(这里直接复newpage的实现代码放到后面,然后进行修改)
比如:var fckmydiycommand=function(){this.name='mydiy';};fckmydiycommand.prototype.execute=function(){ 这里写你所需要执行的代码或者函数,比如alert("i am here !");};fckmydiycommand.prototype.getstate=function(){return 0;};
将上面代码插入到查找内容之后。
第五步:按钮功能实例化:
ckeditorcode_gecko.js(fckeditorcode_ie.js):
查找:
case 'newpage':b=new fcknewpagecommand();break;
功能实例化:
case 'mydiy':b=new fckmydiycommand();break;
将上面代码插入到查找内容之后。
ok,这样就可以在为fckeditor加上自定义的按钮了。
如果要为按钮加上快捷键,可以在fckconfig.js中:fckconfig.keystrokes = []加上
[ ctrl + 71 /*g*/, 'mydiy' ],
相关文章
- 王者荣耀明世隐夜落电台怎么获得 明世隐夜落电台上架介绍 05-09
- 原神虹色巡回第二阶段怎么攻略 原神虹色巡回第二阶段完成方法 05-09
- 恋与深空银月流烁夜活动怎么玩 恋与深空银月流烁夜活动玩法介绍 05-09
- 王者荣耀西游英雄怎么领 王者荣耀送西游主题资源活动介绍 05-09
- 币宝交易所3.0官网版 05-09
- coinbene满币交易所官网版 05-09