xutl/yii2-summernote-widget

This package is abandoned and no longer maintained. The author suggests using the yuncms/yii2-summernote-widget package instead.

The summer note extension for the Yii framework

Installs: 8 999

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 4

Open Issues: 0

Language:JavaScript

Type:yii2-extension

1.0.4 2017-09-18 08:04 UTC

This package is auto-updated.

Last update: 2022-02-01 13:02:19 UTC


README

适用于YII2的一个富文本编辑器

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist xutl/yii2-summernote-widget

or add

"xutl/yii2-summernote-widget": "~1.0.0"

to the require section of your composer.json.

使用

<?php

namespace app\controllers;

use Yii;
use yii\web\Controller;
use xutl\summernote\SummerNoteAction;
class MyController extends Controller
{
    public function actions()
    {
        return [
            'sn-upload' => [
                'class' => SummerNoteAction::className(),
                'onComplete' => function ($filename, $params) {
                    // Do something with file
                    //返回图像的Url地址
                }
            ],
        ];
    }
}

widget:

use xutl\summernote\SummerNote;

<?= $form->field($model, 'description')->widget(SummerNote::className(), [
    'uploadUrl'=>'/file/sn-upload'
]);?>