-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Apparently since 2024 there is now widespread support for writing HTML to the clipboard.
https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/write
This would allow the share recipe modal to transparently copy both plain text and HTML versions of a link, and if it supports HTML, the receiving application could display the link using it's human readable name.
It seems the key code to modify would be
| await navigator.clipboard.writeText(text); |
The new code would do something like:
try {
const html = `<a href="${url}">${text}</a>`;
await navigator.clipboard.write([
new ClipboardItem({
"text/plain": new Blob([url], { type: "text/plain" }),
"text/html": new Blob([html], { type: "text/html" })
})
]);
} catch (err) {
await navigator.clipboard.writeText(url);
}NoelDeMartin
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request