-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Native mobile: don't set caret when rich-text text will get trimmed #15021
Conversation
@@ -624,6 +625,17 @@ export class RichText extends Component { | |||
} | |||
} | |||
|
|||
willTrimSpaces( html ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice opportunity to write some unit test against this method, so that we are always sure it's working like expected, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Will it be OK with you to do it in a separate PR, only to make sure we get this one merged today if possible? (to have at least a couple of days of testing until the code freeze)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, of course, I will finish testing very soon so that you can merge this one. @hypest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Addressing wordpress-mobile/gutenberg-mobile#871 on the native mobile side. The internal representation of rich-text in Aztec and the format-lib are not fully compatible or in-sync and we also use html to establish the communication between the two. That can lead to cases like the issue linked, where Aztec will do some trimming to remove spaces that are unimportant for html rendering, but format-lib won't so, making the caret positioning logic to get out of sync.
This PR will try to detect when such spaces will be removed and avoid telling Aztec where to put the caret and hope for the best 🤞.
How has this been tested?
Using the gutenberg-mobile side PR: wordpress-mobile/gutenberg-mobile#885
Types of changes
Try to detect when such spaces will be removed and avoid telling Aztec where to put the caret. Only affecting Android.
Checklist: