aboutsummaryrefslogtreecommitdiff
path: root/src/content/components/common/input.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/components/common/input.js')
-rw-r--r--src/content/components/common/input.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/content/components/common/input.js b/src/content/components/common/input.js
index 2de0d7d..9af9fbe 100644
--- a/src/content/components/common/input.js
+++ b/src/content/components/common/input.js
@@ -1,3 +1,10 @@
+const mapKey = (e) => {
+ if (e.ctrlKey) {
+ return '<C-' + e.key.toUpperCase() + '>';
+ }
+ return e.key;
+};
+
export default class InputComponent {
constructor(target) {
this.pressed = {};
@@ -47,8 +54,10 @@ export default class InputComponent {
return;
}
+ let key = mapKey(e);
+
for (let listener of this.onKeyListeners) {
- let stop = listener(e.key, e.ctrlKey);
+ let stop = listener(key);
if (stop) {
e.preventDefault();
e.stopPropagation();