fix(snippets): use regex to strip encoding from copied text

This commit is contained in:
HaloGamer33 2026-04-11 08:03:14 -06:00 committed by outfoxxed
parent a5025eeaab
commit 8e8f74df97
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E

View file

@ -166,7 +166,10 @@ const shikiCopyButton: ShikiTransformer = {
role: "button", role: "button",
"aria-label": "Copy to clipboard", "aria-label": "Copy to clipboard",
"alia-live": "polite", "alia-live": "polite",
"data-code": this.source, "data-code": this.source.replace(
/TYPE99(\w+.)99TYPE/g,
(_full: string, match: string) => getQMLTypeLinkObject(match).name,
),
onclick: ` onclick: `
navigator.clipboard.writeText(this.dataset.code); navigator.clipboard.writeText(this.dataset.code);
this.classList.add('copied'); this.classList.add('copied');