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

[RNMobile] Fix pasting text on Post Title #16116

Merged
merged 2 commits into from Jun 12, 2019

Conversation

@etoledom
Copy link
Contributor

commented Jun 12, 2019

fixes wordpress-mobile/gutenberg-mobile#1099

This PR fixes an issue where pasting text on post title was behaving as pressing Enter key when the title field is empty.
Pasting send an event to onReplace, that was wired directly to onEnterPress.

This PR fixes the issue by adding an onEnter prop to RichText, adding the ability to handle custom onEnter handling when needed.

This PR does NOT fix pasting multi-paragraph text. I investigated multi-paragraph pasting and it will take some effort and discussion. I think the best would be to not use RichText on PostTitle, but let's have this discussion on another ticket.

gutenberg-mobile side PR: wordpress-mobile/gutenberg-mobile#1123

To test:

  • Run the demo app.
  • Select the Post Title field.
  • Delete its current content.
  • Paste some text inside the empty Post Title.
  • Check that paste works as expected.
  • Press Enter.
  • Check that it creates a new block and it gets focused as expected.

@etoledom etoledom self-assigned this Jun 12, 2019

@etoledom etoledom referenced this pull request Jun 12, 2019
1 of 1 task complete

@etoledom etoledom requested a review from SergioEstevao Jun 12, 2019

@etoledom etoledom marked this pull request as ready for review Jun 12, 2019

@SergioEstevao
Copy link
Contributor

left a comment

Good catch!

@etoledom etoledom merged commit 2e83587 into master Jun 12, 2019

1 of 7 checks passed

Filter merged Filter merged
Details
Filter merged Filter merged
Details
Filter merged Filter merged
Details
Filter merged Filter merged
Details
Filter merged Filter merged
Details
Filter merged Filter merged
Details
Travis CI - Pull Request Build Passed
Details
@etoledom

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

Thank you!

@etoledom etoledom deleted the rnmobile/1099-paste-on-post-title branch Jun 12, 2019

@github-actions github-actions bot added this to the Gutenberg 5.10 milestone Jun 12, 2019

@Soean Soean modified the milestones: Gutenberg 5.10, Gutenberg 6.0 Jun 13, 2019

daniloercoli added a commit that referenced this pull request Jun 14, 2019

Merge branch 'master' of https://github.com/WordPress/gutenberg into …
…rnmobile/open-video-by-browser-for-android

* 'master' of https://github.com/WordPress/gutenberg: (34 commits)
  [RNMobile] Native mobile release v1.7.0 (#16156)
  Scripts: Document and simplify changing file entry and output of build scripts (#15982)
  Block library: Refactor Heading block to use class names for text align (#16035)
  Make calendar block resilient against editor module not being present (#16161)
  Bump plugin version to 5.9.1
  Editor: Fix the issue where statics for deprecated components were not hoisted (#16152)
  Build Tooling: Use "full" `npm install` for Build Artifacts Travis task (#16166)
  Scripts: Fix naming conventions for function containing CLI keyword (#16091)
  Add native support for Inserter (Ported from gutenberg-mobile) (#16114)
  docs(components/higher-order/with-spoken-messages): fix issue in example code (#16144)
  docs(components/with-focus-return): fix typo in README.md (#16143)
  docs(block-editor/components/inspector-controls): fix image path in README.md (#16145)
  Add mention of on Figma to CONTRIBUTING.md (#16140)
  Bring greater consistency to placeholder text for media blocks. (#16135)
  Add descriptive text and a link to embed documentation in embed blocks (#16101)
  Update toolbar-text.png (#16102)
  Updating changelogs for the Gutenberg 5.9 packages release
  chore(release): publish
  [RNMobile] Fix pasting text on Post Title (#16116)
  Bump plugin version to 5.9.0
  ...

# Conflicts:
#	packages/block-library/src/video/video-player.android.js

nicolad added a commit to nicolad/gutenberg that referenced this pull request Jun 15, 2019

[RNMobile] Fix pasting text on Post Title (WordPress#16116)
* Add onEnter prop to RichText to allow custom handling of onEnter

* Remove reduntant line
@designsimply

This comment has been minimized.

Copy link
Member

commented Jul 3, 2019

I think the best would be to not use RichText on PostTitle, but let's have this discussion on another ticket.

Eventually, the title should become a block (in case that impacts your thinking here). See #11553.

@designsimply

This comment has been minimized.

Copy link
Member

commented Jul 3, 2019

Tested all sorts of pasting of single-line content into the title field in the mobile block editor using WPAndroid alpha-177 (12.8 alpha) on Pixel 3 Android 9 and it worked as expected. Also checked that I could undo changes and undo worked well (which I found helpful!).

jg314 added a commit to jg314/gutenberg that referenced this pull request Jul 19, 2019

[RNMobile] Fix pasting text on Post Title (WordPress#16116)
* Add onEnter prop to RichText to allow custom handling of onEnter

* Remove reduntant line

sbardian added a commit to sbardian/gutenberg that referenced this pull request Jul 29, 2019

[RNMobile] Fix pasting text on Post Title (WordPress#16116)
* Add onEnter prop to RichText to allow custom handling of onEnter

* Remove reduntant line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.