Feat:如果开启了公式插件并且存在公式,那么导出svg时需要传入katex库的样式
This commit is contained in:
parent
6382e8acd8
commit
5192753816
@ -4,7 +4,8 @@ import {
|
|||||||
readBlob,
|
readBlob,
|
||||||
removeHTMLEntities,
|
removeHTMLEntities,
|
||||||
resizeImgSize,
|
resizeImgSize,
|
||||||
handleSelfCloseTags
|
handleSelfCloseTags,
|
||||||
|
addXmlns
|
||||||
} from '../utils'
|
} from '../utils'
|
||||||
import { SVG } from '@svgdotjs/svg.js'
|
import { SVG } from '@svgdotjs/svg.js'
|
||||||
import drawBackgroundImageToCanvas from '../utils/simulateCSSBackgroundInCanvas'
|
import drawBackgroundImageToCanvas from '../utils/simulateCSSBackgroundInCanvas'
|
||||||
@ -95,6 +96,20 @@ class Export {
|
|||||||
foreignObjectList[0].add(SVG(`<style>${resetCss}</style>`))
|
foreignObjectList[0].add(SVG(`<style>${resetCss}</style>`))
|
||||||
svgIsChange = true
|
svgIsChange = true
|
||||||
}
|
}
|
||||||
|
// 如果还开启了数学公式,还要插入katex库的样式
|
||||||
|
if (this.mindMap.formula) {
|
||||||
|
const formulaList = svg.find('.ql-formula')
|
||||||
|
if (formulaList.length > 0) {
|
||||||
|
const styleText = this.mindMap.formula.getStyleText()
|
||||||
|
if (styleText) {
|
||||||
|
const styleEl = document.createElement('style')
|
||||||
|
styleEl.innerHTML = styleText
|
||||||
|
addXmlns(styleEl)
|
||||||
|
foreignObjectList[0].add(styleEl)
|
||||||
|
svgIsChange = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 自定义处理svg的方法
|
// 自定义处理svg的方法
|
||||||
if (typeof handleBeingExportSvg === 'function') {
|
if (typeof handleBeingExportSvg === 'function') {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user