mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
refactor: improve types around dataState and libraryData (#3427)
This commit is contained in:
parent
c19c8ecd27
commit
a7cbe68ae8
10 changed files with 84 additions and 55 deletions
|
@ -7,7 +7,7 @@ import { calculateScrollCenter } from "../scene";
|
|||
import { AppState } from "../types";
|
||||
import { isValidExcalidrawData } from "./json";
|
||||
import { restore } from "./restore";
|
||||
import { LibraryData } from "./types";
|
||||
import { ImportedLibraryData } from "./types";
|
||||
|
||||
const parseFileContents = async (blob: Blob | File) => {
|
||||
let contents: string;
|
||||
|
@ -114,7 +114,7 @@ export const loadFromBlob = async (
|
|||
|
||||
export const loadLibraryFromBlob = async (blob: Blob) => {
|
||||
const contents = await parseFileContents(blob);
|
||||
const data: LibraryData = JSON.parse(contents);
|
||||
const data: ImportedLibraryData = JSON.parse(contents);
|
||||
if (data.type !== EXPORT_DATA_TYPES.excalidrawLibrary) {
|
||||
throw new Error(t("alerts.couldNotLoadInvalidFile"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue