feat:add superscript and subscript

This commit is contained in:
黄云飞
2022-01-14 14:40:19 +08:00
parent 8939d42295
commit ae3de7bf55
14 changed files with 122 additions and 13 deletions
+3 -3
View File
@@ -1,5 +1,6 @@
import { ElementType, IElement } from ".."
import { IElement } from ".."
import { ZERO } from "../dataset/constant/Common"
import { TEXTLIKE_ELEMENT_TYPE } from "../dataset/constant/Element"
export function writeText(text: string) {
if (!text) return
@@ -7,9 +8,8 @@ export function writeText(text: string) {
}
export function writeTextByElementList(elementList: IElement[]) {
const { TEXT, HYPERLINK } = ElementType
const text = elementList
.map(p => !p.type || p.type === TEXT || p.type === HYPERLINK ? p.value : '')
.map(p => !p.type || TEXTLIKE_ELEMENT_TYPE.includes(p.type) ? p.value : '')
.join('')
writeText(text)
}