Skip to content

[RNMobile] add isSelected prop to PlainText-backed blocks#11989

Merged
mzorz merged 6 commits intomasterfrom
rnmobile/is-selected-plain-text
Nov 16, 2018
Merged

[RNMobile] add isSelected prop to PlainText-backed blocks#11989
mzorz merged 6 commits intomasterfrom
rnmobile/is-selected-plain-text

Conversation

@mzorz
Copy link
Copy Markdown
Contributor

@mzorz mzorz commented Nov 16, 2018

Description

This is a follow up PR to #11857, bringing the same functionality to PlainText-backed blocks:

  • Promotes PlainText implementation to be a React Native component (so we can make use of the lifecycle events more clearly)
  • adds isSelected prop to Code and More blocks

By doing this, we can make it easier to handle the focus at the low level when isSelected is true.

How has this been tested?

To be tested as per indicated in wordpress-mobile/gutenberg-mobile#250

  1. make sure to select a block (tap on a block and see the up/down arrows appear, etc)
  2. now tap on the + inserter icon
  3. choose one of Code or More blocks (the only ones that currently are backed by PlainText implementation)
  4. observe the new block is inserted, the block is shown as selected (it has the up/down arrows and such) and the cursor starts blinking there (that is, it got the focus).

Screenshots

Before, the focus would not be gotten when a new "PlainText"-backed block was inserted:
cursor_after_insert_okno

Now, the cursor appears blinking after insertion:
cursor_after_insert_ok

Types of changes

Bug fix (non-breaking change which fixes an issue)

@mzorz mzorz added Mobile Web Viewport sizes for mobile and tablet devices Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) labels Nov 16, 2018
@mzorz mzorz requested review from daniloercoli and hypest November 16, 2018 16:02
@mzorz mzorz requested a review from etoledom November 16, 2018 17:13
export default function CodeEdit( { attributes, setAttributes, style } ) {
export default function CodeEdit( props ) {
const { attributes, setAttributes } = props;
const { style } = attributes;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems that style should be retrieved from props.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

my bad, addressed in 5f03b77

@daniloercoli
Copy link
Copy Markdown
Contributor

LGTM once Travis is happy.

@daniloercoli daniloercoli self-requested a review November 16, 2018 17:47
@mzorz mzorz merged commit f9ddd68 into master Nov 16, 2018
@mzorz mzorz deleted the rnmobile/is-selected-plain-text branch November 16, 2018 18:07
@mzorz mzorz restored the rnmobile/is-selected-plain-text branch November 17, 2018 15:42
@catehstn catehstn added this to the 4.5 milestone Nov 19, 2018
@aduth aduth deleted the rnmobile/is-selected-plain-text branch January 25, 2019 21:37
@gziolo gziolo removed the Mobile Web Viewport sizes for mobile and tablet devices label Oct 10, 2019
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.

4 participants