Add tlstate to window in editor

pull/79/head
Steve Ruiz 2021-09-06 14:04:32 +01:00
rodzic 0c79bbce56
commit 05149aacc8
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -1,9 +1,16 @@
import { TLDraw } from '@tldraw/tldraw'
import React from 'react'
interface EditorProps {
id?: string
}
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} />
}