最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
修改增加fck编辑按钮 功能方法
时间:2010-11-20 编辑:简简单单 来源:一聚教程网
第一步:在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' ],
-
上一个: js 并行运算实现测试代码
-
下一个: 怎么用js 动态增加蒙板 内嵌网页内容
相关文章
- 饭局狼人杀如何修改位置 07-17
- word修改条形统计图教程 07-03
- ppt底板怎么修改 07-02
- WPS怎么防止文档被修改 06-19
- element.style内联样式的修改方法 06-19
- 小影App如何修改头像和昵称 06-07