Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padding after html tag #262

Open
nevrozza opened this issue Apr 29, 2024 · 6 comments
Open

Padding after html tag #262

nevrozza opened this issue Apr 29, 2024 · 6 comments

Comments

@nevrozza
Copy link

nevrozza commented Apr 29, 2024

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 nevrozza changed the title Padding after new tag Padding after html tag Apr 29, 2024
@MohamedRejeb
Copy link
Owner

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?

@nevrozza
Copy link
Author

nevrozza commented May 1, 2024

@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

@ChrisTitos
Copy link

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>.

@nevrozza
Copy link
Author

nevrozza commented Jun 7, 2024

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

@MohamedRejeb
Copy link
Owner

Let's keep it open for now.

@ChrisTitos
Copy link

ChrisTitos commented Jun 17, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants