potime/yii2-wang-editor

WangEditor widget for Yii 2.0 Framework

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

v1.0.0 2021-06-08 09:55 UTC

This package is auto-updated.

Last update: 2024-05-08 16:48:58 UTC


README

Only supports wangEditor v3.0

wangEditor 官网

安装

composer require potime/yii2-wang-editor "^1.0.0"

使用

widget

<?php
use potime\wangEditor\widgets\WangEditorWidget;

echo WangEditorWidget::widget([
    'name' => 'inputName',
    // 'canFullScreen' => true, // 增加全屏的按钮
    // 'customConfig' => [], // 扩展配置
]);

// or

echo $form->field($model, 'content')->widget(WangEditorWidget::class, [
    // 'canFullScreen' => true,
    // 'uploadImageServer' => [
    //     '/file/wang-editor',
    // ],
]);

action

<?php

namespace admin\controllers;

use yii\web\Controller;
use potime\wangEditor\actions\UploadAction;

class FileController extends Controller
{
    public function actions()
    {
        return [
            'wang-editor' => [
                'class' => UploadAction::class,
                'savePath' => '@webroot/uploads',
                'displayPath' => '@web/uploads',
            ],
        ];
    }
}