We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b1a8e37 commit 509cc60Copy full SHA for 509cc60
1 file changed
frontend/src/components/FragmentComment.jsx
@@ -3,9 +3,18 @@ import '../styles/FragmentComment.css';
3
function FragmentComment({ children, setHighlightedText }) {
4
try {
5
const citationRegex = /^\[.*\]\s*\n(.*)$/m;
6
- if (citationRegex.test(children)) {
+ if (citationRegex.test(children[0])) {
7
let [citation, comment] = children[0].split(/\n/);
8
citation = citation.replace(/[[\]]/g, '');
9
+ const commentParts = [
10
+ comment,
11
+ ...children.slice(1)
12
+ ].map((part, index) => (
13
+ <span key={index}>
14
+ {part}
15
+ </span>
16
+ ));
17
+
18
return <p
19
onMouseEnter={
20
e => {
@@ -25,7 +34,7 @@ function FragmentComment({ children, setHighlightedText }) {
25
34
title="Highlight in document"
26
35
>
27
36
<span className="citation">{citation}</span>
28
- {comment}
37
+ {commentParts}
29
38
</p>;
30
39
}
31
40
} catch (e) {
0 commit comments