Custom plugins yii2 ckeditor

I use 2migos ckeditor plugins in yii2, I was able to create an example of plugins from plugin_sdk_sample , it works fine in a raw project, but when I put this in a yii2 project, the button does not appear.

I put the custom plugin in \ vendor \ 2amigos \ yii2-ckeditor-widget \ src \ assets \ ckeditor \ plugins \ using plugin.js and the png icon with the folder structure as described in the manual. I think the problem is 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:

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

but none of them work and show a button, what am I doing wrong here?

+5
source share
3 answers

I think you need to add plugin.js to the script list in

 class CKEditorAsset extends AssetBundle { public $js = [ 'ckeditor.js', 'plugin.js', 'adapters/jquery.js' ]; 
+2
source
 <?= $form->field($model, 'content')->widget(CKEditor::className(), [ 'options' => ['rows' => 6], 'preset' => 'full', 'clientOptions' => [ 'extraPlugins'=> 'timestamp', ] ]) ?> 
0
source

You can also customize the yii2 plugin toolbars as indicated in the following URL -

dosamigos \ ckeditor \ CKEditor custom toolbar

0
source

Source: https://habr.com/ru/post/1233214/


All Articles