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 wordList = paragraph.trimEnd().split(wordBoundaryRegex).filter { it.isNotEmpty() }
if (wordList.isEmpty()) {
paragraphSegments.add(ParagraphState(persistentListOf(RegularTextSegment("")), isRTL))
} else {
val segments = ArrayList<Segment>(wordList.size)
wordList.forEach { word ->
segments.add(wordIdentifier(word, images, videos, urls, emojis, tags))
@@ -183,6 +187,7 @@ class RichTextParser {
paragraphSegments.add(ParagraphState(segments.toPersistentList(), isRTL))
}
}
val segmentsWithGalleries = GalleryParser().processParagraphs(paragraphSegments)