mac support for search

This commit is contained in:
gempir 2020-12-04 19:07:24 +01:00
parent e510262c03
commit e233cf866f
2 changed files with 34 additions and 31 deletions

File diff suppressed because one or more lines are too long

View file

@ -14,9 +14,12 @@ const LogContainerDiv = styled.div`
export function LogContainer() {
const { state } = useContext(store);
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
const ctrlKey = isMac ? "metaKey" : "ctrlKey";
useEffect(() => {
const listener = function (e: KeyboardEvent) {
if (e.ctrlKey && e.code === "KeyF") {
if (e.key === 'f' && e[ctrlKey]) {
e.preventDefault();
if (state.activeSearchField) {
state.activeSearchField.focus();