2021-09-02 20:13:54 +00:00
|
|
|
import { TLDraw } from '@tldraw/tldraw'
|
2021-09-06 13:04:32 +00:00
|
|
|
import React from 'react'
|
2021-08-10 16:12:55 +00:00
|
|
|
|
2021-09-04 12:02:13 +00:00
|
|
|
interface EditorProps {
|
|
|
|
id?: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Editor({ id = 'home' }: EditorProps) {
|
2021-09-06 13:04:32 +00:00
|
|
|
const handleMount = React.useCallback((tlstate) => {
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
|
|
// @ts-ignore
|
|
|
|
window.tlstate = tlstate
|
|
|
|
}, [])
|
|
|
|
|
2021-09-09 22:22:22 +00:00
|
|
|
return (
|
|
|
|
<div className="tldraw">
|
|
|
|
<TLDraw id={id} onMount={handleMount} />
|
|
|
|
</div>
|
|
|
|
)
|
2021-08-10 16:12:55 +00:00
|
|
|
}
|