dcat-admin 配置富文本参数 TinyMCE配置

本文详细介绍了如何配置TinyMCE编辑器,包括设置默认参数、自定义工具栏、字体大小和插件选择。通过示例代码展示了如何在`bootstrap.php`中引入并设置Editor类,以实现特定的编辑器功能,如字号、行距、隐藏版权等。此外,还列出了可选的插件和工具栏选项,帮助开发者根据需求定制富文本编辑体验。
摘要由CSDN通过智能技术生成

中文配置参数地址:http://tinymce.ax-z.cn/

配置路径:app/Admin/bootstrap.php

use Dcat\Admin\Form\Field\Editor; //引入

Editor::resolving(function (Editor $editor) {
    // 设置默认配置
    $editor->options([
        // 'plugins' => [ # 自定义插件
        //     'print', 'preview', 'searchreplace', 'autolink', 'directionality',
        //     'visualblocks', 'visualchars', 'fullscreen', 'image', 'link', 'media', 'template', 'code',
        //     'codesample',
        //     'table', 'charmap', 'hr', 'pagebreak', 'nonbreaking', 'anchor', 'insertdatetime',
        //     'advlist', 'lists', 'wordcount', 'imagetools', 'textpattern', 'help', 'emoticons',
        //     'autosave', 'bdmap', 'indent2em', 'autoresize', 'formatpainter', 'axupimgs',
        //     'importword',
        // ],
        'content_style' => "body {font-size:14px;line-height:1}", // 默认字号、行距
        'branding' => false, // 隐藏版权
        'fontsize_formats' => '11px 12px 14px 16px 18px 24px 36px 48px', // 可选字号
        'toolbar' => [ # 自定义工具栏
            'code undo redo restoredraft | cut copy paste pastetext | forecolor backcolor
bold italic underline strikethrough link anchor | alignleft aligncenter alignright alignjustify outdent indent | styleselect formatselect fontselect fontsizeselect
| bullist numlist | blockquote subscript superscript removeformat | \
 table image media charmap emoticons hr pagebreak insertdatetime print preview |
fullscreen | bdmap indent2em lineheight formatpainter axupimgs importword',
        ],
    ]);
});

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值