mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
add cleanup workspaces script and test-utils
This commit is contained in:
parent
5acb5c9d91
commit
d12d97bfcb
4 changed files with 22 additions and 2 deletions
17
excalidraw-app/tests/test-utils.ts
Normal file
17
excalidraw-app/tests/test-utils.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { ImportedDataState } from "../../packages/excalidraw/data/types";
|
||||
import { STORAGE_KEYS } from "../app_constants";
|
||||
|
||||
export const initLocalStorage = (data: ImportedDataState) => {
|
||||
if (data.elements) {
|
||||
localStorage.setItem(
|
||||
STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS,
|
||||
JSON.stringify(data.elements),
|
||||
);
|
||||
}
|
||||
if (data.appState) {
|
||||
localStorage.setItem(
|
||||
STORAGE_KEYS.LOCAL_STORAGE_APP_STATE,
|
||||
JSON.stringify(data.appState),
|
||||
);
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue