Can we paste an image on our custom event

If we want to paste an image without copying it to clipboard i.e paste and image on any custom event like an API call result or a click. Is there any way to handle this ?

As in, insert an image at the cursor position? Transaction.replaceSelectionWith can help with that.