Skip to content

Commit

Permalink
Merge pull request #240 from MohamedRejeb/1.x
Browse files Browse the repository at this point in the history
Fix list items numbering issue
  • Loading branch information
MohamedRejeb authored Apr 7, 2024
2 parents 5c42a87 + 71ebcb6 commit 87178d4
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2321,8 +2321,8 @@ class RichTextState internal constructor(
)
visualTransformation = VisualTransformation { _ ->
TransformedText(
annotatedString,
OffsetMapping.Identity
text = annotatedString,
offsetMapping = OffsetMapping.Identity
)
}
styledRichSpanList.addAll(newStyledRichSpanList)
Expand All @@ -2340,17 +2340,15 @@ class RichTextState internal constructor(
private fun checkParagraphsType() {
var orderedListNumber = 0
var orderedListStartTextSpanStyle = SpanStyle()
richParagraphList.fastForEachIndexed { _, richParagraph ->
richParagraphList.forEach { richParagraph ->
val type = richParagraph.type
if (type is OrderedList) {
orderedListNumber++

if (orderedListNumber == 1)
orderedListStartTextSpanStyle = richParagraph.getFirstNonEmptyChild()?.spanStyle ?: SpanStyle()

if (orderedListNumber == type.number)

type.number = orderedListNumber
type.number = orderedListNumber
type.startTextSpanStyle = orderedListStartTextSpanStyle
} else {
orderedListNumber = 0
Expand Down

0 comments on commit 87178d4

Please sign in to comment.