diff options
Diffstat (limited to 'animism-align/frontend/app/views/paragraph/components/paragraph.list.js')
| -rw-r--r-- | animism-align/frontend/app/views/paragraph/components/paragraph.list.js | 10 |
1 files changed, 9 insertions, 1 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 ae92f78..e1e7970 100644 --- a/animism-align/frontend/app/views/paragraph/components/paragraph.list.js +++ b/animism-align/frontend/app/views/paragraph/components/paragraph.list.js @@ -66,6 +66,7 @@ class ParagraphList extends Component { const { order: annotationOrder, lookup: annotationLookup } = this.props.annotation const { lookup: paragraphLookup } = this.props.paragraph let currentParagraph = {} + let sectionCount = 0 const paragraphs = [] // loop over the annotations in time order annotationOrder.forEach((annotation_id, i) => { @@ -83,7 +84,7 @@ class ParagraphList extends Component { return } // if this annotation is from a different paragraph, make a new paragraph - if (annotation.paragraph_id !== currentParagraph.id) { + if (annotation.type === 'header' || annotation.paragraph_id !== currentParagraph.id) { const paragraph_type = getParagraphType(annotation, paragraph) currentParagraph = { id: annotation.paragraph_id || ('index_' + i), @@ -92,6 +93,10 @@ class ParagraphList extends Component { end_ts: 0, annotations: [], } + if (annotation.type === 'header') { + currentParagraph.sectionIndex = sectionCount++ + currentParagraph.id = 'section_' + currentParagraph.sectionIndex + } paragraphs.push(currentParagraph) } // if this annotation is a paragraph_end, set the end timestamp @@ -142,6 +147,9 @@ class ParagraphList extends Component { } const getParagraphType = (annotation, paragraph) => { + if (annotation.type === 'header') { + return annotation.type + } if (!paragraph) { return annotation.type } |
