mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: set appState.exportBackground
to true
when exporting to jpg
(#4342)
This commit is contained in:
parent
1ee8d7d082
commit
afa7932c9b
4 changed files with 21 additions and 2 deletions
|
@ -80,8 +80,6 @@ export const exportToBlob = async (
|
|||
quality?: number;
|
||||
},
|
||||
): Promise<Blob | null> => {
|
||||
const canvas = await exportToCanvas(opts);
|
||||
|
||||
let { mimeType = MIME_TYPES.png, quality } = opts;
|
||||
|
||||
if (mimeType === MIME_TYPES.png && typeof quality === "number") {
|
||||
|
@ -93,6 +91,18 @@ export const exportToBlob = async (
|
|||
mimeType = MIME_TYPES.jpg;
|
||||
}
|
||||
|
||||
if (mimeType === MIME_TYPES.jpg && !opts.appState?.exportBackground) {
|
||||
console.warn(
|
||||
`Defaulting "exportBackground" to "true" for "${MIME_TYPES.jpg}" mimeType`,
|
||||
);
|
||||
opts = {
|
||||
...opts,
|
||||
appState: { ...opts.appState, exportBackground: true },
|
||||
};
|
||||
}
|
||||
|
||||
const canvas = await exportToCanvas(opts);
|
||||
|
||||
quality = quality ? quality : /image\/jpe?g/.test(mimeType) ? 0.92 : 0.8;
|
||||
|
||||
return new Promise((resolve) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue