Fix imports in Astro (#3742)
This PR changes our imports so that they work in a few rare cases. https://github.com/tldraw/tldraw/issues/1817 ### Change Type - [x] `sdk` — Changes the tldraw SDK - [x] `bugfix` — Bug fix ### Release Notes - Fix bug effecting imports in Astro.
This commit is contained in:
parent
da415d95db
commit
142c27053b
3 changed files with 5 additions and 5 deletions
|
@ -14,7 +14,7 @@ import { Computed } from '@tldraw/state';
|
||||||
import { computed } from '@tldraw/state';
|
import { computed } from '@tldraw/state';
|
||||||
import { EmbedDefinition } from '@tldraw/tlschema';
|
import { EmbedDefinition } from '@tldraw/tlschema';
|
||||||
import { EMPTY_ARRAY } from '@tldraw/state';
|
import { EMPTY_ARRAY } from '@tldraw/state';
|
||||||
import { EventEmitter } from 'eventemitter3';
|
import EventEmitter from 'eventemitter3';
|
||||||
import { Expand } from '@tldraw/utils';
|
import { Expand } from '@tldraw/utils';
|
||||||
import { HistoryEntry } from '@tldraw/store';
|
import { HistoryEntry } from '@tldraw/store';
|
||||||
import { IndexKey } from '@tldraw/utils';
|
import { IndexKey } from '@tldraw/utils';
|
||||||
|
|
|
@ -72,7 +72,7 @@ import {
|
||||||
sortByIndex,
|
sortByIndex,
|
||||||
structuredClone,
|
structuredClone,
|
||||||
} from '@tldraw/utils'
|
} from '@tldraw/utils'
|
||||||
import { EventEmitter } from 'eventemitter3'
|
import EventEmitter from 'eventemitter3'
|
||||||
import { flushSync } from 'react-dom'
|
import { flushSync } from 'react-dom'
|
||||||
import { createRoot } from 'react-dom/client'
|
import { createRoot } from 'react-dom/client'
|
||||||
import { TLUser, createTLUser } from '../config/createTLUser'
|
import { TLUser, createTLUser } from '../config/createTLUser'
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
useEditor,
|
useEditor,
|
||||||
useValue,
|
useValue,
|
||||||
} from '@tldraw/editor'
|
} from '@tldraw/editor'
|
||||||
import { compressToBase64, decompressFromBase64 } from 'lz-string'
|
import lz from 'lz-string'
|
||||||
import { useCallback, useEffect } from 'react'
|
import { useCallback, useEffect } from 'react'
|
||||||
import { TLUiEventSource, useUiEvents } from '../context/events'
|
import { TLUiEventSource, useUiEvents } from '../context/events'
|
||||||
import { pasteExcalidrawContent } from './clipboard/pasteExcalidrawContent'
|
import { pasteExcalidrawContent } from './clipboard/pasteExcalidrawContent'
|
||||||
|
@ -328,7 +328,7 @@ async function handleClipboardThings(editor: Editor, things: ClipboardThing[], p
|
||||||
if (tldrawHtmlComment) {
|
if (tldrawHtmlComment) {
|
||||||
try {
|
try {
|
||||||
// If we've found tldraw content in the html string, use that as JSON
|
// If we've found tldraw content in the html string, use that as JSON
|
||||||
const jsonComment = decompressFromBase64(tldrawHtmlComment)
|
const jsonComment = lz.decompressFromBase64(tldrawHtmlComment)
|
||||||
if (jsonComment === null) {
|
if (jsonComment === null) {
|
||||||
r({
|
r({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
@ -491,7 +491,7 @@ const handleNativeOrMenuCopy = (editor: Editor) => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const stringifiedClipboard = compressToBase64(
|
const stringifiedClipboard = lz.compressToBase64(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
type: 'application/tldraw',
|
type: 'application/tldraw',
|
||||||
kind: 'content',
|
kind: 'content',
|
||||||
|
|
Loading…
Reference in a new issue