日期:2014-05-20 浏览次数:20728 次
CKEDITOR.plugins.add(添加自定义按钮 我想知道点击这按钮时候,在光标停留的地方会自动添加<div>你好</div> 这段html代码.请高手指点,谢谢!
"html",
{
requires:["dialog"],
init:function (a)
{
a.addCommand("html", new CKEDITOR.dialogCommand("html"));
a.ui.addButton(
"Html",
{
label:"插入html",
command:"html",
icon:this.path + "html.jpg"
});
}
}
);
(function(){
//按下按钮运行的js
var a= {
exec:function(editor){
var rules='<div id="rules" style="position:relative; background:#CCC; border:1px solid #000; top:0px; left:0px; ;width:128px ; height: 1206px; background-image: url(images/rules.png); ">1</div>';
CKEDITOR.instances.content.insertHtml(rules);
}
},
//按钮配置
b='rules';
CKEDITOR.plugins.add(b,{
init:function(editor){
editor.addCommand(b,a);
editor.ui.addButton('rules',{
label:'插入标尺',
icon: this.path + 'untitled.png',
command:b
});
}
});
})();