尝试使用ckeditor创建一个简单的插件
我以前创建过插件,但我肯定错过了一些简单的东西。 我回到了教程,尝试添加一个非常简单的插件。代码如下: 我没有在控制台上看到错误,也没有在编辑器中看到图标 任何帮助都将不胜感激 在我的PHP中我有尝试使用ckeditor创建一个简单的插件,ckeditor,Ckeditor,我以前创建过插件,但我肯定错过了一些简单的东西。 我回到了教程,尝试添加一个非常简单的插件。代码如下: 我没有在控制台上看到错误,也没有在编辑器中看到图标 任何帮助都将不胜感激 在我的PHP中我有 CKEDITOR.replace( 'editor1', { toolbar : 'MyToolbar', customConfig : '/admin/ckeditor/my_config.js?v=5.1', height : '400px', }); 我
CKEDITOR.replace( 'editor1',
{
toolbar : 'MyToolbar',
customConfig : '/admin/ckeditor/my_config.js?v=5.1',
height : '400px',
});
我的_config.js看起来像::
CKEDITOR.editorConfig=函数(配置){
config.enterMode=CKEDITOR.ENTER\u BR;
整版:正确;
外部插件:“pdf”
config.toolbar = 'MyToolbar';
config.toolbar_MyToolbar =
[
{ name: 'document', items : [ 'Source' ] },
{ name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About','Pdf' ] }
];
};
插件目录中的目录结构是:
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'
} );
}
} );
编辑
-->插件
------>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'
} );
}
} );
CKEDITOR.plugins.add('pdf',
{
init:函数(编辑器)
{
editor.addCommand('insertPdf',
{
执行:函数(编辑器)
{
var timestamp=新日期();
insertHtml('当前日期和时间为:'+timestamp.toString()+'');
}
});
editor.ui.addButton('Pdf',
{
标签:“插入PDF”,
命令:“insertPdf”,
图标:this.path+'images/pdf.png'
} );
}
} );
找到了问题。
在my_config.js中
extraPlugins : 'pdf';
而不是
config.extraPlugins = 'pdfs';