jodit/yii2-jodit
最新稳定版本:1.1.8
Composer 安装命令:
composer require jodit/yii2-jodit
包简介
Jodit - awesome WYSIWYG Editor like widget for Yii2
关键字:
README 文档
README
Jodit widget for Yii2
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist jodit/yii2-jodit "*"
or
composer require --prefer-dist jodit/yii2-jodit
or add
"jodit/yii2-jodit": "*"
to the require section of your composer.json file.
Configure
Add to config file (config/web.php or common\config\main.php)
'modules' => [ 'jodit' => 'yii2jodit\JoditModule', ],
or if you want to change the upload directory. to path/to/uploadfolder default value @webroot/uploads
'modules' => [ 'jodit' => [ 'class' => 'yii2jodit\JoditModule', 'extensions'=>['jpg','png','gif'], 'root'=> '@webroot/uploads/', 'baseurl'=> '@web/uploads/', 'maxFileSize'=> '20mb', 'defaultPermission'=> 0775, ], ],
note: You need to create uploads folder and chmod and set security for folder upload reference:Protect Your Uploads Folder with
.htaccess, []How to Setup Secure Media Uploads](http://digwp.com/2012/09/secure-media-uploads/)
Usage
Once the extension is installed, simply use it in your code by :
<?=$form->field($model, 'content')->widget(\yii2jodit\JoditWidget::className(), [ 'settings' => [ 'buttons'=>[ 'bold', 'italic', 'underline', '|', 'ul', 'ol', '|', 'image', '|', 'hr', ], ], ]);?>
or not use ActiveField
<?= \yii2jodit\JoditWidget::widget([ 'model' => $model, 'attribute' => 'content' ]) ?>
Image uploader
editors config:
<?=$form->field($model, 'content')->widget(\yii2jodit\JoditWidget::className(), [ 'settings' => [ 'height'=>'250px', 'enableDragAndDropFileToEditor'=>new \yii\web\JsExpression("true"), ], ]);?>
Icon Picker
<?=$form->field($model, 'icon')->widget(\yii2jodit\JoditIconPickerWidget::className(), [ "path" => 'wp-content/plugins/exchangers-monitor/images/systemlogo' ]);?>
License
This package is available under MIT License.
统计信息
- 总下载量: 21.28k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 16
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-01-21