fix: keep schema hints across clipboard roundtrips

This commit is contained in:
Ryan Di
2026-03-20 19:00:54 +11:00
parent b818b3fe04
commit eda7c8d6e9
10 changed files with 211 additions and 77 deletions
+12 -13
View File
@@ -55,7 +55,6 @@ import {
} from "@excalidraw/excalidraw/data/restore";
import {
migrateSceneElements,
resolveSchemaVersion,
SCHEMA_VERSIONS,
} from "@excalidraw/excalidraw/data/schema";
import { newElementWith } from "@excalidraw/element";
@@ -244,10 +243,10 @@ const initializeScene = async (opts: {
elements: restoreElements(
migrateSceneElements(
localDataState?.elements,
resolveSchemaVersion(
localDataState?.schemaVersion,
SCHEMA_VERSIONS.initial,
),
{
payloadSchemaVersion: localDataState?.schemaVersion,
fallbackVersion: SCHEMA_VERSIONS.initial,
},
),
null,
{
@@ -280,10 +279,10 @@ const initializeScene = async (opts: {
restoreElements(
migrateSceneElements(
imported.elements,
resolveSchemaVersion(
imported.schemaVersion,
SCHEMA_VERSIONS.initial,
),
{
payloadSchemaVersion: imported.schemaVersion,
fallbackVersion: SCHEMA_VERSIONS.initial,
},
),
null,
{
@@ -576,10 +575,10 @@ const ExcalidrawWrapper = () => {
const username = importUsernameFromLocalStorage();
const migratedElements = migrateSceneElements(
localDataState?.elements,
resolveSchemaVersion(
localDataState?.schemaVersion,
SCHEMA_VERSIONS.initial,
),
{
payloadSchemaVersion: localDataState?.schemaVersion,
fallbackVersion: SCHEMA_VERSIONS.initial,
},
);
setLangCode(getPreferredLanguage());
excalidrawAPI.updateScene({