mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
parent
084aff2bf3
commit
36980160ae
13 changed files with 605 additions and 0 deletions
|
@ -283,12 +283,14 @@ export const exportCanvas = async (
|
|||
exportBackground,
|
||||
exportPadding = 10,
|
||||
viewBackgroundColor,
|
||||
name,
|
||||
scale = 1,
|
||||
shouldAddWatermark,
|
||||
}: {
|
||||
exportBackground: boolean;
|
||||
exportPadding?: number;
|
||||
viewBackgroundColor: string;
|
||||
name: string;
|
||||
scale?: number;
|
||||
shouldAddWatermark: boolean;
|
||||
},
|
||||
|
@ -314,6 +316,7 @@ export const exportCanvas = async (
|
|||
});
|
||||
if (type === "svg") {
|
||||
await fileSave(new Blob([tempSvg.outerHTML], { type: "image/svg+xml" }), {
|
||||
fileName: `${name}.svg`,
|
||||
extensions: [".svg"],
|
||||
});
|
||||
return;
|
||||
|
@ -334,6 +337,7 @@ export const exportCanvas = async (
|
|||
document.body.appendChild(tempCanvas);
|
||||
|
||||
if (type === "png") {
|
||||
const fileName = `${name}.png`;
|
||||
let blob = await canvasToBlob(tempCanvas);
|
||||
if (appState.exportEmbedScene) {
|
||||
blob = await (
|
||||
|
@ -345,6 +349,7 @@ export const exportCanvas = async (
|
|||
}
|
||||
|
||||
await fileSave(blob, {
|
||||
fileName,
|
||||
extensions: [".png"],
|
||||
});
|
||||
} else if (type === "clipboard") {
|
||||
|
|
|
@ -36,6 +36,7 @@ export const saveAsJSON = async (
|
|||
const fileHandle = await fileSave(
|
||||
blob,
|
||||
{
|
||||
fileName: appState.name,
|
||||
description: "Excalidraw file",
|
||||
extensions: [".excalidraw"],
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue