Repository navigation
v1.14.0
Minor Changes
-
6140182: Add
react-smart-copy/link: copy links that paste well everywhere and link to a passage of a page.linkPayloadcopies a titled<a>link and the URL, so Slack, Google Docs, Notion, Teams and mail paste the title as a link and editors paste the URL. Plain text can be the URL, the title, both, or Markdown.{ target: "drag" }addstext/uri-listandtext/x-moz-urlforuseDragCopy.- Every URL is resolved and checked: only
https:,http:,mailto:andtel:by default (neverjavascript:ordata:), user names and passwords removed, international domains in punycode. Titles are cleaned of hidden and reordering characters, capped, and escaped. cleanLinkUrlandclean: trueremove tracking parameters (utm_*,fbclid,gclid,msclkidand more) and keep everything else.textFragmentUrlandselectionLinkmake links that scroll to and highlight a passage (#:~:text=), with each term inside one block and context added when the passage repeats.readLinkreads the one link a paste or drop holds, with its title.pasteAsLinkturns selected text into a link when a URL is pasted over it, keeping the browser's undo.- No dependencies, about 4 kB;
linkPayloadalone is about 1.8 kB. Works on the server with abase.
The README's drag-to-copy example now uses
linkPayload, which escapes the title and checks the URL.