aboutsummaryrefslogtreecommitdiff
path: root/src/content/actions/input.js
blob: 10ff835d8ef1aae720e725efa8210148000c9b68 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import actions from 'content/actions';

const asKeymapChars = (key, ctrl) => {
  if (ctrl) {
    return '<C-' + key.toUpperCase() + '>';
  }
  return key;
};

const keyPress = (key, ctrl) => {
  return {
    type: actions.INPUT_KEY_PRESS,
    key: asKeymapChars(key, ctrl),
  };
};

const clearKeys = () => {
  return {
    type: actions.INPUT_CLEAR_KEYS
  };
};

const setKeymaps = (keymaps) => {
  return {
    type: actions.INPUT_SET_KEYMAPS,
    keymaps,
  };
};

export { keyPress, clearKeys, setKeymaps };