Hotkey ⌘+, for settings on macOS PWA (#1913)

This commit is contained in:
Alexander Zinchuk 2022-07-08 14:59:50 +02:00
parent 6f7e762e6c
commit 38f36aaa3c
6 changed files with 15 additions and 9 deletions

View File

@ -6,7 +6,7 @@ import { getActions, withGlobal } from '../../global';
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 useFoldersReducer from '../../hooks/reducers/useFoldersReducer';
import { useResize } from '../../hooks/useResize';
@ -321,9 +321,15 @@ const LeftColumn: FC<StateProps> = ({
openChat({ id: currentUserId });
}, [currentUserId, openChat]);
const handleHotkeySettings = useCallback((e: KeyboardEvent) => {
e.preventDefault();
setContent(LeftColumnContent.Settings);
}, []);
useHotkeys({
'mod+shift+F': handleHotkeySearch,
'mod+shift+S': handleHotkeySavedMessages,
'Mod+Shift+F': handleHotkeySearch,
'Mod+Shift+S': handleHotkeySavedMessages,
...(IS_MAC_OS && IS_PWA && { 'Mod+,': handleHotkeySettings }),
});
useEffect(() => {

View File

@ -76,11 +76,11 @@ const ChatList: FC<OwnProps> = ({
// Support <Alt>+<Up/Down> to navigate between chats
useHotkeys(isActive && orderedIds?.length ? {
'alt+ArrowUp': (e: KeyboardEvent) => {
'Alt+ArrowUp': (e: KeyboardEvent) => {
e.preventDefault();
openNextChat({ targetIndexDelta: -1, orderedIds });
},
'alt+ArrowDown': (e: KeyboardEvent) => {
'Alt+ArrowDown': (e: KeyboardEvent) => {
e.preventDefault();
openNextChat({ targetIndexDelta: 1, orderedIds });
},

View File

@ -149,7 +149,7 @@ const LeftMainHeader: FC<OwnProps & StateProps> = ({
'Ctrl+Shift+L': handleLockScreenHotkey,
'Alt+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;

View File

@ -153,7 +153,7 @@ const HeaderActions: FC<OwnProps & StateProps> = ({
}, [canSearch, handleSearchClick]);
useHotkeys({
'Meta+F': handleHotkeySearchClick,
'Mod+F': handleHotkeySearchClick,
});
const lang = useLang();

View File

@ -10,7 +10,7 @@ const useCopySelectedMessages = (isActive: boolean, copySelectedMessages: NoneTo
copySelectedMessages();
}
useHotkeys({ 'Meta+C': handleCopy });
useHotkeys({ 'Mod+C': handleCopy });
};
export default useCopySelectedMessages;

View File

@ -11,7 +11,7 @@ const useNativeCopySelectedMessages = (copyMessagesByIds: ({ messageIds }: { mes
}
}
useHotkeys({ 'Meta+C': handleCopy });
useHotkeys({ 'Mod+C': handleCopy });
};
export default useNativeCopySelectedMessages;