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

Send selection to editor.select on android #3024

Conversation

gracicot
Copy link
Contributor

This pull request depends on #3023

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

Bug

What's the new behavior?

Selections are sent to the editor.select command instead of ranges

How does this change work?

Instead of sending ranges, we take the existing selection from the editor and apply the range's anchor and focus.

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?

Reviewers: @ianstormtaylor

!isRangesEqual(editor.value.selection, range)
) {
editor.select(selectionFromRange(editor, range))
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These changes are mostly from #3023. These should disappear when merging it.

@gracicot gracicot changed the title Send selection android Send selection to editor.select on android Sep 18, 2019
@gracicot
Copy link
Contributor Author

I saw there is also onDrop that send a range into the editor.select command. Is the API allows this? If simple ranges are permitted in editor.select, then I'll simply close the pull request.

It also seem that partial object are usually allowed in commands. With #2495 a range is simply a partial selection.

If we want to move away from partial object, I can widen this pull request. But that's really up to you.

@gracicot
Copy link
Contributor Author

gracicot commented Oct 4, 2019

Ranges can be sent to editor.select and are handled correctly. I will close this for now.

@gracicot gracicot closed this Oct 4, 2019
@gracicot gracicot deleted the send-selection-android branch October 4, 2019 16:12
@gracicot gracicot restored the send-selection-android branch October 4, 2019 16:12
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.

1 participant