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

Fix soft breaks on android using the diff's cursor #3049

Conversation

gracicot
Copy link
Contributor

@gracicot gracicot commented Oct 4, 2019

Is this adding or improving a feature or fixing a bug?

Fixing a bug

Here's a video before the fix
The soft break is done before the letter.

What's the new behavior?

We use the cursor position from the diff before applying the break.

Here's a video after the fix

How does this change work?

Previously, the editor would save a selection with the wrong offset, and apply that selection before doing the soft break. That would usually apply the soft break before the letter or the word that was entered.

To fix the issue, we accumulate previous adjacent text nodes offset and we also use the diff's cursor to apply the selection before splitting blocks.

Have you checked that...?

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn prettier.)
  • The relevant examples still work. (Run examples with yarn watch.)

Does this fix any issues or need any specific reviewers?

Fixes: #
Reviewers: @thesunny @ianstormtaylor

@ianstormtaylor
Copy link
Owner

Hey, there are lots of open Android-related issues that are out of date with the latest 0.50 release because the codebase was completely rearchitected. We'll need to figure out how to have proper support for Android going forward based on beforeinput events somehow. I'm tracking this in #3112, so I'm going to close this in favor of that one.

If it cannot be implemented simply in core with beforeinput we'll likely need to have a separate plugin for android support be created, because it's too much of a departure from all of the other simpler logic in core and very hard for me to test or respond to issues. Using a separate plugin should be possible now as the newest version simplifies a lot of the internals.

Thank you for understanding.

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

Successfully merging this pull request may close these issues.

2 participants