One-click installable libraries (#2179)

Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
Pete Hunt 2020-10-01 10:12:43 -07:00 committed by GitHub
parent 6b7516bc3c
commit 8ab9ffbe28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 1 deletions

View file

@ -54,6 +54,15 @@ export const loadFromJSON = async (appState: AppState) => {
return loadFromBlob(blob, appState);
};
export const isValidLibrary = (json: any) => {
return (
typeof json === "object" &&
json &&
json.type === "excalidrawlib" &&
json.version === 1
);
};
export const saveLibraryAsJSON = async () => {
const library = await loadLibrary();
const serialized = JSON.stringify(