PHP code example of potime / yii2-wang-editor

1. Go to this page and download the library: Download potime/yii2-wang-editor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

potime / yii2-wang-editor example snippets



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',
    // ],
]);



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',
            ],
        ];
    }
}