shaogen1995 1 年之前
父節點
當前提交
8531b14fec
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      src/components/ZRichTexts/index.tsx

+ 5 - 4
src/components/ZRichTexts/index.tsx

@@ -65,17 +65,18 @@ function ZRichTexts(
     // 不是按章节发布,检查第一个富文本
     if (!isSection) {
       const txt = sectionArr[0].txt.toHTML()
-      if (txt.replaceAll('<p>', '').replaceAll('</p>', '').replaceAll(' ', '') === '') flag = true
 
-      if (txt.split('></p>').length - 1 === 1) flag = true
+      const txtRes = txt.replaceAll(' ', '').replaceAll('</p><p>', '')
+
+      if (txtRes.split('></p>').length - 1 === 1 || txtRes === '') flag = true
     } else {
       // 按章节发布  检查 所有的 标题 和富文本
       sectionArr.forEach((v, i) => {
         if (!v.name) flag = true
         const txt: string = v.txt.toHTML()
-        if (txt.replaceAll('<p>', '').replaceAll('</p>', '').replaceAll(' ', '') === '') flag = true
 
-        if (txt.split('></p>').length - 1 === 1) flag = true
+        const txtRes = txt.replaceAll(' ', '').replaceAll('</p><p>', '')
+        if (txtRes.split('></p>').length - 1 === 1 || txtRes === '') flag = true
       })
     }