Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/extension/src/tools/snapshot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,18 @@ export class Snapshot {
const { fileType = baseFileType } = toImageOptions ?? {}
const svg = this.getSvgRootElement(this.lf)
await updateImageSource(svg as SVGElement)
if (fileType === 'svg') {
const copy = await this.cloneSvg(svg)
const svgString = new XMLSerializer().serializeToString(copy)
const blob = new Blob([svgString], {
type: 'image/svg+xml;charset=utf-8',
})
return {
data: blob,
width: 0,
height: 0,
}
}
return new Promise((resolve) => {
this.getCanvasData(svg, {
backgroundColor,
Expand Down