I think that's probably the most interesting part here. What happens for images? Do they get converted into an <img src="data:base-64;..." type thing?
I think that's probably the most interesting part here. What happens for images? Do they get converted into an <img src="data:base-64;..." type thing?
So when you copy an image from Finder in MacOS, if you paste it into a terminal you get the file path and if you paste it into a comment on github you get the contents of the file as a binary blob.
When pasting, an application is essentially querying the clipboard for a representation of the data it can use, and if there is none, it either defaults to something or fails.
In a well designed program, all of the translating and parsing is done before sending to the clipboard. If you copy text from MS Word and paste it into a content editable field in a website, you might expect some consistency.
> In a well designed program, all of the translating and parsing is done before sending to the clipboard.
To avoid unnecessary work a program can opt to delay rendering until it's pasted or the program is closed. This is why excel will sometimes ask you if you want to keep your clipboard on save.
Hard-fought consistency... https://github.com/ProseMirror/prosemirror-schema-basic/blob...
So, all-in-all, the clipboard contains still everything, the sanitize-html library would strip things from it that you wouldn't want, so that you're left with only the formatting you do want. As for images, since I'm stripping them out as well, there will not be any images. By default I'm not sure if they end up as base-64 (I'm leaning to believe that rather they would get local URL's like file://...).
Most modern apps will also copy an html fragment to the clipboard so the browser could use that directly.
According to stackoverflow, when you read from the clipboard in javascript the browser gives you access to its synthesised html version of the rtf content via ClipboardItem.getType. That's what you would expect, but I haven't tried it.