puzzle9/dact-admin-wang-editor

WangEditor extension for dcat-admin

0.03 2020-09-17 13:49 UTC

This package is auto-updated.

Last update: 2024-04-18 21:21:04 UTC


README

注: 使用此扩展将会导致 /admin/helpers/extensions 打开报错 因 配置文件不是 key / value 格式

WangEditor 4.x 版本编辑器

http://www.wangeditor.com/doc/

安装

composer require puzzle9/dact-admin-wang-editor
php artisan admin:import dact-admin-wang-editor

config/admin-extensions.php

    'extensions' => [
        'dact-admin-wang-editor' => [
            'enable' => true,
            // 储存 disk
            'disk' => 'public',
            // http://www.wangeditor.com/doc/pages/03-配置菜单/
            'config' => [
                // 设置默认 zIndex
                'zIndex' => 1,
                // 粘贴样式的过滤
                'pasteFilterStyle' => true,
                // 粘贴内容中的图片
                'pasteIgnoreImg' => true,
                // 上传图片大小
                'uploadImgMaxSize' => 5 * 1024 * 1024, // 2M
                // 一次最多能传几张图片
                'uploadImgMaxLength' => 5,
                // 插入网络图片的功能
                'showLinkImg' => false,
                // 菜单
                'menus' => [
                    'head',
                    'bold',
                    'customFontSize',
                    'fontName',
                    'italic',
                    'underline',
                    'strikeThrough',
                    'indent',
                    'lineHeight',
                    'foreColor',
                    'backColor',
                    // 'link',
                    'list',
                    'justify',
                    // 'quote',
                    // 'emoticon',
                    'image',
                    // 'video',
                    // 'table',
                    // 'code',
                    'splitLine',
                    'undo',
                    'redo',
                ],
            ],
        ],
    ],

使用

基本使用

$form->editor('content')->height(500)->required();

修改编辑器高度

$form->editor('content')->height(500);

修改编辑器zIndex

$form->editor('content')->zIndex(1);