fix: utils leaking Scene state (#6461

* fix: utils leaking Scene state

* remove debug

* doc

* add tests for group duplicating

* tweaks
This commit is contained in:
David Luzar 2023-04-16 11:56:25 +02:00 committed by GitHub
parent b0b23353cf
commit 399c92d882
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 604 additions and 116 deletions

View file

@ -90,6 +90,9 @@ export const exportToSvg = async (
exportEmbedScene?: boolean;
},
files: BinaryFiles | null,
opts?: {
serializeAsJSON?: () => string;
},
): Promise<SVGSVGElement> => {
const {
exportPadding = DEFAULT_EXPORT_PADDING,
@ -103,7 +106,9 @@ export const exportToSvg = async (
metadata = await (
await import(/* webpackChunkName: "image" */ "../../src/data/image")
).encodeSvgMetadata({
text: serializeAsJSON(elements, appState, files || {}, "local"),
text: opts?.serializeAsJSON
? opts?.serializeAsJSON?.()
: serializeAsJSON(elements, appState, files || {}, "local"),
});
} catch (error: any) {
console.error(error);