drag-drop icon indicating copy to clipboard operation
drag-drop copied to clipboard

Support text/uri-list MIME type for onDropText

Open Twixes opened this issue 4 years ago • 7 comments

This allows for drag-and-dropping links contained in HTML anchor elements, if there's no text data available.

Rationale: if using drag-drop in a place where URLs are expected, it's very convenient for dropping links to work not only with outright strings, but also with anchor tags which are common on websites – something like: <a href="https://example.com"><img src="bar"></a>. In this case .getData('text') is empty BUT .getData('text/uri-list') does have useful data – 'https://example.com' – and we should make use of this data.

Before, the user could only right-click, click "Copy link address", and somehow use that copied text in the target app. With this tiny change to drag-drop, the user can simply drag the anchor element to the target app – and that's it. Significant improvement to the user experience.

Please do release new version if this is merged.

Twixes avatar Apr 27 '21 23:04 Twixes

Bump?

Twixes avatar Jun 16 '21 19:06 Twixes

What browser are you using? I just tested the version on master and it seems to handle dropped anchor links just fine without the changes in this PR.

feross avatar Jun 30 '21 23:06 feross

Electron, specifically https://github.com/webtorrent/webtorrent-desktop

Twixes avatar Jun 30 '21 23:06 Twixes

@Twixes Can you confirm that this issue still exists on the latest version of electron, which I believe we're using on webtorrent-desktop on the master branch?

Let me know if latest Electron still has this issue.

feross avatar Jun 30 '21 23:06 feross

I just tried on webtorrent-desktop master and unfortunately still requires this PR to recognize <a href> elements that don't contain text.

Twixes avatar Jul 01 '21 09:07 Twixes

Bump?

Twixes avatar Sep 05 '21 17:09 Twixes

I'm sorry but this still doesn't quite work in the WebTorrent app! Perhaps we could get a solution in?

Twixes avatar Nov 03 '21 20:11 Twixes