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 call document.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.
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.