fix structured clone reference in drawing (#2945)
This PR fixes a rogue structuredClone reference in the drawing state. ### Change Type - [x] `patch` — Bug fix ### Release Notes - Fixes a reference to structuredClone that caused a crash on older browsers.
This commit is contained in:
parent
0f1599d5b3
commit
b2cb0d27b0
5 changed files with 9 additions and 3 deletions
|
@ -14,6 +14,7 @@ import {
|
|||
createShapeId,
|
||||
last,
|
||||
snapAngle,
|
||||
structuredClone,
|
||||
toFixed,
|
||||
uniqueId,
|
||||
} from '@tldraw/editor'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Migrations, Store, createRecordType } from '@tldraw/store'
|
||||
import { structuredClone } from '@tldraw/utils'
|
||||
import fs from 'fs'
|
||||
import { bookmarkAssetMigrations } from './assets/TLBookmarkAsset'
|
||||
import { imageAssetMigrations } from './assets/TLImageAsset'
|
||||
|
|
|
@ -283,7 +283,7 @@ export function sortByIndex<T extends {
|
|||
index: IndexKey;
|
||||
}>(a: T, b: T): -1 | 0 | 1;
|
||||
|
||||
// @public (undocumented)
|
||||
// @public
|
||||
const structuredClone_2: <T>(i: T) => T;
|
||||
export { structuredClone_2 as structuredClone }
|
||||
|
||||
|
|
|
@ -3237,7 +3237,7 @@
|
|||
{
|
||||
"kind": "Variable",
|
||||
"canonicalReference": "@tldraw/utils!structuredClone_2:var",
|
||||
"docComment": "/**\n * @public\n */\n",
|
||||
"docComment": "/**\n * Create a deep copy of a value. Uses the structuredClone API if available, otherwise uses JSON.parse(JSON.stringify()).\n *\n * @param i - The value to clone.\n *\n * @public\n */\n",
|
||||
"excerptTokens": [
|
||||
{
|
||||
"kind": "Content",
|
||||
|
|
|
@ -30,7 +30,11 @@ export function isNonNullish<T>(
|
|||
return value !== null && value !== undefined
|
||||
}
|
||||
|
||||
/** @public */
|
||||
/**
|
||||
* Create a deep copy of a value. Uses the structuredClone API if available, otherwise uses JSON.parse(JSON.stringify()).
|
||||
*
|
||||
* @param i - The value to clone.
|
||||
* @public */
|
||||
export const structuredClone =
|
||||
typeof window !== 'undefined' && (window as any).structuredClone
|
||||
? (window.structuredClone as <T>(i: T) => T)
|
||||
|
|
Loading…
Reference in a new issue