Fixes missing empty paragraphs

This commit is contained in:
Vitor Pamplona
2026-03-01 12:59:29 -05:00
parent cd18fdf79a
commit fbdc8791cd
@@ -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)