bbee7bc2b2
* adds copy and paste, scopes keyboard events to focused elements * Fix tools panel bug, adds copy across documents * Makes autofocus default
20 lines
463 B
TypeScript
20 lines
463 B
TypeScript
import { TLDraw } from '@tldraw/tldraw'
|
|
import React from 'react'
|
|
|
|
interface EditorProps {
|
|
id?: string
|
|
}
|
|
|
|
export default function Editor({ id = 'home' }: EditorProps) {
|
|
const handleMount = React.useCallback((tlstate) => {
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore
|
|
window.tlstate = tlstate
|
|
}, [])
|
|
|
|
return (
|
|
<div className="tldraw">
|
|
<TLDraw id={id} onMount={handleMount} autofocus />
|
|
</div>
|
|
)
|
|
}
|