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