Fix HTML entities appearing in copied issue text
Decode HTML entities (e.g.  ) from title and description before copying to clipboard, and trim trailing whitespace. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -592,7 +592,14 @@ export function IssueDetail() {
|
|||||||
|
|
||||||
const copyIssueToClipboard = async () => {
|
const copyIssueToClipboard = async () => {
|
||||||
if (!issue) return;
|
if (!issue) return;
|
||||||
const md = `# ${issue.identifier}: ${issue.title}\n\n${issue.description ?? ""}`;
|
const decodeEntities = (text: string) => {
|
||||||
|
const el = document.createElement("textarea");
|
||||||
|
el.innerHTML = text;
|
||||||
|
return el.value;
|
||||||
|
};
|
||||||
|
const title = decodeEntities(issue.title);
|
||||||
|
const body = decodeEntities(issue.description ?? "");
|
||||||
|
const md = `# ${issue.identifier}: ${title}\n\n${body}`.trimEnd();
|
||||||
await navigator.clipboard.writeText(md);
|
await navigator.clipboard.writeText(md);
|
||||||
setCopied(true);
|
setCopied(true);
|
||||||
pushToast({ title: "Copied to clipboard", tone: "success" });
|
pushToast({ title: "Copied to clipboard", tone: "success" });
|
||||||
|
|||||||
Reference in New Issue
Block a user