|
@@ -64,23 +64,18 @@ function ZRichTexts(
|
|
|
|
|
|
// 不是按章节发布,检查第一个富文本
|
|
|
if (!isSection) {
|
|
|
- const txt = sectionArr[0].txt.toHTML()
|
|
|
-
|
|
|
- const txtRes = txt.replaceAll(' ', '').replaceAll('</p><p>', '')
|
|
|
-
|
|
|
- if (txtRes === '') flag = true
|
|
|
-
|
|
|
- if (txtRes.split('></p>').length - 1 === 1 && !txtRes.includes('class="media-')) flag = true
|
|
|
+ const txt = sectionArr[0].txt.toText()
|
|
|
+ const txtHtml = sectionArr[0].txt.toHTML()
|
|
|
+ const txtRes = txt.replaceAll('\n', '').replaceAll(' ', '')
|
|
|
+ if (!txtRes && !txtHtml.includes('class="media-wrap')) flag = true
|
|
|
} else {
|
|
|
// 按章节发布 检查 所有的 标题 和富文本
|
|
|
- sectionArr.forEach((v, i) => {
|
|
|
+ sectionArr.forEach(v => {
|
|
|
if (!v.name) flag = true
|
|
|
- const txt: string = v.txt.toHTML()
|
|
|
-
|
|
|
- const txtRes = txt.replaceAll(' ', '').replaceAll('</p><p>', '')
|
|
|
- if (txtRes === '') flag = true
|
|
|
-
|
|
|
- if (txtRes.split('></p>').length - 1 === 1 && !txtRes.includes('class="media-')) flag = true
|
|
|
+ const txt = v.txt.toText()
|
|
|
+ const txtHtml = sectionArr[0].txt.toHTML()
|
|
|
+ const txtRes = txt.replaceAll('\n', '').replaceAll(' ', '')
|
|
|
+ if (!txtRes && !txtHtml.includes('class="media-wrap')) flag = true
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -255,13 +250,10 @@ function ZRichTexts(
|
|
|
(name: string, txt: any) => {
|
|
|
let flag = false
|
|
|
if (!name && isSection) flag = true
|
|
|
- const txtRes: string = txt.toHTML()
|
|
|
- const txtRes2 = txtRes.replaceAll(' ', '').replaceAll('</p><p>', '')
|
|
|
-
|
|
|
- if (txtRes2 === '') flag = true
|
|
|
-
|
|
|
- if (txtRes2.split('></p>').length - 1 === 1 && !txtRes2.includes('class="media-')) flag = true
|
|
|
-
|
|
|
+ const txt2 = txt.toText()
|
|
|
+ const txtHtml = txt.toHTML()
|
|
|
+ const txtRes = txt2.replaceAll('\n', '').replaceAll(' ', '')
|
|
|
+ if (!txtRes && !txtHtml.includes('class="media-wrap')) flag = true
|
|
|
return flag
|
|
|
},
|
|
|
[isSection]
|