TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
8.09k stars 1.19k forks source link

[IDEA] Migrate copy to clipboard function to use native Clipboard API #8615

Open Leilei332 opened 2 months ago

Leilei332 commented 2 months ago

The current implementation of the copy to clipboard is to create a textarea and use document.execCommand('copy') to copy the text, which is deprecated and strange. The Clipboard API is more modern and supports copying with more MIME types (like images and html). This enables extending the current copy to clipboard function to copy different types of data.

The downside of this attempt is that it requires browser released after 2020. So it is not capable with older browsers.

pmario commented 2 months ago

Also see those discussions: Especially the first 2 points

Jermolene commented 1 month ago

It would be nice if the core could use the new API if available, falling back to the previous implementation if not.