轉自:crying_boy
第一步:config.js中
config.extraPlugins = '插件名稱';//註冊插件
第二步:plugins文件夾下新建:插件名稱 文件夾
第三步:
1:在plugins/插件名稱/下新建plugin.js;
(function() {
CKEDITOR.plugins.add("插件名稱", {
requires: ["dialog"],
init: function(a) {
a.addCommand("插件名稱", new CKEDITOR.dialogCommand("插件名稱"));
a.ui.addButton("插件名稱", {
label: "插件名稱",//調用dialog時顯示的名稱
command: "插件名稱",
icon: this.path + "g.ico"//在toolbar中的圖標
});
CKEDITOR.dialog.add("插件名稱", this.path + "dialogs/插件名稱.js")
}
})
})();
2:在plugins/插件名稱/下新建 dialogs文件夾,並在其內新建 "插件名稱.js"第四步:/plugins/插件名稱/dialogs/插件名稱.js 內容如下
(function() {
CKEDITOR.dialog.add("插件名稱",
function(a) {
return {
title: "插件名稱",
minWidth: "500px",
minHeight:"500px",
contents: [{
id: "tab1",
label: "",
title: "",
expand: true,
width: "500px",
height: "500px",
padding: 0,
elements: [{
type: "html",
style: "width:500px;height:500px",
html: '內容測試'
}]
}],
onOk: function() {
//點擊確定按鈕後的操作
//a.insertHtml("編輯器追加內容");
}
}
})
})();