Answer the question
In order to leave comments, you need to log in
How to add plugin in ckeditor from 2amigos in Yii2?
There is a plugin from 2amigos
https://github.com/2amigos/yii2-ckeditor-widget
Excellent use of
echo $form->field($model, $k)->textarea($model['fldArr'][$k][ 'options'])->widget(CKEditor::className(), [
'options' => [
'rows' => 3,
], ...
I want to inject plugin into it ckeditor.com/addon/fontawesome
Failed = )
Tried many options, does not work.
Please write at least approximate instructions 1,2,3
Thank you in advance!
-----------------------
PS
I did the following
1) I downloaded the plugin from the site - ckeditor.com/addon/fontawesome
2) Uploaded it to \vendor\2amigos\yii2-ckeditor-widget\src\assets\ckeditor\plugins
3) In the form template I wrote
echo $form->field($model, $k)->textarea($model[ 'fldArr'][$k]['options'])->widget(CKEditor::className(), [
'options' => [
'rows' => 3,
],
'clientOptions' => [
'config. extraPlugins' => 'fontawesome',
'config.contentsCss' => 'path/to/your/font-awesome.css',
'config.allowedContent' => true,
'resize_enabled' => true,
'allowedContent' => true,
'contentsCss' => '/_protected/vendor/2amigos/yii2-ckeditor-widget/src/assets/ckeditor/plugins/fontawesome/font-awesome/css/font-awesome.min.css',
'removeEmpty' => [
'span' => false ,
],
...
'presets' => 'full',
4) In C:\OpenServer\domains\jullycms\_protected\vendor\2amigos\yii2-ckeditor-widget\src\presets\full.php added
['name' => 'insert', 'items' => [ 'FontAwesome', 'Source' ]
Result - everything is broken))
Answer the question
In order to leave comments, you need to log in
If anyone is interested, you can solve it in an ABSOLUTELY simpler way))))
Everything is like on the official website for CKEditor.
Drop your plugin into the vendor/ckeditor/ckeditor/plugins folder.
And then include the main plugin file where you need it, like this:
And in the display itself, like this:
<?= $form->field($model, 'content')->widget(CKEditor::className(), [
'preset' => 'custom',
'options' => ['rows' => 15],
'clientOptions' => [
'extraPlugins' => 'pbckcode',
'toolbarGroups' => [
['name' => 'undo'],
['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']],
['name' => 'colors'],
['name' => 'links', 'groups' => ['links', 'insert']],
['name' => 'others', 'groups' => ['others', 'about']],
//['name' => 'youtube'], // <--- OUR NEW PLUGIN YAY!
['name' => 'pbckcode']
]
],
]) ?>
Everything is solved quite simply without unnecessary gestures:
In the form view, specify:
<?php echo $form->field($model, 'description')->widget(CKEditor::className(), [
'options' => ['rows' => 6],
'preset' => 'full',
'clientOptions' => [
'extraPlugins' => 'widgetbootstrap',
]
]) ?>
<?php
$this->registerJs("CKEDITOR.plugins.addExternal('widgetbootstrap', '/js/widgetbootstrap/', 'plugin.js');");
1) Asset
Don't do this
Everything is only through composer. It is forbidden to change something in the vendor folder according to the unspoken rule.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question