|
@@ -140,7 +140,7 @@ export const toTextProps = (json) => {
|
|
if ('tagName' in item && item.tagName === 'br') {
|
|
if ('tagName' in item && item.tagName === 'br') {
|
|
slices.push({ text: '', options: { breakLine: true } })
|
|
slices.push({ text: '', options: { breakLine: true } })
|
|
} else if ('content' in item) {
|
|
} else if ('content' in item) {
|
|
- const transStr = /(<|>|“|”|&|‘|’|—|≥|≤|·)/g
|
|
|
|
|
|
+ const transStr = /(<|>|“|”|&|‘|’|—|≥|≤|·|Ø|∅)/g
|
|
const text = item.content.replace(/\n/g, '').replace(/ /g, ' ').replace(transStr, replacer)
|
|
const text = item.content.replace(/\n/g, '').replace(/ /g, ' ').replace(transStr, replacer)
|
|
const options = {}
|
|
const options = {}
|
|
|
|
|
|
@@ -205,6 +205,7 @@ export const toTextProps = (json) => {
|
|
return slices
|
|
return slices
|
|
}
|
|
}
|
|
//将text中被转义的字符转义回来,如:a<b 在富文本内会被转义成 a<b
|
|
//将text中被转义的字符转义回来,如:a<b 在富文本内会被转义成 a<b
|
|
|
|
+//https://www.cnblogs.com/tiancixiong/p/13581746.html
|
|
const replacer = (_, p1) => {
|
|
const replacer = (_, p1) => {
|
|
return {
|
|
return {
|
|
"<": "<",
|
|
"<": "<",
|
|
@@ -217,7 +218,9 @@ const replacer = (_, p1) => {
|
|
"—":'——',
|
|
"—":'——',
|
|
"≥":'≥',
|
|
"≥":'≥',
|
|
"≤":'≤',
|
|
"≤":'≤',
|
|
- "·":'·'
|
|
|
|
|
|
+ "·":'·',
|
|
|
|
+ "Ø":'ø',
|
|
|
|
+ "∅":'∅'
|
|
} [p1]
|
|
} [p1]
|
|
}
|
|
}
|
|
//根据字符串的字节长,在指定位置换行
|
|
//根据字符串的字节长,在指定位置换行
|