mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
Update blob.ts
This commit is contained in:
parent
2e876e98d7
commit
0aa2608799
1 changed files with 1 additions and 18 deletions
|
@ -107,19 +107,6 @@ export const isImageFileHandle = (handle: FileSystemHandle | null) => {
|
|||
return type === "png" || type === "svg";
|
||||
};
|
||||
|
||||
const getExtensionFromFilename = (filename?: string): string | null => {
|
||||
if (!filename) {
|
||||
return null;
|
||||
}
|
||||
const ext = filename.split(".").pop()?.toLowerCase();
|
||||
return ext || null;
|
||||
};
|
||||
|
||||
const isSupportedExtension = (filename?: string) => {
|
||||
const extension = getExtensionFromFilename(filename);
|
||||
return !!extension && extension in IMAGE_MIME_TYPES;
|
||||
};
|
||||
|
||||
export const isSupportedImageFileType = (type: string | null | undefined) => {
|
||||
return !!type && (Object.values(IMAGE_MIME_TYPES) as string[]).includes(type);
|
||||
};
|
||||
|
@ -128,11 +115,7 @@ export const isSupportedImageFile = (
|
|||
blob: Blob | null | undefined,
|
||||
): blob is Blob & { type: ValueOf<typeof IMAGE_MIME_TYPES> } => {
|
||||
const { type } = blob || {};
|
||||
if (type) {
|
||||
return isSupportedImageFileType(type);
|
||||
}
|
||||
const { name } = blob || {};
|
||||
return isSupportedExtension(name);
|
||||
return isSupportedImageFileType(type);
|
||||
};
|
||||
|
||||
export const loadSceneOrLibraryFromBlob = async (
|
||||
|
|
Loading…
Add table
Reference in a new issue