mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Fix handling of Japanese IME input
With the modern keyboard events, the Backspace/Enter handlers were being triggered even when they were part of an IME composition, which broke the native IME handling. We now ignore all keyboard events that are part of composition to avoid this issue.
This commit is contained in:
parent
b415665d01
commit
73e9d083dd
1 changed files with 3 additions and 4 deletions
|
@ -18,7 +18,9 @@ import { moveRangeBoundariesDownTree } from '../range/Boundaries';
|
|||
// ---
|
||||
|
||||
const _onKey = function (this: Squire, event: KeyboardEvent): void {
|
||||
if (event.defaultPrevented) {
|
||||
// Ignore key events where event.isComposing, to stop us from blatting
|
||||
// Kana-Kanji conversion
|
||||
if (event.defaultPrevented || event.isComposing) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -52,9 +54,6 @@ const _onKey = function (this: Squire, event: KeyboardEvent): void {
|
|||
this._keyHandlers[key](this, event, range);
|
||||
} else if (
|
||||
!range.collapsed &&
|
||||
// !event.isComposing stops us from blatting Kana-Kanji conversion in
|
||||
// Safari
|
||||
!event.isComposing &&
|
||||
!event.ctrlKey &&
|
||||
!event.metaKey &&
|
||||
key.length === 1
|
||||
|
|
Loading…
Reference in a new issue