mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: add mimeTypes on file save (#8946)
This commit is contained in:
parent
d33e42e3a1
commit
12c39d1034
2 changed files with 8 additions and 3 deletions
|
@ -82,6 +82,7 @@ export const fileSave = (
|
|||
name: string;
|
||||
/** file extension */
|
||||
extension: FILE_EXTENSION;
|
||||
mimeTypes?: string[];
|
||||
description: string;
|
||||
/** existing FileSystemHandle */
|
||||
fileHandle?: FileSystemHandle | null;
|
||||
|
@ -93,10 +94,11 @@ export const fileSave = (
|
|||
fileName: `${opts.name}.${opts.extension}`,
|
||||
description: opts.description,
|
||||
extensions: [`.${opts.extension}`],
|
||||
mimeTypes: opts.mimeTypes,
|
||||
},
|
||||
opts.fileHandle,
|
||||
);
|
||||
};
|
||||
|
||||
export type { FileSystemHandle };
|
||||
export { nativeFileSystemSupported };
|
||||
export type { FileSystemHandle };
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
import {
|
||||
DEFAULT_EXPORT_PADDING,
|
||||
DEFAULT_FILENAME,
|
||||
IMAGE_MIME_TYPES,
|
||||
isFirefox,
|
||||
MIME_TYPES,
|
||||
} from "../constants";
|
||||
|
@ -15,8 +16,9 @@ import type {
|
|||
ExcalidrawFrameLikeElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
import { getElementsOverlappingFrame } from "../frame";
|
||||
import { t } from "../i18n";
|
||||
import { isSomeElementSelected, getSelectedElements } from "../scene";
|
||||
import { getSelectedElements, isSomeElementSelected } from "../scene";
|
||||
import { exportToCanvas, exportToSvg } from "../scene/export";
|
||||
import type { ExportType } from "../scene/types";
|
||||
import type { AppState, BinaryFiles } from "../types";
|
||||
|
@ -25,7 +27,6 @@ import { canvasToBlob } from "./blob";
|
|||
import type { FileSystemHandle } from "./filesystem";
|
||||
import { fileSave } from "./filesystem";
|
||||
import { serializeAsJSON } from "./json";
|
||||
import { getElementsOverlappingFrame } from "../frame";
|
||||
|
||||
export { loadFromBlob } from "./blob";
|
||||
export { loadFromJSON, saveAsJSON } from "./json";
|
||||
|
@ -130,6 +131,7 @@ export const exportCanvas = async (
|
|||
description: "Export to SVG",
|
||||
name,
|
||||
extension: appState.exportEmbedScene ? "excalidraw.svg" : "svg",
|
||||
mimeTypes: [IMAGE_MIME_TYPES.svg],
|
||||
fileHandle,
|
||||
},
|
||||
);
|
||||
|
@ -171,6 +173,7 @@ export const exportCanvas = async (
|
|||
// FIXME reintroduce `excalidraw.png` when most people upgrade away
|
||||
// from 111.0.5563.64 (arm64), see #6349
|
||||
extension: /* appState.exportEmbedScene ? "excalidraw.png" : */ "png",
|
||||
mimeTypes: [IMAGE_MIME_TYPES.png],
|
||||
fileHandle,
|
||||
});
|
||||
} else if (type === "clipboard") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue