diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-21 12:42:30 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-21 12:50:53 +0900 |
commit | cd6f7e77887f535e88690b84ad081f7cc630306f (patch) | |
tree | 87b6e933c76e6675ef8670d169d0468d22858be4 /src | |
parent | 214a5103f3e2914028206a13ba115c69a7ee07f1 (diff) |
support shift modifier
Diffstat (limited to 'src')
-rw-r--r-- | src/content/components/common/input.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/content/components/common/input.js b/src/content/components/common/input.js index 9af9fbe..f285b0c 100644 --- a/src/content/components/common/input.js +++ b/src/content/components/common/input.js @@ -1,6 +1,17 @@ +const modifierdKeyName = (name) => { + if (name.length === 1) { + return name.toUpperCase(); + } else if (name === 'Escape') { + return 'Esc'; + } + return name; +}; + const mapKey = (e) => { if (e.ctrlKey) { - return '<C-' + e.key.toUpperCase() + '>'; + return '<C-' + modifierdKeyName(e.key) + '>'; + } else if (e.shiftKey && e.key.length !== 1) { + return '<S-' + modifierdKeyName(e.key) + '>'; } return e.key; }; |