jodit / yii2-jodit
Jodit - 优秀的 Yii2 WYSIWYG 编辑器小部件
1.1.8
2018-02-26 08:49 UTC
Requires
- jodit/application: ^2.0.11
- xdan/jodit: ^3.1.0
- yiisoft/yii2: ^2.0
- dev-master
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.0.41
- 1.0.40
- 1.0.39
- 1.0.38
- 1.0.37
- 1.0.36
- 1.0.35
- 1.0.34
- 1.0.33
- 1.0.32
- 1.0.31
- 1.0.30
- 1.0.29
- 1.0.28
- 1.0.27
- 1.0.26
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.5
- 1.0.4
- 1.0.2
- 1.0.1
- 1.0.0
This package is not auto-updated.
Last update: 2024-09-17 10:31:29 UTC
README
Jodit 小部件用于 Yii2
安装
安装此扩展的首选方式是通过 composer。
运行
php composer.phar require --prefer-dist jodit/yii2-jodit "*"
或
composer require --prefer-dist jodit/yii2-jodit
或添加
"jodit/yii2-jodit": "*"
到您的 composer.json
文件的 require 部分。
配置
添加到配置文件 (config/web.php 或 common\config\main.php)
'modules' => [ 'jodit' => 'yii2jodit\JoditModule', ],
或如果您想更改上传目录,请将其设置为 path/to/uploadfolder 默认值 @webroot/uploads
'modules' => [ 'jodit' => [ 'class' => 'yii2jodit\JoditModule', 'extensions'=>['jpg','png','gif'], 'root'=> '@webroot/uploads/', 'baseurl'=> '@web/uploads/', 'maxFileSize'=> '20mb', 'defaultPermission'=> 0775, ], ],
注意:您需要创建上传文件夹并设置文件夹上传的权限和安全设置,参考:使用
.htaccess
保护上传文件夹,[如何设置安全的媒体上传](http://digwp.com/2012/09/secure-media-uploads/)
使用
一旦安装了扩展,只需在您的代码中使用它即可
<?=$form->field($model, 'content')->widget(\yii2jodit\JoditWidget::className(), [ 'settings' => [ 'buttons'=>[ 'bold', 'italic', 'underline', '|', 'ul', 'ol', '|', 'image', '|', 'hr', ], ], ]);?>
或不使用 ActiveField
<?= \yii2jodit\JoditWidget::widget([ 'model' => $model, 'attribute' => 'content' ]) ?>
图片上传器
编辑器配置
<?=$form->field($model, 'content')->widget(\yii2jodit\JoditWidget::className(), [ 'settings' => [ 'height'=>'250px', 'enableDragAndDropFileToEditor'=>new \yii\web\JsExpression("true"), ], ]);?>
图标选择器
<?=$form->field($model, 'icon')->widget(\yii2jodit\JoditIconPickerWidget::className(), [ "path" => 'wp-content/plugins/exchangers-monitor/images/systemlogo' ]);?>
许可证
本软件包在 MIT
许可证下可用。