Fixes missing empty paragraphs
This commit is contained in:
+5
@@ -176,6 +176,10 @@ class RichTextParser {
|
|||||||
val isRTL = isArabic(paragraph)
|
val isRTL = isArabic(paragraph)
|
||||||
|
|
||||||
val wordList = paragraph.trimEnd().split(wordBoundaryRegex).filter { it.isNotEmpty() }
|
val wordList = paragraph.trimEnd().split(wordBoundaryRegex).filter { it.isNotEmpty() }
|
||||||
|
|
||||||
|
if (wordList.isEmpty()) {
|
||||||
|
paragraphSegments.add(ParagraphState(persistentListOf(RegularTextSegment("")), isRTL))
|
||||||
|
} else {
|
||||||
val segments = ArrayList<Segment>(wordList.size)
|
val segments = ArrayList<Segment>(wordList.size)
|
||||||
wordList.forEach { word ->
|
wordList.forEach { word ->
|
||||||
segments.add(wordIdentifier(word, images, videos, urls, emojis, tags))
|
segments.add(wordIdentifier(word, images, videos, urls, emojis, tags))
|
||||||
@@ -183,6 +187,7 @@ class RichTextParser {
|
|||||||
|
|
||||||
paragraphSegments.add(ParagraphState(segments.toPersistentList(), isRTL))
|
paragraphSegments.add(ParagraphState(segments.toPersistentList(), isRTL))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val segmentsWithGalleries = GalleryParser().processParagraphs(paragraphSegments)
|
val segmentsWithGalleries = GalleryParser().processParagraphs(paragraphSegments)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user