Tinymce富文本设置行高

文章借鉴:https://blog.csdn.net/weixin_44446659/article/details/108142808

官方文档:http://tinymce.ax-z.cn/more-plugins/lineheight.php

前言:项目中有这个需求,然后找到了另外的方法,记录一下

Tinymce 版本5可实现对lineheight的设置

在toolbar中添加属性 styleselect

在初始化init方法中添加:

style_formats: [

    {

            title: "Line Height",

            items: [

              { title: "1", block: "p", styles: { "line-height": "1.0" } },

              { title: "1.5", block: "p", styles: { "line-height": "1.5" } },

              { title: "1.75", block: "p", styles: { "line-height": "1.75" } },

              { title: "2", block: "p", styles: { "line-height": "2" } },

              { title: "3", block: "p", styles: { "line-height": "3" } },

              { title: "4", block: "p", styles: { "line-height": "4" } },

              { title: "5", block: "p", styles: { "line-height": "5" } }

            ]

          }

        ],

        style_formats_merge: true, //设置行高

        style_formats_autohide: true //设置行高

如图:

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。