在yii2中将oembed插件添加到2amigos ckeditor小部件

时间:2015-07-21 04:32:12

标签: php ckeditor yii2 oembed

我正在尝试通过2amigos小部件为yii2添加oembed插件到ckeditor。

我做了以下操作,但似乎无法显示按钮:

  1. 我将oembed和widget插件下载并复制到ckeditor插件文件夹
  2. 我使用下面的代码在表单中设置widget的clientOptions:

    $form->field($theComment, 'comment')->widget(CKEditor::className(), [
        'clientOptions' => ['config.extraPlugins' => 'widget,oembed'],
        'options' => ['rows' => 6],
        'preset' => 'full'
    ])
    
  3. 我通过在下面添加以下代码行来修改full.php预设filworkinge:

    'toolbarGroups' => [
        ['name' => 'document', 'groups' => ['mode', 'document', 'doctools']],
        ['name' => 'clipboard', 'groups' => ['clipboard', 'undo']],
        ['name' => 'editing', 'groups' => [ 'find', 'selection', 'spellchecker']],
        ['name' => 'forms'],
        '/',
        ['name' => 'basicstyles', 'groups' => ['basicstyles', 'colors','cleanup']],
        ['name' => 'paragraph', 'groups' => [ 'list', 'indent', 'blocks', 'align', 'bidi' ]],
        ['name' => 'links'],
        ['name' => 'insert'],
        '/',
        ['name' => 'styles'],
        ['name' => 'blocks'],
        ['name' => 'colors'],
        ['name' => 'tools'],
        ['name' => 'others'],
        '/',            //added by me
        ['name' => 'oembed'],   //added by me
    ],
    
  4. 不完全确定错误是在我对clientOptions的编辑中,还是在我对toolbarGroups的编辑中,或者两者兼而有之!任何关于我做错事的想法都将不胜感激。

    谢谢!

1 个答案:

答案 0 :(得分:0)

插件添加资产文件夹(示例插件剧透)zarnica.dev \ www \ assets \ dff59c5c \ plugins \ spoiler

<script>CKEDITOR.config.extraPlugins = 'spoiler';</script>

DONE!