firdows / yii2-mkeditor
CKEditor and KCFinder
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 1
Type:yii2-extension
Requires
This package is auto-updated.
Last update: 2024-10-23 16:01:37 UTC
README
CKEditor and KCFinder Mkeditor
CKEditor and KCFinder
Installation
The preferred way to install this extension is through composer.
Either run
composer require firdows/yii2-mkeditor "*"
or add
"firdows/yii2-mkeditor": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
Convert textarea to CKEditor
<?php //CKEditor echo $form->field($model, 'detail')->widget( \firdows\mkeditor\CKEditor::className(), [ 'uploadDir' => '/var/www/public_html/UserFiles', 'uploadURL' => '/UserFiles/', 'filemanager'=>true, //true = enabled kcfinder, false = disabled kcfinder 'preset'=>'full' //toolbar -> basic, standard, full ] )->label(false); ?>
Usage with On Change
<?php $this->registerJs(" var content = ''; CKEDITOR.on('instanceCreated', function (e) { content = e.editor.getData(); e.editor.on('change', function (ev) { content = ev.editor.getData(); }); }); "); ?> <?php //CKEditor echo $form->field($model, 'detail')->widget( \firdows\mkeditor\CKEditor::className(), [ 'uploadDir' => '/var/www/public_html/UserFiles', 'uploadURL' => '/UserFiles/', 'filemanager'=>true, //true = enabled kcfinder, false = disabled kcfinder 'preset'=>'full', //toolbar -> basic, standard, full 'onChange' => true ] )->label(false); ?>
Example
<img src="http://ikhlasservice.com/uploads/capture/Update Article.png"width="400"/>