diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-09 17:35:10 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-09 17:35:10 +0900 |
commit | 447466808f484d4baa6b285f2dbcaf1920db5498 (patch) | |
tree | aba110eb78b4ce3eb6cefb8100f167e17a23fcc3 /src/content/components/keymapper.js | |
parent | 892eb8a6a6d9080213f461f19a8b8435a6482237 (diff) | |
parent | 805d1395fc869235f079438b5b4884a521c0230e (diff) |
Merge pull request #27 from ueokande/react-settings
Use React in settings
Diffstat (limited to 'src/content/components/keymapper.js')
-rw-r--r-- | src/content/components/keymapper.js | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/content/components/keymapper.js b/src/content/components/keymapper.js index 8f2cead..655c3f2 100644 --- a/src/content/components/keymapper.js +++ b/src/content/components/keymapper.js @@ -10,14 +10,10 @@ export default class KeymapperComponent { } key(key, ctrl) { - let keymaps = this.keymaps(); - if (!keymaps) { - return; - } this.store.dispatch(inputActions.keyPress(key, ctrl)); let input = this.store.getState().input; - let matched = Object.keys(keymaps).filter((keyStr) => { + let matched = Object.keys(input.keymaps).filter((keyStr) => { return keyStr.startsWith(input.keys); }); if (matched.length === 0) { @@ -27,17 +23,9 @@ export default class KeymapperComponent { matched.length === 1 && input.keys !== matched[0]) { return true; } - let operation = keymaps[matched]; + let operation = input.keymaps[matched]; this.store.dispatch(operationActions.exec(operation)); this.store.dispatch(inputActions.clearKeys()); return true; } - - keymaps() { - let settings = this.store.getState().setting.settings; - if (!settings || !settings.json) { - return null; - } - return JSON.parse(settings.json).keymaps; - } } |