Your own paste and drop handlers
A Tool without a Block — your own handlePaste and handleDrop, with a refusal shown as a Field notice via showNotice.
The Editor has no onPaste or onDrop props of its own: paste is handled by an
extension in the Extensions (engine) of a custom Tool, which sets up
a ProseMirror plugin. A Tool doesn't have to carry a Block: this one is pure behavior.
Try it
Copy #42 and paste it into the field: it becomes a link to the issue. Drop a PDF and a
Field notice (showNotice) appears under the field.
How it works
Your handlers run before the built-in ones
handlePaste and handleDrop of your Tool receive the event before Markdown paste and image
upload do, wherever the Tool sits in tools. If a handler returns true, the event counts as
handled: the built-in handlers don't receive it.
The Schema always applies
Whatever a paste brings beyond the Schema is dropped, and transformPastedHTML cannot weaken the
sanitization. The link in the example passes because the link Tool is in basic.
Field notice
The Field notice (showNotice) is one per field: error shows as a
role="alert" line until the next User edit, status is only announced. A new one replaces the old;
the kit reports images through the same channel.
Other files are the Tool's concern
A file that none of your handlers claims reaches the kit: an image goes to onUploadImage, anything
else gets the Field notice “… is not an image”.