mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Only listen to CMD+f for <SearchInput> on macOS (#4175)
This commit is contained in:
parent
9e2ee00974
commit
82162e5021
@ -26,6 +26,7 @@ import { observer } from "mobx-react";
|
|||||||
import { boundMethod, cssNames } from "../../utils";
|
import { boundMethod, cssNames } from "../../utils";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { Input, InputProps } from "./input";
|
import { Input, InputProps } from "./input";
|
||||||
|
import { isMac } from "../../../common/vars";
|
||||||
|
|
||||||
interface Props extends InputProps {
|
interface Props extends InputProps {
|
||||||
compact?: boolean; // show only search-icon when not focused
|
compact?: boolean; // show only search-icon when not focused
|
||||||
@ -38,9 +39,7 @@ const defaultProps: Partial<Props> = {
|
|||||||
autoFocus: true,
|
autoFocus: true,
|
||||||
bindGlobalFocusHotkey: true,
|
bindGlobalFocusHotkey: true,
|
||||||
showClearIcon: true,
|
showClearIcon: true,
|
||||||
get placeholder() {
|
placeholder: "Search...",
|
||||||
return `Search...`;
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
@ -60,9 +59,7 @@ export class SearchInput extends React.Component<Props> {
|
|||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
onGlobalKey(evt: KeyboardEvent) {
|
onGlobalKey(evt: KeyboardEvent) {
|
||||||
const meta = evt.metaKey || evt.ctrlKey;
|
if (evt.key === "f" && (isMac ? evt.metaKey : evt.ctrlKey)) {
|
||||||
|
|
||||||
if (meta && evt.key === "f") {
|
|
||||||
this.inputRef.current.focus();
|
this.inputRef.current.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user