xindong888 / yii2ueditor
百度HTML编辑器
v1.2.1
2021-02-17 11:45 UTC
This package is auto-updated.
Last update: 2024-09-17 19:44:22 UTC
README
功能说明
文本输入、图片上传、图片在线管理、涂鸦、视频上传等功能均可完美使用
使用说明
在控制器中添加如下代码
class PostsController extends Controller { public function actions() { return [ 'yii2editor'=>[ 'class'=>UEditorActionX::className(), 'config'=>[ 'imagePathFormat'=>'/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}', //'imageManagerUrlPrefix'=>'https://',//前缀,主要是为了前台访问的 'imageManagerListPath'=>Yii::getAlias('@web').'/upload/image/'//这个是必填的,显示图片列表 ] ] ]; } }
在视图表单中添加
<?php $form = ActiveForm::begin(); ?> <?= $form->field($model, 'content')->widget(\yii2ueditor\UEditorX::className()) ?> <div class="form-group"> <?= Html::submitButton(Yii::t('common', 'Posted'), ['class' => 'btn btn-primary']) ?> </div> <?php ActiveForm::end(); ?>