-
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
A couple of problems with core plugin onBeforeInput #1012
Comments
A big chunk of problems with IME is caused by the iOS autocomplete fix, as correctly identified in these pull requests:
If I were to choose between the two, I'd go with the one that limits it to IOS*, since leaving it around may have other implications other than composing. I'm also looking to see if the IOS fix can be achieved in a way that doesn't cause regressions with composing. (*Although the fix might not be iOS specific since it treats mismatches between the selections in a general manner) Edit: It does look like treating all iOS input events as native (or at least the ones containing |
A tangential update on IMEs / iOS autocomplete fix.
wrt to the iOS completion, starting with Safari 10.1, we have access to Input Events Level 2, which includes an |
Thanks for your insights @danburzo:
Context
Proposed approach
The source code of the event watcher is available in this fork. |
Hey @danburzo and @davidbonnet thanks for investigating this! In light of the |
Hi, sorry for the hiatus — I'm back on the problem. I noticed the recent merge that removed |
So where are we regarding the IME issues? I am seeing issues #1114, #810, #854, #880, and #885. It seems like several have offered a solution but there has been some hesitance due to lack of familiarity to merge any. Can we use this issue as a place for continued discussion and resolution? This is a major show stopper for me that I hadn't realized before. I'm happy to help in any implementation/PR. |
I proposed an approach which consists of setting up tests to ensure that the editor works as expected. Lack of tests makes it very difficult to approve suggested solutions. I'm open to collaborate on this approach or alternative ones. |
Hey everyone, @danburzo thanks so much for opening this! I think some of these issues have been solved in newer versions of Slate. I'm going to close this one since it's got a lot of stuff going on, but feel free to open up individual issues for anything that remains! |
Holy crap @davidbonnet I just saw this link you posted: https://optimdata.github.io/slate/#/mobile I know it's not working, but it's a big step forward. Can you explain the relevance of the gold box? Thanks very much for your work on this issue! |
@slapbox: The golden box is a non-slate editable content element in order to record the unhindered input event flow. |
Thanks for the clarification. I suspected, but wasn't sure that was the only point. |
While investigating IME bugs, I came across a few problems with
onBeforeInput
in the core plugin:e.data
will contain a single character?slate/src/plugins/core.js
Lines 89 to 98 in 239d97f
In the case of a composition event,
onBeforeInput
will receive the entire composed string ine.data
just before calling thecompositionend
event, so instantiating a Character with a multiple-char string may break somewhere. (At fist impression, seems the list insertion works either way)slate/src/plugins/core.js
Line 100 in 239d97f
If that's the case, it should take the selection into consideration, since you may be actually replacing some characters in the process.
This is all I have for now in regards to inserting composed words, I'll keep investigating — is there any other place that assumes e.data is a single char but then ends up pushing a multi-character string into the state? That may be the source of some of the problems we currently have with IMEs.
Right now I reckon these are causing:
The text was updated successfully, but these errors were encountered: