Getting images from clipboard pasted from Word on Windows

Hey all,

we are facing an issue with handling pastes of content with images from Word: on Windows, the DataTransfer does not include the images as separate items. Instead, they are stored as temporary files, and the HTML clipboard data will include links (<img src>) to those temp files. These files are of course not accessible from the web application. (On the Mac, the images are included properly as file items.)

I can’t think of a good way to get a hold of these images from our ProseMirror-based editor.

The only approach that I could find is quite horrific: extracting the image data from the text/rtf slice of the clipboard data. That seems to be how it works here: Word Copy-Paste | Textbox.io

Has anyone faced this issue and come up with a solution? Has anyone implemented the RTF method and would be willing to share a code snippet?

Thanks, Chris

I know this is digging up an old thread but did you ever have any breakthrough here?

Basically we had to write the code to get the images out of the RTF data as mentioned above. We resorted to some rather dirty code that I am not able to share at this point. You might be able to use an NPM package for RTF parsing, we didn’t do that but instead did very limited manual parsing of the RTF stream. The whole situation is an awful mess.