MohamedRejeb / Compose-Rich-Editor

A Rich text editor library for both Jetpack Compose and Compose Multiplatform, fully customizable, supports HTML and Markdown.
https://mohamedrejeb.github.io/Compose-Rich-Editor/
Apache License 2.0
880 stars 54 forks source link

Bulleted list render with ul/li html tags #290

Open maltsev-gorskij opened 1 month ago

maltsev-gorskij commented 1 month ago

Hello.

Got two problems related to bulleted list render from html source. For example this code block

<strong>Sample header:</strong>
<ul>
   <li style="font-size:13px;">Long multiline text. Long multiline text. Long multiline text.</li>
   <li style="font-size:13px;">Long multiline text. Long multiline text. Long multiline text.</li>
</ul>

render this image

with this composable function

@Composable
fun HtmlContent(
    html: String,
    modifier: Modifier = Modifier,
    textStyle: TextStyle = MyTheme.typography.body14Normal
) {
    val state = rememberRichTextState()

    LaunchedEffect(html) {
        state.setHtml(html)
        state.selection = TextRange.Zero
    }

    BasicRichTextEditor(
        state = state,
        enabled = false,
        readOnly = true,
        textStyle = textStyle,
        modifier = modifier
    )
}

Here i have two problems

  1. Can you please explain or give some example of how can i control padding from the start of the line to dot icon rendered by <li> tag? For now, padding of list items from the start of the line is really big and i want to control it somehow.
  2. Second line of multiline <li>Some long multiline text</li>are moved to the left by comparison to the first line. Maybe i have done something wrong and it is possible to have all lines start from the same point? Look at this sample picture. Here "m" character somehow must be under "L" character image
Deorigami commented 1 month ago

do you have solution for this ?

MohamedRejeb commented 1 month ago

Hi, Thanks for opening this issue.

  1. You can control the padding of lists using: richTextState.config.listIndent = 28
  2. That's not the correct behavior, I will fix it.
maltsev-gorskij commented 1 month ago

Hi, Thanks for opening this issue.

  1. You can control the padding of lists using: richTextState.config.listIndent = 28
  2. That's not the correct behavior, I will fix it.

Thanks a lot. I'll try this config param and wait for my second problem hotfix!