From 3bbefc82d4252be2afa733186ade3658370f7ded Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Wed, 8 May 2019 00:13:18 +0800 Subject: [PATCH] Fix input method editor is processing key input issue. #72 --- src/main.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index c55e00bb..73bd9260 100644 --- a/src/main.js +++ b/src/main.js @@ -167,8 +167,11 @@ function dispatch(event) { const asterisk = _handlers['*']; let key = event.keyCode || event.which || event.charCode; - // 搜集绑定的键 - if (_downKeys.indexOf(key) === -1) _downKeys.push(key); + // Collect bound keys + // If an Input Method Editor is processing key input and the event is keydown, return 229. + // https://stackoverflow.com/questions/25043934/is-it-ok-to-ignore-keydown-events-with-keycode-229 + // http://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html + if (_downKeys.indexOf(key) === -1 && key !== 229) _downKeys.push(key); // Gecko(Firefox)的command键值224,在Webkit(Chrome)中保持一致 // Webkit左右command键值不一样