refactor: migrate elements by schema in restore

This commit is contained in:
Ryan Di
2026-03-23 17:30:05 +11:00
parent 16838ea792
commit 11ba6784aa
5 changed files with 44 additions and 146 deletions
+3
View File
@@ -50,6 +50,8 @@ import type {
ExcalidrawLineElement,
} from "./types";
const ELEMENT_SCHEMA_VERSION = 2;
export type ElementConstructorOpts = MarkOptional<
Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">,
| "width"
@@ -144,6 +146,7 @@ const _newElementBase = <T extends ExcalidrawElement>(
roundness,
seed: rest.seed ?? randomInteger(),
version: rest.version || 1,
schemaVersion: rest.schemaVersion ?? ELEMENT_SCHEMA_VERSION,
versionNonce: rest.versionNonce ?? 0,
isDeleted: false as false,
boundElements,