kopia lustrzana https://github.com/Tldraw/Tldraw
Add tlstate to window in editor
rodzic
0c79bbce56
commit
05149aacc8
|
@ -1,9 +1,16 @@
|
||||||
import { TLDraw } from '@tldraw/tldraw'
|
import { TLDraw } from '@tldraw/tldraw'
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
interface EditorProps {
|
interface EditorProps {
|
||||||
id?: string
|
id?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Editor({ id = 'home' }: EditorProps) {
|
export default function Editor({ id = 'home' }: EditorProps) {
|
||||||
return <TLDraw id={id} />
|
const handleMount = React.useCallback((tlstate) => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
window.tlstate = tlstate
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return <TLDraw id={id} onMount={handleMount} />
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue