AK on Nostr: #tech A good way to create a rich text copy-paste in JavaScript is to copy the target ...
#tech A good way to create a rich text copy-paste in JavaScript is to copy the target element / selection range into a shadow root with a white background and black text, and then copy that to the clipboard, so you get clean html instead of background and text colors.
Published at
2024-10-31 07:04:51Event JSON
{
"id": "dcd44f04e573b56db38329b79f277aa21493a947db788ef1996e663f5517d29b",
"pubkey": "fd29665a2e86e04df48113dc3f333f19d4938408405e3a659ce147b8bcf208c7",
"created_at": 1730358291,
"kind": 1,
"tags": [
[
"t",
"tech"
],
[
"proxy",
"https://mastodon.social/users/ak/statuses/113400760964555750",
"activitypub"
]
],
"content": "#tech A good way to create a rich text copy-paste in JavaScript is to copy the target element / selection range into a shadow root with a white background and black text, and then copy that to the clipboard, so you get clean html instead of background and text colors.",
"sig": "c8d729727699e95aff66e2adaab1e06418d8b36754b09a271395915f123670cca8972494fcb3dbb933fbda33050f3bfcbc3587c0635e7dd57545a182644de101"
}