-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 editor.insertText never gets called inside plugins on Android #4753
Conversation
🦋 Changeset detectedLatest commit: 5880553 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @alessiogaldy , I will land this sometime in the next few days unless there are objections.
This code was added in #4734 and appears to very specifically not call |
Hi @TheSpyder~ |
Ah, my apologies. It looks like that code originally came from #4257: @clauderic, are you able to provide any insights here? |
I’ll test this again later today but I suspect that this caused a regression and now the text is inserted at the wrong position |
I checked, and it looks like setting
I was able to obtain the same behavior by replacing the Transforms.insertText call with:
Transforms.setSelection(editor, at)
Editor.insertText(editor, text) I am not sure if this is a good idea, but it seems to work. When testing on my phone I also noticed that when keyboard inputs are delayed, which seems to be needed to deal with edge cases on Android, the cursor sometimes jumps back and forth. I am happy to open a PR to add the |
Reading the ProseMirror source code that is referenced in |
…nstormtaylor#4753) * Call Editor.insertText instead of Transforms.insertText to allow overriding by plugins * Use Editor.insertText in android-input-manager * changeset
Description
Call
editor.insertText
instead ofTransforms.insertText
to allow overriding behavior in plugins.Issue
Fixes: #4709
I was able to verify that this now works correctly on my Android device, but I am not sure how to add a test for this.
Checks
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)yarn changeset add
.)