mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 08:04:45 +00:00
fix(desktop): fix text spacing in rich text viewer
Pure text paragraphs now render as a single Text composable instead of individual words in FlowRow, eliminating unwanted inter-word gaps. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+16
-6
@@ -186,12 +186,22 @@ fun DesktopRichTextViewer(
|
||||
}
|
||||
|
||||
else -> {
|
||||
FlowRow(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = if (paragraph.isRTL) Arrangement.End else Arrangement.Start,
|
||||
) {
|
||||
for (word in paragraph.words) {
|
||||
RenderSegment(word, state, localCache, callbacks)
|
||||
val hasOnlyText = paragraph.words.all { it is RegularTextSegment }
|
||||
if (hasOnlyText) {
|
||||
Text(
|
||||
text = paragraph.words.joinToString("") { it.segmentText },
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
} else {
|
||||
FlowRow(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = if (paragraph.isRTL) Arrangement.End else Arrangement.Start,
|
||||
) {
|
||||
for (word in paragraph.words) {
|
||||
RenderSegment(word, state, localCache, callbacks)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user