File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,18 @@ import '../styles/FragmentComment.css';
33function FragmentComment ( { children, setHighlightedText } ) {
44 try {
55 const citationRegex = / ^ \[ .* \] \s * \n ( .* ) $ / m;
6- if ( citationRegex . test ( children ) ) {
6+ if ( citationRegex . test ( children [ 0 ] ) ) {
77 let [ citation , comment ] = children [ 0 ] . split ( / \n / ) ;
88 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+
918 return < p
1019 onMouseEnter = {
1120 e => {
@@ -25,7 +34,7 @@ function FragmentComment({ children, setHighlightedText }) {
2534 title = "Highlight in document"
2635 >
2736 < span className = "citation" > { citation } </ span >
28- { comment }
37+ { commentParts }
2938 </ p > ;
3039 }
3140 } catch ( e ) {
You can’t perform that action at this time.
0 commit comments