compose-rich-editor icon indicating copy to clipboard operation
compose-rich-editor copied to clipboard

Padding after html tag

Open nevrozza opened this issue 9 months ago • 6 comments

I'm making an epub reader app. Where people can change lineHeight. But it doesn't work after "</p>".

Is it bag or I can fix it?

//BasicRichTextEditor
textStyle = TextStyle.Default.copy(
                 fontSize = model.fontSize * 20.sp,
                 textAlign = TextAlign.Center,
                 lineHeight = 20.sp * model.fontSize * model.height,
                 lineBreak = LineBreak.Simple,
                 color = fontColor,
                 fontFamily = fontFamily
)

image

nevrozza avatar Apr 29 '24 20:04 nevrozza

Hi, Thanks for opening this issue, it looks like Compose is only adding the line height between lines of the same paragraph but not between paragraphs. Can you send me an html sample?

MohamedRejeb avatar May 01 '24 08:05 MohamedRejeb

@MohamedRejeb Hi! I think you are absolutely right

only adding the line height between lines of the same paragraph but not between paragraphs.

Attached a file: peacen'war.zip

nevrozza avatar May 01 '24 12:05 nevrozza

Yes we also noticed this. Seems to be reported here: https://issuetracker.google.com/issues/301126824

This is actually a pretty annoying usability issue for a rich text editor. I'm pretty sure users will be adding extra new lines to get the blank line in between paragraphs. Which will result in <p>Line 1</p><br><p>Line 2</p>.

ChrisTitos avatar Jun 07 '24 14:06 ChrisTitos

@ChrisTitos should I close this issue? (I'm newbie GitHub)

nevrozza avatar Jun 07 '24 15:06 nevrozza

Let's keep it open for now.

MohamedRejeb avatar Jun 10 '24 18:06 MohamedRejeb

@MohamedRejeb do you have any ideas on how we can best tackle this issue. I'm referring to the editor use case specifically, but I guess it also applies for the reported case.

To reiterate, the main problem for us is going to be that users will add extra blank lines after paragraphs, as well as no blank lines appearing for texts that were already submitted.

I was thinking perhaps we can automatically add a <br> after each </p> or something, and then strip those out again when we submit the text to our API. You think that could work ? Or is there perhaps something that can be done on the library side

ChrisTitos avatar Jun 17 '24 11:06 ChrisTitos