Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yii2 ckeditor custom plugins

Tags:

ckeditor

yii2

I'm using 2amigos ckeditor plugins in yii2, I was able to create a sample plugins from plugin_sdk_sample, it works fine in a raw project, but when I put that in a yii2 project, the button doesn't appear.

I put the custom plugin in \vendor\2amigos\yii2-ckeditor-widget\src\assets\ckeditor\plugins\ with plugin.js and png icon with the folder structure as described in the guide. I think the problem is with adding it to config.

I tried following in vendor\2amigos\yii2-ckeditor-widget\src\assets\ckeditor\config.js

CKEDITOR.editorConfig = function( config ) {
    config.extraPlugins = 'timestamp';
};

also tried the following in view:

<?= $form->field($model, 'content')->widget(CKEditor::className(), [
                        'clientOptions' => ['config.extraPlugins' => 'timestamp'],
                        'options' => ['rows' => 6],
                        'preset' => 'basic'
                    ]) ?>

but none of them seems to work and showing the button, what am I doing wrong here?

like image 596
Pingu Kutu Avatar asked Nov 09 '22 03:11

Pingu Kutu


1 Answers

I think you have to add plugin.js into the list of script in

class CKEditorAsset extends AssetBundle
{
    public $js = [
        'ckeditor.js',
        'plugin.js',
        'adapters/jquery.js'
    ];
like image 197
Sergey Avatar answered Dec 25 '22 09:12

Sergey