shaogen1995 vor 1 Jahr
Ursprung
Commit
40c414e8e3
1 geänderte Dateien mit 6 neuen und 22 gelöschten Zeilen
  1. 6 22
      src/components/ZRichTexts/index.tsx

+ 6 - 22
src/components/ZRichTexts/index.tsx

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