Skip to content

Commit 2589f5e

Browse files
committed
fix(web): copying a selection inside a quote card keeps the quote link
A selection that covered only a card and its comment cloned neither the card's copy boundary nor a link that carried one, so the copy lost the quote's source.
1 parent 4841735 commit 2589f5e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎apps/web/src/components/chat/AssistantCitationChip.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,17 @@ export function AssistantCitationEmbed({
6565
const wholeResponse = citation.prefix === "" && citation.suffix === "";
6666
const flat = (text: string) => text.replace(/\s+/g, " ");
6767
const { comment, ...quoted } = citation;
68-
const { "data-markdown-copy": markdownCopy, ...linkProps } = useCitationSourceLinkProps(citation);
68+
const linkProps = useCitationSourceLinkProps(citation);
6969
return (
7070
// One copy boundary for the card and its comment, so a copied quote carries the comment once.
7171
<span
72-
data-markdown-copy={markdownCopy}
72+
data-markdown-copy={linkProps["data-markdown-copy"]}
7373
className={cn("block", !leading && "mt-[0.65rem]", !trailing && "mb-[0.65rem]")}
7474
>
7575
<Link
7676
{...linkProps}
77+
// A selection inside the card's boundary copies the quote here and the comment as text.
78+
data-markdown-copy={serializeAssistantCitation(quoted)}
7779
// The quote is findable in its source message; here it is clamped and mostly hidden.
7880
data-thread-find-ignore
7981
aria-label={`Go to quoted response: ${assistantCitationLabel(quoted)}`}

0 commit comments

Comments
 (0)