-1

我以前创建过插件,但我必须缺少一些简单的东西。我已经回到教程并尝试添加一个非常简单的插件。下面的代码:

我在控制台上没有收到错误,并且在编辑器中没有看到该图标

任何帮助将不胜感激

在我的 PHP 中,我有

CKEDITOR.replace( 'editor1',
    {
    toolbar : 'MyToolbar',
    customConfig : '/admin/ckeditor/my_config.js?v=5.1',
    height : '400px',
    });

my_config.js 看起来像 :: CKEDITOR.editorConfig = function( config ){ config.enterMode = CKEDITOR.ENTER_BR; 全页:真;extraPlugins : 'pdf';

    config.toolbar = 'MyToolbar';
    config.toolbar_MyToolbar =
[
        { name: 'document', items : [ 'Source' ] },
        { name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About','Pdf' ] }
];    

};

插件目录中的目录结构是:

ckeditor

-->插件

------>pdf

--------->图片

------------>pdf.png

--------->plugin.js

和 plugin.js 看起来像:

CKEDITOR.plugins.add( 'pdf', 
{
init: function( editor )
{
    editor.addCommand( 'insertPdf',
        {
            exec : function( editor )
            {    
                var timestamp = new Date();
                editor.insertHtml( 'The current date and time is: <em>' + timestamp.toString() + '</em>' );
            }
        });
    editor.ui.addButton( 'Pdf',
    {
        label: 'Insert PDF',
        command: 'insertPdf',
        icon: this.path + 'images/pdf.png'
    } );
}
} ); 
4

1 回答 1

0

发现了问题。在我的 my_config.js 中

extraPlugins : 'pdf';

代替

config.extraPlugins = 'pdfs';
于 2012-12-16T00:44:46.967 回答