Add fix for Chinese and Japanese characters #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem with typing in Japanese/Chinese characters. The first character would be repeated twice, and this would only happen on the first line of the text box.
It is because we are calling this
document.execCommand('formatBlock', false, 'p')
before the characters are finalized. The'compositionend'
event happens when the characters are finalized. So I made a check for whether a "composition" is in progress and don't calldocument.execCommand('formatBlock', false, 'p')
until then.It shouldn't affect typing with English characters at all.
Some examples of what the problem was in Japanese ->
arigatou-> should be ありがとう but shows up as あありがとう
kyou -> should be 今日 but ends up as k今日
The first character is automatically saved, but it shouldn't be final until you indicate so using the Japanese or Chinese keyboard input method.