add setting actions in content
This commit is contained in:
parent
7639e99b75
commit
c6eb5553d0
10 changed files with 74 additions and 25 deletions
|
@ -11,19 +11,20 @@ export default class KeymapperComponent {
|
|||
}
|
||||
|
||||
key(key) {
|
||||
let enabled = this.store.getState().addon.enabled;
|
||||
|
||||
this.store.dispatch(inputActions.keyPress(key));
|
||||
|
||||
let input = this.store.getState().input;
|
||||
let matched = Object.keys(input.keymaps).filter((keyStr) => {
|
||||
let state = this.store.getState();
|
||||
let input = state.input;
|
||||
let keymaps = state.setting.keymaps;
|
||||
|
||||
let matched = Object.keys(keymaps).filter((keyStr) => {
|
||||
return keyStr.startsWith(input.keys);
|
||||
});
|
||||
if (!enabled) {
|
||||
if (!state.addon.enabled) {
|
||||
// available keymaps are only ADDON_ENABLE and ADDON_TOGGLE_ENABLED if
|
||||
// the addon disabled
|
||||
matched = matched.filter((keys) => {
|
||||
let type = input.keymaps[keys].type;
|
||||
let type = keymaps[keys].type;
|
||||
return type === operations.ADDON_ENABLE ||
|
||||
type === operations.ADDON_TOGGLE_ENABLED;
|
||||
});
|
||||
|
@ -35,7 +36,7 @@ export default class KeymapperComponent {
|
|||
matched.length === 1 && input.keys !== matched[0]) {
|
||||
return true;
|
||||
}
|
||||
let operation = input.keymaps[matched];
|
||||
let operation = keymaps[matched];
|
||||
this.store.dispatch(operationActions.exec(operation));
|
||||
this.store.dispatch(inputActions.clearKeys());
|
||||
return true;
|
||||
|
|
Reference in a new issue