From 355c0c64575adad4886647a1df3da173598b558b Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 9 Oct 2017 14:30:58 +0900 Subject: save keymap in input store in content --- src/content/components/keymapper.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/content/components/keymapper.js') 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; - } } -- cgit v1.2.3