diff options
Diffstat (limited to 'animism-align/frontend/app/views/paragraph/components')
| -rw-r--r-- | animism-align/frontend/app/views/paragraph/components/paragraph.list.js | 7 | ||||
| -rw-r--r-- | animism-align/frontend/app/views/paragraph/components/paragraphTypes/paragraphTypes.text.js | 40 |
2 files changed, 31 insertions, 16 deletions
diff --git a/animism-align/frontend/app/views/paragraph/components/paragraph.list.js b/animism-align/frontend/app/views/paragraph/components/paragraph.list.js index 94f4585..1a83569 100644 --- a/animism-align/frontend/app/views/paragraph/components/paragraph.list.js +++ b/animism-align/frontend/app/views/paragraph/components/paragraph.list.js @@ -38,14 +38,17 @@ class ParagraphList extends Component { const { id: currentParagraph, annotations } = paragraph let currentAnnotation let annotation - let i = 0 + let i = 0, next_i let len = annotations.length for (let i = 0; i < len - 1; i++) { - if (floatLT(play_ts, annotations[i+1].start_ts)) { + next_i = i + 1 + if (annotations[next_i].type === 'footnote') next_i += 1 + if (next_i < len && floatLT(play_ts, annotations[next_i].start_ts)) { currentAnnotation = annotations[i].id break } } + console.log(currentAnnotation) if (!currentAnnotation) { currentAnnotation = annotations[len-1].id } diff --git a/animism-align/frontend/app/views/paragraph/components/paragraphTypes/paragraphTypes.text.js b/animism-align/frontend/app/views/paragraph/components/paragraphTypes/paragraphTypes.text.js index 5eedaa0..f0529c8 100644 --- a/animism-align/frontend/app/views/paragraph/components/paragraphTypes/paragraphTypes.text.js +++ b/animism-align/frontend/app/views/paragraph/components/paragraphTypes/paragraphTypes.text.js @@ -11,20 +11,32 @@ export const Paragraph = ({ paragraph, currentParagraph, currentAnnotation, onAn className={className} onDoubleClick={e => onDoubleClick(e, paragraph)} > - {paragraph.annotations.map(annotation => ( - <span - key={annotation.id} - className={ - annotation.type === 'pullquote_credit' - ? 'pullquote_credit' - : annotation.id === currentAnnotation - ? 'current' - : '' - } - onClick={e => onAnnotationClick(e, paragraph, annotation)} - dangerouslySetInnerHTML={{ __html: ' ' + annotation.text + ' ' }} - /> - ))} + {paragraph.annotations.map(annotation => { + if (annotation.type === 'footnote') { + return ( + <span + key={annotation.id} + className='footnote' + onClick={e => onAnnotationClick(e, paragraph, annotation)} + dangerouslySetInnerHTML={{ __html: annotation.footnote_id }} + /> + ) + } + return ( + <span + key={annotation.id} + className={ + annotation.type === 'pullquote_credit' + ? 'pullquote_credit' + : annotation.id === currentAnnotation + ? 'current' + : '' + } + onClick={e => onAnnotationClick(e, paragraph, annotation)} + dangerouslySetInnerHTML={{ __html: annotation.text }} + /> + ) + })} </div> ) } |
