我正在尝试将 youtube plugin插件添加到Ckeditor4,无论如何插件工作正常,但工具栏中的图标根本没有显示。
这是 /youtube/plugin.js 中代码的第一部分,用于定义工具栏上的youtube按钮:
CKEDITOR.plugins.add('youtube', {
lang: [ 'en', 'bg', 'pt', 'pt-br', 'ja', 'hu', 'it', 'fr', 'tr', 'ru', 'de', 'ar', 'nl', 'pl', 'vi', 'zh', 'el', 'he', 'es', 'nb', 'nn', 'fi', 'et', 'sk', 'cs', 'ko', 'eu' ],
init: function (editor) {
editor.addCommand('youtube', new CKEDITOR.dialogCommand('youtube', {
allowedContent: 'div{*}(*); iframe{*}[!width,!height,!src,!frameborder,!allowfullscreen]; object param[*]; a[*]; img[*]'
}));
editor.ui.addButton('Youtube', {
label : editor.lang.youtube.button,
toolbar : 'insert',
command : 'youtube',
icon : this.path + 'images/icon.png' //here console.log(this.path) return http://cdn.ckeditor.com/4.9.0/standard/plugins/youtube/
});
通常情况下,当我们添加一个新的插件,例如 youtube plugin时我们需要的是改变路径是将这些部分代码添加到配置中:
CKEDITOR.plugins.addExternal('youtube', '../../node_modules/ckeditor-youtube-plugin/youtube/');
$rootScope.ckEditorOptions = { //ckEditorOptions represent my config variable
allowedContent : true,
extraPlugins: 'youtube',
toolbar_full: [
{name: 'youtube', items: ['Youtube']},
],
language: 'fr',
我注意到,不幸的是,第一行中的CKEDITOR.plugins.addExternal
无效,因为该行角色是定义不应指向CDN的路径this.path
。
我确定我错过了一些东西,因为当我尝试手动编辑icon : this.path
到icon : http://anylink.png
时,会显示图标。