aboutsummaryrefslogtreecommitdiff
path: root/src/content/index.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-08-27 17:55:26 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-08-27 17:55:26 +0900
commit9a029046977916f35d98001f00692e35d570d1ee (patch)
tree1ce868b2b91061195d596eaf75e17b51b469fbe9 /src/content/index.js
parent2c4e8c299c375c23f2b83ab3e6ff95131833599e (diff)
use keypress
Diffstat (limited to 'src/content/index.js')
-rw-r--r--src/content/index.js19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/content/index.js b/src/content/index.js
index feb169f..6bf5d57 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -66,27 +66,14 @@ const invokeEvent = (action) => {
}
}
-const isModifier = (code) => {
- return code === KeyboardEvent.DOM_VK_SHIFT ||
- code === KeyboardEvent.DOM_VK_ALT ||
- code === KeyboardEvent.DOM_VK_CONTROL ||
- code === KeyboardEvent.DOM_VK_META;
-}
-
-window.addEventListener("keydown", (e) => {
+window.addEventListener("keypress", (e) => {
if (e.target instanceof HTMLInputElement) {
return;
}
- if (isModifier(e.keyCode)) {
- return;
- }
let request = {
- type: 'event.keydown',
- code: e.keyCode,
- shift: e.shiftKey,
- alt: e.altKey,
- meta: e.metaKey,
+ type: 'event.keypress',
+ code: e.which,
ctrl: e.ctrlKey,
}