fastadmin Tinymce编辑器配置首行缩进

记录:使用fastadmin 的免费插件Tinymce富文本编辑器时,设置首行缩进。

一、找到插件js位置并打开

文件位置:addons\tinymce\bootstrap.js,bootstrapBase.js

二、找到初始化编辑器部分代码,进行自定义配置段落样式

在这里插入图片描述
代码如下:

                        style_formats: [
                            //新增 首行缩进与行高 配置
                            {
                                title: '首行缩进',
                                block: 'p',
                                styles: {
                                    'text-indent': '2em'
                                }
                            },
                            {
                                title: '行高',
                                items: [{
                                        title: '1',
                                        styles: {
                                            'line-height': '1'
                                        },
                                        inline: 'span'
                                    },
                                    {
                                        title: '1.5',
                                        styles: {
                                            'line-height': '1.5'
                                        },
                                        inline: 'span'
                                    },
                                    {
                                        title: '2',
                                        styles: {
                                            'line-height': '2'
                                        },
                                        inline: 'span'
                                    },
                                    {
                                        title: '2.5',
                                        styles: {
                                            'line-height': '2.5'
                                        },
                                        inline: 'span'
                                    },
                                    {
                                        title: '3',
                                        styles: {
                                            'line-height': '3'
                                        },
                                        inline: 'span'
                                    }
                                ]
                            },
                            //默认的配置
                            {
                                title: 'Headings',
                                items: [
                                  {
                                    title: 'Heading 1',
                                    format: 'h1'
                                  },
                                  {
                                    title: 'Heading 2',
                                    format: 'h2'
                                  },
                                  {
                                    title: 'Heading 3',
                                    format: 'h3'
                                  },
                                  {
                                    title: 'Heading 4',
                                    format: 'h4'
                                  },
                                  {
                                    title: 'Heading 5',
                                    format: 'h5'
                                  },
                                  {
                                    title: 'Heading 6',
                                    format: 'h6'
                                  }
                                ]
                            },
                            {
                                title: 'Inline',
                                items: [
                                  {
                                    title: 'Bold',
                                    icon: 'bold',
                                    format: 'bold'
                                  },
                                  {
                                    title: 'Italic',
                                    icon: 'italic',
                                    format: 'italic'
                                  },
                                  {
                                    title: 'Underline',
                                    icon: 'underline',
                                    format: 'underline'
                                  },
                                  {
                                    title: 'Strikethrough',
                                    icon: 'strikethrough',
                                    format: 'strikethrough'
                                  },
                                  {
                                    title: 'Superscript',
                                    icon: 'superscript',
                                    format: 'superscript'
                                  },
                                  {
                                    title: 'Subscript',
                                    icon: 'subscript',
                                    format: 'subscript'
                                  },
                                  {
                                    title: 'Code',
                                    icon: 'code',
                                    format: 'code'
                                  }
                                ]
                            },
                            {
                                title: 'Blocks',
                                items: [
                                  {
                                    title: 'Paragraph',
                                    format: 'p'
                                  },
                                  {
                                    title: 'Blockquote',
                                    format: 'blockquote'
                                  },
                                  {
                                    title: 'Div',
                                    format: 'div'
                                  },
                                  {
                                    title: 'Pre',
                                    format: 'pre'
                                  }
                                ]
                            },
                            {
                                title: 'Alignment',
                                items: [
                                  {
                                    title: 'Left',
                                    icon: 'alignleft',
                                    format: 'alignleft'
                                  },
                                  {
                                    title: 'Center',
                                    icon: 'aligncenter',
                                    format: 'aligncenter'
                                  },
                                  {
                                    title: 'Right',
                                    icon: 'alignright',
                                    format: 'alignright'
                                  },
                                  {
                                    title: 'Justify',
                                    icon: 'alignjustify',
                                    format: 'alignjustify'
                                  }
                                ]
                            }
                        ],
三、清空缓存,即可测试效果。

效果如下:
在这里插入图片描述

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值