xindong888/yii2ueditor

百度html编辑

Installs: 12

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

v1.2.1 2021-02-17 11:45 UTC

This package is auto-updated.

Last update: 2024-04-17 18:51:13 UTC


README

功能说明:

文本输入,图片上传,图片在线管理,涂鸦,视频上传等都可以完美使用 image

使用说明:

在控制器内他添加如下代码:

class PostsController extends Controller
{
    public function actions()
    {
        return [
            'yii2editor'=>[
                'class'=>UEditorActionX::className(),
                'config'=>[
                    'imagePathFormat'=>'/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}',
                    //'imageManagerUrlPrefix'=>'http://localhost',//前缀,主要是为了前台访问的
                    '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(); ?>