Paste system's screenshot

For example, if I’m on my Windows 10, and I press my keyboard’s ‘Print Screen’ key, I would like the screenshot to show up in my editor in a <img /> when I do ‘ctrl-v’ to paste it.

Any ideas how to make that possible?

Edit: Sorry I should add- I have tried creating Plugin and hook up the paste and handlePaste but they all returned empty data in the clipboardData when I paste…

There may be a file in the clipboard data. I’m not sure how Windows 10 screen shots work.

1 Like

(Sorry for beating this horse)

I’m still clueless about this. Copy and paste screenshots(like in Firefox’s built-in screenshot tool) works on a simple div contenteditable like here but not in Prosemirror.

hmm looks like browsers don’t allow Javascript access to clipboard. I wonder how Medium, gmail do it though.

EDIT: OK I figured it out! Please delete this thread lol

Care to mention what the solution was, for the next person who lands on this thread through a search? Was the image in DataTransfer.files?

Sure, although it has nothing to do with Prosemirror…

So I answered myself in this SO post

In short, just do console.log(event.clipboardData.files[0]) and its there…