CKEditor 4的自定义插件没有在ON上插入内容

时间:2015-10-25 21:17:20

标签: ckeditor ckeditor4.x

我为CKEditor 4编写了一个'简单'插件,用于插入带有数据属性和类的div(数据属性通过简单的对话窗口设置)。一切正常,除非单击确定,否则不会在实际编辑器窗口中插入任何内容。有人可以查看下面的代码,也许可以指出我哪里出错了。感谢。

编辑器配置

**Instead, your app should store bookmarks data internally**

Plugin.js

CKEDITOR.editorConfig = function (config) {
config.BaseHref = 'http://cdn.aoec.com/';
config.extraPlugins = 'contactforms,autogrow,justify,filebrowser,showblocks,tabletools,tweetabletext,widget,widgetbootstrap,widgettemplatemenu,wsc,moxiemanager,video,bootstrapCollapse,image2';
config.autoGrow_minHeight = 400;
config.contentsCss = '/content/styles/site.css';
config.skin = 'flat';
config.allowedContent = true;
config.bootstrapCollapse_managePopupContent = true;
config.toolbar = [
    ['Source', '-', 'Templates', 'ShowBlocks'],
    ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
    ['Link', 'Unlink', 'Anchor'], ['Table', 'TableTools', 'HorizontalRule', 'SpecialChar'],
    ['CreatePlaceholder', 'Image', 'Video'],
    ['Bold', 'Italic', 'Strike', 'Subscript', 'SuperScript', '-', 'RemoveFormat', 'Styles', 'Format'],
    ['NumberedList', 'BulletedList', '-', 'BlockQuote'],
    ['createDiv', 'JustifyLeft', 'JustfiyCenter', 'JustifyRight', 'JustifyBlock'],
    ['TweetableText'], ['WidgetTemplateMenu'],
    ['BootstrapCollapse'], ['ContactForms']
];
};

contactforms.js

CKEDITOR.plugins.add('contactforms', {
icons: 'contactforms',
init: function (editor) {
    editor.addCommand('contactforms', new CKEDITOR.dialogCommand('contactformsdialog', {
        allowedContent: 'div[class,data-form-id]'
    }));

    editor.ui.addButton('ContactForms', {
        label: 'Insert a Contact Form',
        command: 'contactforms',
        toolbar: 'insert'
    });

    CKEDITOR.dialog.add('contactformsdialog', this.path + 'dialogs/contactforms.js');
}
});

提前致谢...

1 个答案:

答案 0 :(得分:0)

我发现了错误。 onOK应该是onOk。 Captial K就是问题所在。