Overview
onFileDrop(fn) attaches window-level dragover + drop handlers, prevents the browser from navigating to the dropped file, and passes the native DragEvent. Read files via e.dataTransfer.files.
onCopy, onCut, and onPaste receive ClipboardEvent. onSelectionChange receives the current Selection (or null). All listeners are removed on unmount.
Files & clipboard APIs
|
API
|
Event
|
Payload
|
|---|---|---|
onFileDrop(fn)
| window drop | fn(DragEvent) — use e.dataTransfer.files. |
onPaste(fn)
| paste | fn(ClipboardEvent) — text or files via clipboardData. |
onCopy / onCut(fn)
| copy / cut | Can preventDefault and setData. |
onSelectionChange(fn)
| selectionchange | fn(Selection | null) from window.getSelection(). |
onFileDrop — window file drop
Drop files onto the preview. onFileDrop prevents default navigation and delivers the DragEvent so you can read dataTransfer.files.
onPaste / onCopy / onSelectionChange
Select text, copy, and paste inside the preview to see clipboard and selection hooks update.