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:
Steve Ruiz 2024-05-12 22:02:53 +01:00 committed by GitHub
parent da415d95db
commit 142c27053b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View file

@ -14,7 +14,7 @@ import { Computed } from '@tldraw/state';
import { computed } from '@tldraw/state';
import { EmbedDefinition } from '@tldraw/tlschema';
import { EMPTY_ARRAY } from '@tldraw/state';
import { EventEmitter } from 'eventemitter3';
import EventEmitter from 'eventemitter3';
import { Expand } from '@tldraw/utils';
import { HistoryEntry } from '@tldraw/store';
import { IndexKey } from '@tldraw/utils';

View file

@ -72,7 +72,7 @@ import {
sortByIndex,
structuredClone,
} from '@tldraw/utils'
import { EventEmitter } from 'eventemitter3'
import EventEmitter from 'eventemitter3'
import { flushSync } from 'react-dom'
import { createRoot } from 'react-dom/client'
import { TLUser, createTLUser } from '../config/createTLUser'

View file

@ -15,7 +15,7 @@ import {
useEditor,
useValue,
} from '@tldraw/editor'
import { compressToBase64, decompressFromBase64 } from 'lz-string'
import lz from 'lz-string'
import { useCallback, useEffect } from 'react'
import { TLUiEventSource, useUiEvents } from '../context/events'
import { pasteExcalidrawContent } from './clipboard/pasteExcalidrawContent'
@ -328,7 +328,7 @@ async function handleClipboardThings(editor: Editor, things: ClipboardThing[], p
if (tldrawHtmlComment) {
try {
// 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) {
r({
type: 'error',
@ -491,7 +491,7 @@ const handleNativeOrMenuCopy = (editor: Editor) => {
return
}
const stringifiedClipboard = compressToBase64(
const stringifiedClipboard = lz.compressToBase64(
JSON.stringify({
type: 'application/tldraw',
kind: 'content',