第一步:在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' ],
孢子2生物进化中文版(Spores)
孢子2生物进化中文版让我们来做一回疯狂的博士,打造一个属于自
叫我万岁爷九游官方版
叫我万岁爷带你体验当换地点感觉,全新的模拟手游大作让你开始一
梦回凤歌
梦回凤歌手游中你将步入古代的宫廷纷争之中,本想度过美好幸福的
洋果子店rose最新版本
洋果子店最新版是一款十分容易让人垂涎的开店经营类手游。游戏玩
明日大亨最新版
明日大亨手游,一个非常经典有趣的模拟经营类型的商战手游,在游