mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
One-click installable libraries (#2179)
Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
6b7516bc3c
commit
8ab9ffbe28
3 changed files with 44 additions and 1 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue