mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-16 05:50:03 +02:00
feat: make file handling more robust (#5057)
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
import { clearElementsForDatabase, clearElementsForExport } from "../element";
|
||||
import { ExcalidrawElement } from "../element/types";
|
||||
import { AppState, BinaryFiles, LibraryItems } from "../types";
|
||||
import { isImageFileHandle, loadFromBlob } from "./blob";
|
||||
import { isImageFileHandle, loadFromBlob, normalizeFile } from "./blob";
|
||||
|
||||
import {
|
||||
ExportedDataState,
|
||||
@@ -93,13 +93,13 @@ export const loadFromJSON = async (
|
||||
localAppState: AppState,
|
||||
localElements: readonly ExcalidrawElement[] | null,
|
||||
) => {
|
||||
const blob = await fileOpen({
|
||||
const file = await fileOpen({
|
||||
description: "Excalidraw files",
|
||||
// ToDo: Be over-permissive until https://bugs.webkit.org/show_bug.cgi?id=34442
|
||||
// gets resolved. Else, iOS users cannot open `.excalidraw` files.
|
||||
// extensions: ["json", "excalidraw", "png", "svg"],
|
||||
});
|
||||
return loadFromBlob(blob, localAppState, localElements);
|
||||
return loadFromBlob(await normalizeFile(file), localAppState, localElements);
|
||||
};
|
||||
|
||||
export const isValidExcalidrawData = (data?: {
|
||||
|
Reference in New Issue
Block a user