使用CDN在Ckeditor中启用本地插件

时间:2017-03-17 13:26:53

标签: javascript ckeditor text-editor

我尝试启用Youtube等本地插件

编辑器工作正常,没有javascript错误,但不要在工具栏中显示youtube图标。

到目前为止,我的代码看起来像这样

<script src="https://cdn.ckeditor.com/4.6.2/full-all/ckeditor.js"></script>
<script>

  CKEDITOR.plugins.addExternal( 'youtube', '/appx/ipage/ckeditor/plugins/youtube/', 'plugin.js' );
  CKEDITOR.replace( 'editor-full', {


        toolbar: [
            { name: 'others', items: [ 'Youtube' ] },
            { name: 'document', items: [ 'Print','Source' ] },
            { name: 'clipboard', items: [ 'Undo', 'Redo'] },
            { name: 'styles', items: [ 'Format', 'Font', 'FontSize' ] },
            { name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'RemoveFormat', 'CopyFormatting' ] },
            { name: 'colors', items: [ 'TextColor', 'BGColor' ] },
            { name: 'align', items: [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] },
            { name: 'links', items: [ 'Link', 'Unlink' ] },
            { name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote' ] },
            { name: 'insert', items: [ 'Image', 'Table'] },
            { name: 'clipboard', items: ['Paste', 'PasteText', 'PasteFromWord'] }           
        ],

        customConfig: '',
        disallowedContent: 'img{width,height,float}',
        extraAllowedContent: 'img[width,height,align]',
        // Enabling extra plugins, available in the full-all preset: http://ckeditor.com/presets-all
        extraPlugins: 'tableresize,uploadimage,uploadfile,embed,autoembed',
        height:600,
        contentsCss: [ 'https://cdn.ckeditor.com/4.6.2/full-all/contents.css', '/appx/ipage/ckeditor/editors/article-editor/mystyles.css' ],

        // This is optional, but will let us define multiple different styles for multiple editors using the same CSS file.
        bodyClass: 'document-editor'
</script>

我尝试加载ckeditor.js本地,但后来出现了图标错误。

任何想法?

由于

1 个答案:

答案 0 :(得分:-1)

第1步。

config.extraPlugins = 'youtube';

步骤2将图标添加到工具栏:

config.toolbar = [{ name: 'insert', items: ['Image', 'Youtube']}];

第3步:配置

config.youtube_width = '640';

config.youtube_height = '480';

config.youtube_related = true;

config.youtube_older = false;