diff --git a/apps/client/src/services/utils.ts b/apps/client/src/services/utils.ts index 3a75b90d6..7e064d25f 100644 --- a/apps/client/src/services/utils.ts +++ b/apps/client/src/services/utils.ts @@ -684,7 +684,10 @@ async function downloadAsSvg(nameWithoutExtension: string, svgSource: string | S const { element, cleanup } = prepareElementForSnapdom(svgSource); try { - const result = await snapdom(element); + const result = await snapdom(element, { + backgroundColor: "transparent", + scale: 2 + }); await triggerDownload(`${nameWithoutExtension}.svg`, result.url); } finally { cleanup(); @@ -719,7 +722,10 @@ async function downloadAsPng(nameWithoutExtension: string, svgSource: string | S const { element, cleanup } = prepareElementForSnapdom(svgSource); try { - const result = await snapdom(element); + const result = await snapdom(element, { + backgroundColor: "transparent", + scale: 2 + }); const pngImg = await result.toPng(); await triggerDownload(`${nameWithoutExtension}.png`, pngImg.src); } finally { diff --git a/apps/client/src/widgets/type_widgets/MindMap.tsx b/apps/client/src/widgets/type_widgets/MindMap.tsx index 3741d8fbf..db46da025 100644 --- a/apps/client/src/widgets/type_widgets/MindMap.tsx +++ b/apps/client/src/widgets/type_widgets/MindMap.tsx @@ -47,11 +47,6 @@ export default function MindMap({ note, ntxId, noteContext }: TypeWidgetProps) { const containerRef = useRef(null); const [ isReadOnly ] = useNoteLabelBoolean(note, "readOnly"); - // Shared options for snapdom screenshot generation used in both attachment saving and exports - const imageOptions : SnapdomOptions = { - backgroundColor: "transparent", - scale: 2 - }; const spacedUpdate = useEditorSpacedUpdate({ note, @@ -59,7 +54,10 @@ export default function MindMap({ note, ntxId, noteContext }: TypeWidgetProps) { getData: async () => { if (!apiRef.current) return; - const result = await snapdom(apiRef.current.nodes, imageOptions); + const result = await snapdom(apiRef.current.nodes, { + backgroundColor: "transparent", + scale: 2 + }); // a data URL in the format: "data:image/svg+xml;charset=utf-8," // We need to extract the content after the comma and decode the URL encoding (%3C to <, %20 to space, etc.)