Skip to content

Pass current selection data to the rich-text component - #13978

Closed
hypest wants to merge 1 commit into
rnmobile/release-v1.0from
rnmobile/set-selection-on-richtext
Closed

hypest wants to merge 1 commit into
rnmobile/release-v1.0from
rnmobile/set-selection-on-richtext

Conversation

@hypest

@hypest hypest commented Feb 20, 2019 •

Copy link
Copy Markdown
Contributor

Description

Adds "setSelection" functionality to the rich-text component for native mobile. This is currently used to make sure the component sets the caret position to the beginning of the text when splitting a block into two.

How has this been tested?

Use this gutenberg-mobile side PR: wordpress-mobile/gutenberg-mobile#629

Types of changes

Adds a "selection" prop to the RichText component and wires it up to the local state kept for selectionStart and selectionEnd. The (native) component itself ignores the re-render if the values passed are of an older eventCount event. This way, the onSelectionChange event doesn't cause a loop.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

The component will ignore the data if old.
@hypest hypest added this to the Mobile v1.0 milestone Feb 20, 2019
@hypest
hypest requested a review from daniloercoli February 20, 2019 16:46
@hypest hypest added the Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) label Feb 20, 2019
@hypest

hypest commented Mar 8, 2019

Copy link
Copy Markdown
Contributor Author

Closing as "wontmerge". The changes here are no longer needed since the gutenberg-mobile side PR introduced a fix that needs no changes in the Gutenberg side.

@hypest hypest closed this Mar 8, 2019
@hypest
hypest deleted the rnmobile/set-selection-on-richtext branch March 8, 2019 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant