diff options
Diffstat (limited to 'src/content/actions/setting.ts')
-rw-r--r-- | src/content/actions/setting.ts | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/content/actions/setting.ts b/src/content/actions/setting.ts index a8f049a..92f8559 100644 --- a/src/content/actions/setting.ts +++ b/src/content/actions/setting.ts @@ -1,29 +1,20 @@ import * as actions from './index'; -import * as keyUtils from '../../shared/utils/keys'; import * as operations from '../../shared/operations'; import * as messages from '../../shared/messages'; +import Settings, { Keymaps } from '../../shared/Settings'; -const reservedKeymaps = { +const reservedKeymaps: Keymaps = { '<Esc>': { type: operations.CANCEL }, '<C-[>': { type: operations.CANCEL }, }; -const set = (value: any): actions.SettingAction => { - let entries: any[] = []; - if (value.keymaps) { - let keymaps = { ...value.keymaps, ...reservedKeymaps }; - entries = Object.entries(keymaps).map((entry) => { - return [ - keyUtils.fromMapKeys(entry[0]), - entry[1], - ]; - }); - } - +const set = (settings: Settings): actions.SettingAction => { return { type: actions.SETTING_SET, - value: { ...value, - keymaps: entries, } + settings: { + ...settings, + keymaps: { ...settings.keymaps, ...reservedKeymaps }, + } }; }; |