Clipboard data from Safari

Hello,

I am experience some weirdness with copy and pasting links within the context of Safari. When copying a link(title) within Safari via Right Click > Copy the clipboardData does not contain any data with key “text/html” but instead just plaintext of the url. As a result, we lose information about the title when pasting

This only occurs when performing the Right Click > Copy interaction in Safari. If copying the link with the combination of selection and cmd/ctrl + C keyboard shortcut, the clipboardData produce the expected outcome

Chrome and Firefox does not seem to have this issue.

At a glance, this sounds like more of a Safari issue than a ProseMirror issue. Does it behave the same when copying from non-ProseMirror content? Have you checked whether a copy event is fired at all when copying a link like this?

As an example, I created an a sample app with just a contenteditable div and copy a link (with a title) and pasted it in the div. The div was able to preserved both title and url format when pasted.

This led me to assume that the event object being passed thru the onPaste handler does not match up.

Answering your early questions:

  • Yes, I copied a link from a random webpage and it is the same behavior

When I right-click a link in Safari, I get a ‘Copy’ item in the menu, which copies the entire link as HTML, and a ‘Copy Link’ item, which copies the destination URL as text. I could not reproduce the issue with ‘Copy’ only copying the URL (in Safari 12).