Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

[Android] HtmlToSpansParser should add a line break automatically after a block element #862

Open
jmartinesp opened this issue Nov 14, 2023 · 4 comments

Comments

@jmartinesp
Copy link
Contributor

jmartinesp commented Nov 14, 2023

I was doing some testing on Android when I got this result:

image

Above is the composer, below is a text view with the result from the HTML generated above. I plugged in the debugger and I found the composer rendered this:

<ol><li>test</li></ol><p>hmmm</p>

While the html passed to the text view for rendering was:

<ol><li>test</li></ol>hmmm

This happens after all block elements (lists, code blocks, quotes, etc.).

Adding a 2nd new line/paragraph actually seems to workaround the issue, but the HTML still differs.

Composer:

<ol><li>test</li></ol><p> </p><p>hmmm</p>

TextView:

<ol><li>test</li></ol><br />ah
@jonnyandrew
Copy link
Contributor

The difference in the HTML between the editor and the text view is expected; what you see in the editor is the internal representation whereas the text view is being fed the stripped down HTML which is formatted as if it is a message. Hence why the text view may contain <br /> and the editor contains empty <p>s.

So the issue here (I think) is that the text view is not rendering a line break after the <ol> block?

@jmartinesp
Copy link
Contributor Author

jmartinesp commented Nov 20, 2023

So the issue here (I think) is that the text view is not rendering a line break after the <ol> block?

Yeah sorry, I didn't realise the RTE library was translating something like <p>Test</p> to Test<br /> and not <br />Test. There's probably some missing case for handling the end of a list in the Rust code.

@jonnyandrew
Copy link
Contributor

Are you sure this is an issue with the HTML? My understanding was that there should be an implicit line break after a block in HTML: https://jsfiddle.net/78nujox1/

@jmartinesp
Copy link
Contributor Author

Are you sure this is an issue with the HTML? My understanding was that there should be an implicit line break after a block in HTML: jsfiddle.net/78nujox1

I think you're right, thanks for the example. In my mind we could only mix block elements with block elements, but in HTML you can mix block elements and inline ones, creating 'virtual' block ones. I guess we'll need to adapt block elements like this to render an extra line break in Android.

@jmartinesp jmartinesp changed the title HTML seems to be exported without paragraphs or new lines for single line break [Android] HtmlToSpansParser should add a line break automatically after a block element Nov 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants