Repository navigation
[Android] setSelection for Aztec wrapper - #629
Conversation
Currently, it just mirrors to Aztec what the internal state vars hold. This also has the desirable effect of setting the selection to 0,0 on block split.
|
I noticed that sometimes when tapping on another block, say you tap between two words, the caret is initially placed at the "point of the tap", but immediately after moved to the end of the text. To reproduce the issue
(to replicate the issue you need to modify the content of the first block). |
|
Confirmed. Will need to fix that. |
|
I've revised the solution to take another route: Removed the setting of selection, and instead, added a MovementMethod that places the caret at the beginning of text when focusing the view. The Android default is to place is at the end, but in our case, placing it at the start is more appropriate. Now, we might want to place the caret at the end in some cases, and we shall make the custom MovementMethod smarter then. Ready for another pass @daniloercoli , thanks! Btw, the Gutenberg-side PR is no longer needed and will close it when we finalize this PR. |
mzorz
left a comment
There was a problem hiding this comment.
code LGTM, tried it quite a bit and it works as advertised, only thing I noticed is some lag when splitting the blocks but it doesn't seem to be a problem of this PR in particular.
I tried using large pieces of text and short words and the lag seems to be the same on both, so, doesn't seem related to content length.
![]()
Fixes #602
This PR introduces a "setSelection" functionality to the Aztec wrapper component. It is currently wired up to theRichTextcomponent as a prop and updated every time the locally keptselectionStartandselectionEndchanges. See WordPress/gutenberg#13978.With this setting of selection, the caret position is set to 0 for the newly created block from the block split.This PR adds a
MovementMethodthat places the caret at the beginning of text when focusing the view. The Android default is to place is at the end, but in our case, placing it at the start is more appropriate.To test: