mirror of
https://github.com/Kong/insomnia.git
synced 2026-04-23 15:49:42 -04:00
Fix autocomplete hotkey in settings (Fixes #872)
This commit is contained in:
@@ -8,7 +8,8 @@ export type Hotkey = {
|
||||
meta: boolean,
|
||||
alt: boolean,
|
||||
shift: boolean,
|
||||
keycode: number | Array<number>
|
||||
keycode: number | Array<number>,
|
||||
metaIsCtrl?: boolean,
|
||||
};
|
||||
|
||||
export const SHOW_WORKSPACE_SETTINGS: Hotkey = {
|
||||
@@ -70,6 +71,7 @@ export const RELOAD_PLUGINS: Hotkey = {
|
||||
export const SHOW_AUTOCOMPLETE: Hotkey = {
|
||||
description: 'Show Autocomplete',
|
||||
meta: true,
|
||||
metaIsCtrl: true,
|
||||
alt: false,
|
||||
shift: false,
|
||||
keycode: keycodes.space
|
||||
|
||||
@@ -49,7 +49,7 @@ const BASE_CODEMIRROR_OPTIONS = {
|
||||
showCursorWhenSelecting: false,
|
||||
cursorScrollMargin: 12, // NOTE: This is px
|
||||
keyMap: 'default',
|
||||
extraKeys: {
|
||||
extraKeys: CodeMirror.normalizeKeyMap({
|
||||
'Ctrl-Q': function (cm) {
|
||||
cm.foldCode(cm.getCursor());
|
||||
},
|
||||
@@ -61,7 +61,7 @@ const BASE_CODEMIRROR_OPTIONS = {
|
||||
// Change default find command from "find" to "findPersistent" so the
|
||||
// search box stays open after pressing Enter
|
||||
[isMac() ? 'Cmd-F' : 'Ctrl-F']: 'findPersistent'
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
@autobind
|
||||
|
||||
@@ -15,14 +15,18 @@ type Props = {
|
||||
class Hotkey extends React.PureComponent<Props> {
|
||||
render () {
|
||||
const {hotkey, className} = this.props;
|
||||
const {alt, shift, meta} = hotkey;
|
||||
const chars = [ ];
|
||||
const {alt, shift, meta, metaIsCtrl} = hotkey;
|
||||
const chars = [];
|
||||
|
||||
alt && chars.push(ALT_SYM);
|
||||
shift && chars.push(SHIFT_SYM);
|
||||
|
||||
if (meta) {
|
||||
chars.push(isMac() ? MOD_SYM : CTRL_SYM);
|
||||
if (metaIsCtrl) {
|
||||
chars.push(CTRL_SYM);
|
||||
} else {
|
||||
chars.push(isMac() ? MOD_SYM : CTRL_SYM);
|
||||
}
|
||||
}
|
||||
|
||||
chars.push(hotkeys.getChar(hotkey));
|
||||
|
||||
Reference in New Issue
Block a user