Hooks
usePaste
Listen for paste events on the canvas
The usePaste hook listens for paste events (Ctrl+V / Cmd+V) on the canvas.
import { usePaste } from "@gridland/web"Usage
function Editor() {
const [text, setText] = useState("")
usePaste((pasted) => {
setText((prev) => prev + pasted)
})
return <text>{text}</text>
}Parameters
| Param | Type | Description |
|---|---|---|
callback | (text: string) => void | Called with the pasted text |