worstinme / yii2-jodit
Yii2 jodit editor Extension
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 301
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- bower-asset/jodit: >=2.3
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2019-11-11 02:55:41 UTC
README
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist worstinme/yii2-jodit "*"
or
composer require --prefer-dist worstinme/yii2-jodit
or add
"worstinme/yii2-jodit": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
<?=$form->field($model, 'content')->widget(\worstinme\jodit\Editor::className(), [ 'settings' => [ 'buttons'=>[ 'bold', 'italic', 'underline', '|', 'ul', 'ol', '|', 'image', '|', 'hr', ], ], ]);?>
Image uploader
add uploader action to controller:
public function actions() { return [ 'upload-image' => [ 'class' => 'worstinme\jodit\UploadAction', 'folder'=>Yii::getAlias('@webroot/uploads'), 'webroot'=>Yii::getAlias('@webroot'), ], ]; }
editors config:
<?=$form->field($model, 'content')->widget(\worstinme\jodit\Editor::className(), [ 'settings' => [ 'height'=>'250px', 'enableDragAndDropFileToEditor'=>new \yii\web\JsExpression("true"), 'uploader'=>[ 'url'=>\yii\helpers\Url::to(['upload-image']), 'data'=> [ '_csrf'=> Yii::$app->request->csrfToken, ], ], ], ]);?>