Procházet zdrojové kódy

富文本加设置行高功能

zq před 2 týdny
rodič
revize
02d1677d50
1 změnil soubory, kde provedl 4 přidání a 4 odebrání
  1. 4 4
      src/components/RichText.vue

+ 4 - 4
src/components/RichText.vue

@@ -91,7 +91,7 @@ export default {
       type: [String, Boolean],
       /* eslint-disable max-len */
       default:
-        'fontselect fontsizeselect forecolor backcolor | underline | bold italic strikethrough alignleft aligncenter alignright | bullist numlist | image media | link blockquote hr mathjax',
+        'fontselect fontsizeselect forecolor backcolor | lineheight underline | bold italic strikethrough alignleft aligncenter alignright | bullist numlist | image media | link blockquote hr mathjax',
     },
     wordlimitNum: {
       type: [Number, Boolean],
@@ -139,11 +139,10 @@ export default {
       id: getRandomNumber(),
       init: {
         content_style: `
-          p{line-height: 1;}
           mjx-container, mjx-container * {
             font-size: 16px !important; /* 强制固定字体 */
             line-height: 1.2 !important; /* 避免行高影响 */
-          } `, // 解决公式每点击一次字体就变大
+          }`, // 解决公式每点击一次字体就变大
         valid_elements: '*[*]', // 允许所有标签和属性
         valid_children: '+body[style]', // 允许 MathJax 的样式
         extended_valid_elements: 'span[*],mjx-container[*],svg[*],path[*]', // 明确允许 MathJax 标签
@@ -157,8 +156,9 @@ export default {
         min_height: this.height,
         width: '100%',
         autoresize_bottom_margin: 0,
-        plugins: 'link lists image hr media autoresize ax_wordlimit paste',
+        plugins: 'link lists image hr media autoresize ax_wordlimit paste lineheight',
         toolbar: this.toolbar, // 工具栏
+        lineheight_formats: '0.5 1.0 1.2 1.5 2.0 2.5 3.0', // 行高选项(倍数)
         contextmenu: false, // 右键菜单
         menubar: false, // 菜单栏
         branding: false, // 品牌