From 5ac1f60ece0a112a55f329ed34b455dcc776b22c Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Tue, 3 Oct 2017 20:58:50 +0900 Subject: remove deprecated property in KeyboardEvent --- src/components/background-input.js | 6 ++---- src/components/background.js | 2 +- src/components/content-input.js | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src/components') diff --git a/src/components/background-input.js b/src/components/background-input.js index 9c6ef1c..4735d5a 100644 --- a/src/components/background-input.js +++ b/src/components/background-input.js @@ -1,5 +1,4 @@ import * as inputActions from '../actions/input'; -import * as keys from '../shared/keys'; import * as operationActions from '../actions/operation'; export default class BackgroundInputComponent { @@ -37,15 +36,14 @@ export default class BackgroundInputComponent { } handleKeysChanged(sender, input) { - let prefix = keys.asKeymapChars(input.keys); let matched = Object.keys(this.keymaps).filter((keyStr) => { - return keyStr.startsWith(prefix); + return keyStr.startsWith(input.keys); }); if (matched.length === 0) { this.store.dispatch(inputActions.clearKeys(), sender); return Promise.resolve(); } else if (matched.length > 1 || - matched.length === 1 && prefix !== matched[0]) { + matched.length === 1 && input.keys !== matched[0]) { return Promise.resolve(); } let operation = this.keymaps[matched]; diff --git a/src/components/background.js b/src/components/background.js index 4c5bb19..0585a04 100644 --- a/src/components/background.js +++ b/src/components/background.js @@ -35,7 +35,7 @@ export default class BackgroundComponent { switch (message.type) { case messages.KEYDOWN: return this.store.dispatch( - inputActions.keyPress(message.code, message.ctrl), sender); + inputActions.keyPress(message.key, message.ctrl), sender); case messages.OPEN_URL: if (message.newTab) { return this.store.dispatch( diff --git a/src/components/content-input.js b/src/components/content-input.js index 81f2e6b..53a2f7d 100644 --- a/src/components/content-input.js +++ b/src/components/content-input.js @@ -18,7 +18,7 @@ export default class ContentInputComponent { } browser.runtime.sendMessage({ type: messages.KEYDOWN, - code: e.which, + key: e.key, ctrl: e.ctrlKey }); } -- cgit v1.2.3