codemirror / dev

Development repository for the CodeMirror editor project
https://codemirror.net/
Other
5.44k stars 343 forks source link

iOS: Unable to paste links copied by share > copy #1350

Closed personalizedrefrigerator closed 3 months ago

personalizedrefrigerator commented 4 months ago

Describe the issue

Currently, links copied from some sources cannot be pasted into CodeMirror on iOS.

I've noticed this with links coped from the iOS share sheet, but not with links copied by long-pressing and selecting "copy".

More specifically, to reproduce:

  1. Open the CodeMirror discourse in iOS/Safari
  2. Click on the "Copy link" button such that the share sheet is opened. Screenshot: Copy link button
  3. Click "Copy" in the share sheet
  4. Open a CodeMirror editor and try to paste the link.

Browser and platform

iOS 17.3.1/Safari

Reproduction link

https://codemirror.net/try/?c=aW1wb3J0IHttaW5pbWFsU2V0dXAsIEVkaXRvclZpZXd9IGZyb20gImNvZGVtaXJyb3IiCgpuZXcgRWRpdG9yVmlldyh7CiAgZG9jOiAiLi4uIiwKICBleHRlbnNpb25zOiBtaW5pbWFsU2V0dXAsCiAgcGFyZW50OiBkb2N1bWVudC5ib2R5Cn0pCg==

personalizedrefrigerator commented 4 months ago

It seems that the clipboard data associated with such an event has only type text/uri-list.

marijnh commented 3 months ago

I suspect https://github.com/codemirror/view/pull/47 was trying to do this but misspelled the mime type (I can't find any references to text/uri-text online). Attached patch fixes that.