feat: cleanup svg export and move payload to <metadata> (#8975)

This commit is contained in:
David Luzar 2025-01-05 16:53:05 +01:00 committed by GitHub
parent 798c795405
commit 36274f1f3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 220 additions and 186 deletions

View file

@ -1,7 +1,8 @@
import { decodePngMetadata, decodeSvgMetadata } from "../excalidraw/data/image";
import type { ImportedDataState } from "../excalidraw/data/types";
import * as utils from "../utils";
import { API } from "../excalidraw/tests/helpers/api";
import { decodeSvgBase64Payload } from "../excalidraw/scene/export";
import { decodePngMetadata } from "../excalidraw/data/image";
// NOTE this test file is using the actual API, unmocked. Hence splitting it
// from the other test file, because I couldn't figure out how to test
@ -27,7 +28,7 @@ describe("embedding scene data", () => {
const svg = svgNode.outerHTML;
const parsedString = decodeSvgMetadata({ svg });
const parsedString = decodeSvgBase64Payload({ svg });
const importedData: ImportedDataState = JSON.parse(parsedString);
expect(sourceElements.map((x) => x.id)).toEqual(