这是我第一次使用ckeditor,我正在尝试做一个自定义按钮。
在我的plugin.js中:
CKEDITOR.plugins.add('save-post',
{
init: function (editor) {
var pluginName = "save-post";
//CKEDITOR.dialog.add(pluginName, this.path + 'dialogs/save-post.js');
editor.addCommand(pluginName, SaveBlogPost());
editor.ui.addButton('save-post',
{
label: 'save-post',
command: pluginName
});
}
});下面是另一个js文件:
function SaveBlogPost() {
console.log("SAVEBLOGPOST");
};控制台在创建编辑器实例时会写出"SAVEBLOGPOST“。但在那之后,我得到了“未捕获名称:无法设置未定义的属性‘TypeError’”
它引用的这个名称在哪里?
发布于 2016-04-30 13:13:58
"addCommand“方法需要一个命令定义作为第二个参数。您可以在此处找到文档和工作示例:http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-addCommand
https://stackoverflow.com/questions/34862688
复制相似问题