Hotkey ⌘+, for settings on macOS PWA (#1913)
This commit is contained in:
parent
6f7e762e6c
commit
38f36aaa3c
@ -6,7 +6,7 @@ import { getActions, withGlobal } from '../../global';
|
|||||||
|
|
||||||
import { LeftColumnContent, SettingsScreens } from '../../types';
|
import { LeftColumnContent, SettingsScreens } from '../../types';
|
||||||
|
|
||||||
import { LAYERS_ANIMATION_NAME } from '../../util/environment';
|
import { IS_MAC_OS, IS_PWA, LAYERS_ANIMATION_NAME } from '../../util/environment';
|
||||||
import captureEscKeyListener from '../../util/captureEscKeyListener';
|
import captureEscKeyListener from '../../util/captureEscKeyListener';
|
||||||
import useFoldersReducer from '../../hooks/reducers/useFoldersReducer';
|
import useFoldersReducer from '../../hooks/reducers/useFoldersReducer';
|
||||||
import { useResize } from '../../hooks/useResize';
|
import { useResize } from '../../hooks/useResize';
|
||||||
@ -321,9 +321,15 @@ const LeftColumn: FC<StateProps> = ({
|
|||||||
openChat({ id: currentUserId });
|
openChat({ id: currentUserId });
|
||||||
}, [currentUserId, openChat]);
|
}, [currentUserId, openChat]);
|
||||||
|
|
||||||
|
const handleHotkeySettings = useCallback((e: KeyboardEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
setContent(LeftColumnContent.Settings);
|
||||||
|
}, []);
|
||||||
|
|
||||||
useHotkeys({
|
useHotkeys({
|
||||||
'mod+shift+F': handleHotkeySearch,
|
'Mod+Shift+F': handleHotkeySearch,
|
||||||
'mod+shift+S': handleHotkeySavedMessages,
|
'Mod+Shift+S': handleHotkeySavedMessages,
|
||||||
|
...(IS_MAC_OS && IS_PWA && { 'Mod+,': handleHotkeySettings }),
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -76,11 +76,11 @@ const ChatList: FC<OwnProps> = ({
|
|||||||
|
|
||||||
// Support <Alt>+<Up/Down> to navigate between chats
|
// Support <Alt>+<Up/Down> to navigate between chats
|
||||||
useHotkeys(isActive && orderedIds?.length ? {
|
useHotkeys(isActive && orderedIds?.length ? {
|
||||||
'alt+ArrowUp': (e: KeyboardEvent) => {
|
'Alt+ArrowUp': (e: KeyboardEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
openNextChat({ targetIndexDelta: -1, orderedIds });
|
openNextChat({ targetIndexDelta: -1, orderedIds });
|
||||||
},
|
},
|
||||||
'alt+ArrowDown': (e: KeyboardEvent) => {
|
'Alt+ArrowDown': (e: KeyboardEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
openNextChat({ targetIndexDelta: 1, orderedIds });
|
openNextChat({ targetIndexDelta: 1, orderedIds });
|
||||||
},
|
},
|
||||||
|
|||||||
@ -149,7 +149,7 @@ const LeftMainHeader: FC<OwnProps & StateProps> = ({
|
|||||||
'Ctrl+Shift+L': handleLockScreenHotkey,
|
'Ctrl+Shift+L': handleLockScreenHotkey,
|
||||||
'Alt+Shift+L': handleLockScreenHotkey,
|
'Alt+Shift+L': handleLockScreenHotkey,
|
||||||
'Meta+Shift+L': handleLockScreenHotkey,
|
'Meta+Shift+L': handleLockScreenHotkey,
|
||||||
...(IS_PWA && { 'Meta+L': handleLockScreenHotkey }),
|
...(IS_PWA && { 'Mod+L': handleLockScreenHotkey }),
|
||||||
});
|
});
|
||||||
|
|
||||||
const withOtherVersions = window.location.hostname === PRODUCTION_HOSTNAME || IS_TEST;
|
const withOtherVersions = window.location.hostname === PRODUCTION_HOSTNAME || IS_TEST;
|
||||||
|
|||||||
@ -153,7 +153,7 @@ const HeaderActions: FC<OwnProps & StateProps> = ({
|
|||||||
}, [canSearch, handleSearchClick]);
|
}, [canSearch, handleSearchClick]);
|
||||||
|
|
||||||
useHotkeys({
|
useHotkeys({
|
||||||
'Meta+F': handleHotkeySearchClick,
|
'Mod+F': handleHotkeySearchClick,
|
||||||
});
|
});
|
||||||
|
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
|
|||||||
@ -10,7 +10,7 @@ const useCopySelectedMessages = (isActive: boolean, copySelectedMessages: NoneTo
|
|||||||
copySelectedMessages();
|
copySelectedMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
useHotkeys({ 'Meta+C': handleCopy });
|
useHotkeys({ 'Mod+C': handleCopy });
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useCopySelectedMessages;
|
export default useCopySelectedMessages;
|
||||||
|
|||||||
@ -11,7 +11,7 @@ const useNativeCopySelectedMessages = (copyMessagesByIds: ({ messageIds }: { mes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useHotkeys({ 'Meta+C': handleCopy });
|
useHotkeys({ 'Mod+C': handleCopy });
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useNativeCopySelectedMessages;
|
export default useNativeCopySelectedMessages;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user