mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Abstract away or eliminate most of the mutation of the Elements array (#955)
This commit is contained in:
parent
05af9f04ed
commit
e1e2249f57
17 changed files with 293 additions and 272 deletions
|
@ -14,7 +14,7 @@ export function serializeAsJSON(
|
|||
type: "excalidraw",
|
||||
version: 1,
|
||||
source: window.location.origin,
|
||||
elements,
|
||||
elements: elements.filter(element => !element.isDeleted),
|
||||
appState: cleanAppStateForExport(appState),
|
||||
},
|
||||
null,
|
||||
|
|
|
@ -10,7 +10,10 @@ export function saveToLocalStorage(
|
|||
elements: readonly ExcalidrawElement[],
|
||||
appState: AppState,
|
||||
) {
|
||||
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(elements));
|
||||
localStorage.setItem(
|
||||
LOCAL_STORAGE_KEY,
|
||||
JSON.stringify(elements.filter(element => !element.isDeleted)),
|
||||
);
|
||||
localStorage.setItem(
|
||||
LOCAL_STORAGE_KEY_STATE,
|
||||
JSON.stringify(clearAppStateForLocalStorage(appState)),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Point } from "roughjs/bin/geometry";
|
||||
import { Point } from "../types";
|
||||
|
||||
import { ExcalidrawElement } from "../element/types";
|
||||
import { AppState } from "../types";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue