Tinymce 4富文本设置行高

由于是Tinymce 4 对于line height 这个插件不支持,只要版本5以上才可以,所以只能通过重新style的方法去实现,

添加 toolbar  styleselect

重写 style,添加设置
​​​​​​​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,

style_formats_merge此选项使您可以设置TinyMCE是将style_formats设置中的样式附加到默认样式格式还是完全替换它们。

true为附加

style_formats_autohide(隐藏当前不可用的样式列表)

 

你可能感兴趣的:(tinymce,tinymce)