mirocow / yii2-redactor
Yii2 框架的 redactor 扩展。
dev-master
2015-08-19 15:10 UTC
Requires
- php: >=5.3.0
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-09-14 18:31:27 UTC
README
安装
安装此扩展的首选方法是使用 composer。
添加 github 仓库
"repositories": [ { "type": "git", "url": "https://github.com/mirocow/yii2-redactor.git" } ]
然后
php composer.phar require --prefer-dist "mirocow/yii2-redactor" "*"
或者添加
"mirocow/yii2-redactor" : "*"
到应用程序的 composer.json
文件的 require 部分中。
配置
'components' => [ 'redactor' => [ 'class' => 'yii\redactor\RedactorModule' ], ]
使用
use yii\redactor\widgets\Redactor; <?= Redactor::widget( [ 'model' => $model, 'attribute' => 'description', 'options' => [ 'style' => 'width: 100%; height: 340px;', ], 'clientOptions' => [ 'imageManagerJson' => \yii\helpers\Html::url('/redactor/upload/imagejson'), 'imageUpload' => \yii\helpers\Html::url('/redactor/upload/image'), 'fileUpload' => \yii\helpers\Html::url('/redactor/upload/file'), 'lang' => 'en', 'plugins' => ['fontcolor', 'filemanager', 'imagemanager', 'table', 'undoredo'], 'placeholder' => 'Please add description', ], ] ); ?>