xutl/yii2-umeditor-widget

The umeditor extension for the Yii framework

Installs: 124

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

Type:yii2-extension

1.0.3 2017-02-16 08:02 UTC

This package is auto-updated.

Last update: 2024-10-11 02:21:24 UTC


README

适用于Yii2的UMeditor

使用

<?php

namespace app\controllers;

use Yii;
use yii\web\Controller;

class MyController extends Controller
{
    public function actions()
    {
        return [
            'um-upload' => [
                'class' => 'xutl\umeditor\UMeditorAction',
                'onComplete' => function ($filename, $params) {
                    // Do something with file
                    //返回图像的Url地址
                }
            ],
        ];
    }
}

widget:

use yii\helpers\Url;
use xutl\umeditor\UMeditor;

<?= $form->field($model, 'description')->widget(UMeditor::className(), [
    'clientOptions'=>[
        'imageUrl'=> Url::to(['um-upload'])
    ]
]);?>