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

[Android] Fix: split editor and message mode in html parsing #27

Merged

Conversation

jmartinesp
Copy link
Member

When we translate HTML to spans in Android, we want the paragraph tags (<p>) to translate to a double line break ( \n\n) since Android doesn't have support for inter-paragraph spacing and we need to simulate this by using this workaround.

However, this is not something we can support in the actual editor since it would break the index matching, add new points in the text that can be selected, removed, etc. and would make it crash.

So we end up having to differentiate between HTML parsing for the editor and HTML parsing to display in messages to support this change. Also, this means the rendering on the editor and what's rendered later for the sent message might not match 1:1 as until now.

When we translated HTML to spans in Android, we want the paragraph tags (`<p>`) to translate to a double line break ( `\n\n`) since Android doesn't have support for inter-paragraph spacing and we need to simulate this by using this workaround.

However, this is not something we can support in the actual editor since it would break the index matching, add new points in the text that can be selected, removed, etc. and would make it crash.

So we end up having to differentiate between HTML parsing for the editor and HTML parsing to display in messages to support this change. Also, this means the rendering on the editor and what's rendered later for the sent message might not match 1:1 as until now.
@codecov-commenter
Copy link

codecov-commenter commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.33%. Comparing base (0fc68b5) to head (3799726).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #27      +/-   ##
==========================================
- Coverage   90.16%   89.33%   -0.83%     
==========================================
  Files         179      104      -75     
  Lines       22240    18008    -4232     
  Branches      291      291              
==========================================
- Hits        20053    16088    -3965     
+ Misses       2184     1917     -267     
  Partials        3        3              
Flag Coverage Δ
uitests ?
uitests-ios ?
unittests 89.33% <ø> (+0.28%) ⬆️
unittests-ios ?
unittests-react 88.25% <ø> (ø)
unittests-rust 89.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@jmartinesp jmartinesp force-pushed the fix/android-split-editor-and-message-mode-in-html-parser branch 14 times, most recently from c894cf6 to 1d5ddc2 Compare November 25, 2024 11:12
@jmartinesp
Copy link
Member Author

I had to also workaround the NDK version selection, which for some reason didn't work in CI anymore...

@jmartinesp jmartinesp force-pushed the fix/android-split-editor-and-message-mode-in-html-parser branch from 1d5ddc2 to 717f285 Compare November 25, 2024 11:41
@jmartinesp jmartinesp force-pushed the fix/android-split-editor-and-message-mode-in-html-parser branch from 717f285 to 3799726 Compare November 25, 2024 11:42
Copy link

sonarcloud bot commented Nov 25, 2024

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@jmartinesp jmartinesp merged commit 1ecae29 into main Nov 25, 2024
8 checks passed
@jmartinesp jmartinesp deleted the fix/android-split-editor-and-message-mode-in-html-parser branch November 25, 2024 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants