Laravel 5中的CKEditor 4在工具栏中未显示iFrame图标

时间:2018-10-29 12:50:33

标签: laravel laravel-5 ckeditor

我在Laravel 5项目中使用CkEditor。

bower_component/ckeditor/下的config.js中,我使用了以下代码:

CKEDITOR.editorConfig = function (config) {
    // Define changes to default configuration here.
    // For complete reference see:
    // http://docs.ckeditor.com/#!/api/CKEDITOR.config

    // The toolbar groups arrangement, optimized for two toolbar rows.
    config.toolbarGroups = [
        {name: 'clipboard', groups: ['clipboard', 'undo']},
        {name: 'editing', groups: ['find', 'selection', 'spellchecker']},
        {name: 'links'},
        {name: 'insert'},
        {name: 'forms'},
        {name: 'tools'},
        {name: 'document', groups: ['mode', 'document', 'doctools']},
        {name: 'others'},
        '/',
        {name: 'basicstyles', groups: ['basicstyles', 'cleanup']},
        {name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi']},
        {name: 'styles'},
        {name: 'colors'},
        {name: 'about'}
    ];

    // Remove some buttons provided by the standard plugins, which are
    // not needed in the Standard(s) toolbar.
    config.removeButtons = 'Underline,Subscript,Superscript';

    // Set the most common block elements.
    config.format_tags = 'p;h1;h2;h3;pre';

    // Simplify the dialog windows.
    config.removeDialogTabs = 'image:advanced;link:advanced';

    config.FormatOutput = false;

    config.allowedContent = true;
};

此外,在相关页面的js中,我使用了以下代码:

$(function () {

    CKEDITOR.replace('editor2', {
        allowedContent: true,
    });
});

在HTML中,我使用了以下代码:

<textarea name="content" rows="10" cols="80" id="editor2"></textarea>

plugins下的bower_component/ckeditor/plugins文件夹中,我看到“ iframe”文件夹存在。但是,我在ckeditot工具栏中看不到iframe图标。如上所述,我将“ allowedContent”配置为true。这是屏幕抓取:

enter image description here

出了什么问题?

1 个答案:

答案 0 :(得分:0)

我找到了解决方法。

打开config.js下的bower_component/ckeditor并编写以下代码:

config.extraPlugins = 'iframe';

瞧!您将在ckeditor工具栏上看到iframe图标。