PHP code example of jianhuawang / wangeditor

1. Go to this page and download the library: Download jianhuawang/wangeditor 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/ */

    

jianhuawang / wangeditor example snippets



return [
    'mode'=> 'default',// 'simple',

    'MENU_CONF'       => [
        'uploadImage' => [
            'server'           => '/admin/wangeditor/uploadImage',
            'fieldName'        => 'image',
            'maxNumberOfFiles' => 10,
            'allowedFileTypes' => ['image/*'],
            'headers'          => ['X-CSRF-TOKEN' => ''],
            'withCredentials'  => false,
            'maxFileSize'      => 10 * 1024 * 1024, // 默认 10M
        ],
        'uploadVideo' => [
            'server'           => '/admin/wangeditor/uploadVideo',
            'fieldName'        => 'video',
            'maxNumberOfFiles' => 5, // 默认 5
            'allowedFileTypes' => ['video/*'],
            'headers'          => ['X-CSRF-TOKEN' => ''],
            'withCredentials'  => false,
            'maxFileSize'      => 10 * 1024 * 1024, // 10M
        ],
    ],
];


'extensions' => [
    'wangeditor' => [
        'enable' => true,
        'disk'   => 'admin', // config/filesystems.php中的disk
        // 加载编辑器的配置
        'config' => 


Encore\Admin\Form::extend('weditor', Encore\Wang\Editor\Editor::class);


    protected function form()
    {

         $form = new Form(new User);

         $form->weditor('profile', '介绍');

        return $form;
    }

shell
php artisan vendor:publish --provider=Encore\Wang\Editor\EditorServiceProvider --tag=wangeditor