mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 18:37:43 +08:00
Feat:如果开启了公式插件并且存在公式,那么导出svg时需要传入katex库的样式
This commit is contained in:
parent
6382e8acd8
commit
5192753816
@ -4,7 +4,8 @@ import {
|
||||
readBlob,
|
||||
removeHTMLEntities,
|
||||
resizeImgSize,
|
||||
handleSelfCloseTags
|
||||
handleSelfCloseTags,
|
||||
addXmlns
|
||||
} from '../utils'
|
||||
import { SVG } from '@svgdotjs/svg.js'
|
||||
import drawBackgroundImageToCanvas from '../utils/simulateCSSBackgroundInCanvas'
|
||||
@ -95,6 +96,20 @@ class Export {
|
||||
foreignObjectList[0].add(SVG(`<style>${resetCss}</style>`))
|
||||
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的方法
|
||||
if (typeof handleBeingExportSvg === 'function') {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user