Skip to content

Commit

Permalink
solved citation onclick issue in ReactMarkdown with custom component.
Browse files Browse the repository at this point in the history
  • Loading branch information
JSv4 committed Jun 10, 2024
1 parent 8f063dd commit bdfe0eb
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion frontend/src/components/queries/QueryResultsViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,24 @@ const QueryResultsViewer: React.FC<QueryResultsViewerProps> = ({
</Card>
<Segment>
<Header as="h3">Response</Header>
<ReactMarkdown>{query_obj.response || ""}</ReactMarkdown>
<ReactMarkdown
components={{
a: ({ href, children }) => (
<a
href={href}
onClick={(event) => {
event.preventDefault();
event.stopPropagation();
console.log(event, href);
}}
>
{children}
</a>
),
}}
>
{query_obj.response || ""}
</ReactMarkdown>
</Segment>
</Grid.Column>
</Grid>
Expand Down

0 comments on commit bdfe0eb

Please sign in to comment.