Reputation: 357
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?
Upvotes: 5
Views: 2689
Reputation: 21
<?= $form->field($model, 'content')->widget(CKEditor::className(), [
'options' => ['rows' => 6],
'preset' => 'custom',
'clientOptions' => [
'extraPlugins' => 'timestamp',
]
]) ?>
Upvotes: 0
Reputation: 1
I tried this in the file "vendor/2amigos/yii2-ckeditor-widget/src/CKEditorAsset.php"
public $sourcePath = '@bower/adminlte/plugins/ckeditor';
Upvotes: -1
Reputation: 990
You can also customize the yii2 plugin toolbars like mentioned in below url-
dosamigos\ckeditor\CKEditor custom toolbar
Upvotes: 0
Reputation: 5207
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'
];
Upvotes: 2