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

Prevents selection after ZWSP character #1552

Merged
merged 4 commits into from
Nov 8, 2019
Merged

Conversation

koke
Copy link
Member

@koke koke commented Nov 6, 2019

The original issue was that when tapping on an empty RichText, the selection was going to the end of the text by default. As we use the ZWSP character as a placeholder, the selection was after that character, and the keyboard appeared in lowercase mode.

I have a fix that corrects this, but I'm not 100% sure if this is the best place to fix it.

Fixes #1530

To test:

Some scenarios to reproduce the issue:

  • Insert a media-text block and tap on the empty paragraph
  • On a blank new post, tap on the placeholder, then tap again
  • On a blank new post, dismiss the keyboard, then tap on the post title

Update release notes:

  • If there are user facing changes, I have added an item to RELEASE-NOTES.txt.

// MARK: - Selection
private func correctSelectionAfterZWSP() {
guard selectedTextRange?.start == endOfDocument,
text == String(.zeroWidthSpace) else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we could associate the check with this configuration in common init: https://github.com/wordpress-mobile/gutenberg-mobile/pull/1552/files#diff-ad68d1bf3bf68556db4be6e6215573adL136

Just in case the character changes in the future?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, pushed a change to make it more generic

Copy link
Contributor

@SergioEstevao SergioEstevao left a comment

Choose a reason for hiding this comment

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

Thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Media & Text keyboard is set to lowercase
2 participants