mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
If element ID does not exist, add the ID during restoration
This commit is contained in:
parent
f7209d49f4
commit
58d06d6591
1 changed files with 2 additions and 0 deletions
|
@ -6,6 +6,7 @@ import { getElementAbsoluteCoords } from "../element";
|
||||||
|
|
||||||
import { renderScene } from "../renderer";
|
import { renderScene } from "../renderer";
|
||||||
import { AppState } from "../types";
|
import { AppState } from "../types";
|
||||||
|
import nanoid from "nanoid";
|
||||||
|
|
||||||
const LOCAL_STORAGE_KEY = "excalidraw";
|
const LOCAL_STORAGE_KEY = "excalidraw";
|
||||||
const LOCAL_STORAGE_KEY_STATE = "excalidraw-state";
|
const LOCAL_STORAGE_KEY_STATE = "excalidraw-state";
|
||||||
|
@ -143,6 +144,7 @@ function restore(
|
||||||
: savedElements)
|
: savedElements)
|
||||||
);
|
);
|
||||||
elements.forEach((element: ExcalidrawElement) => {
|
elements.forEach((element: ExcalidrawElement) => {
|
||||||
|
element.id = element.id || nanoid();
|
||||||
element.fillStyle = element.fillStyle || "hachure";
|
element.fillStyle = element.fillStyle || "hachure";
|
||||||
element.strokeWidth = element.strokeWidth || 1;
|
element.strokeWidth = element.strokeWidth || 1;
|
||||||
element.roughness = element.roughness || 1;
|
element.roughness = element.roughness || 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue