feat:add laTeX previewer

This commit is contained in:
黄云飞
2022-07-01 16:07:26 +08:00
parent 58c32c4f21
commit ab7c5788c8
13 changed files with 388 additions and 351 deletions
+8
View File
@@ -1,5 +1,6 @@
import { deepClone, getUUID, splitText } from '.'
import { ElementType, IEditorOption, IElement } from '..'
import { LaTexParticle } from '../core/draw/particle/latex/LaTexParticle'
import { defaultCheckboxOption } from '../dataset/constant/Checkbox'
import { ZERO } from '../dataset/constant/Common'
import { defaultControlOption } from '../dataset/constant/Control'
@@ -214,6 +215,13 @@ export function formatElementList(elementList: IElement[], options: IFormatEleme
if (el.type === ElementType.IMAGE) {
el.id = getUUID()
}
if (el.type === ElementType.LATEX) {
const { svg, width, height } = LaTexParticle.convertLaTextToSVG(el.value)
el.width = el.width || width
el.height = el.height || height
el.laTexSVG = svg
el.id = getUUID()
}
i++
}
}