-
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
The first letter is typing twice on Android #5493
Comments
I reproduce this behaviour when composing Chinese Characters in the same env |
We are also facing this problem |
This is also happening when compose in English Screen.Recording.2023-09-28.at.12.24.48.PM.mov |
Digging into the source code When the issue occur, the slate/packages/slate/src/interfaces/transforms/text.ts Lines 74 to 90 in 0bdff51
At this moment the offset of anchor and focus from at is both 1 which is unexpected, should be 0 for anchor and 1 for focus
The variable
Don't know if is something wrong with the normalization |
Found out it might be an issue from slate/packages/slate-react/src/hooks/android-input-manager/android-input-manager.ts Lines 178 to 180 in 0bdff51
|
Maybe we need help from @BitPhinix, the author of |
Saw this workaround at slate/packages/slate-react/src/hooks/android-input-manager/android-input-manager.ts Lines 636 to 658 in 0bdff51
Seems like we need another workaround to modify the } else if (type === 'insertCompositionText') {
if (_text.length !== _diff.end - _diff.start + 1) {
_diff.start = _diff.end - _text.length + 1
if (_diff.start < 0) {
const offset = Math.abs(_diff.start);
_diff.start += offset;
_diff.end += offset;
}
insertPositionHint = null;
scheduleFlush();
} else {
insertPositionHint = false;
}
}
|
Does this code change fix the behaviour? Will it be integrated into slate-react? |
Facing the issue with Japanese IME too. First try of the fix above is not working. I'll investigate a bit more |
Sorry my bad, the workaround above has side effects and cannot be used in production, I'm just trying to declare the position issue from the editor. |
Description
When I type Korean in Android, the first letter is entered twice.
You can also check it on slate-react example.
You can check it by changing the device to Android in developer tools and then refreshing.
Recording
works fine on pc
default.mov
but doesn't work on android
default.mov
Steps
To reproduce the behavior:
Expectation
it should be typed only once.
Environment
"slate": "^0.94.1",
"slate-history": "^0.93.0",
"slate-hyperscript": "^0.77.0",
"slate-react": "^0.98.0",
The text was updated successfully, but these errors were encountered: