Fix several shortcuts not working with non-EN keyboard layouts

This commit is contained in:
Vladislav Gorenkin 2022-03-31 11:58:28 +06:00
parent 308cef086c
commit d094a93191
No known key found for this signature in database
GPG key ID: 5D6BB801BEC779D6
6 changed files with 22 additions and 9 deletions

View file

@ -16,6 +16,7 @@ import type { ConversationType } from '../../state/ducks/conversations';
import { LeftPaneSearchInput } from '../LeftPaneSearchInput';
import type { LeftPaneSearchPropsType } from './LeftPaneSearchHelper';
import { LeftPaneSearchHelper } from './LeftPaneSearchHelper';
import * as KeyboardLayout from '../../services/keyboardLayout';
type LeftPaneArchiveBasePropsType = {
archivedConversations: ReadonlyArray<ConversationListItemPropsType>;
@ -219,17 +220,18 @@ export class LeftPaneArchiveHelper extends LeftPaneHelper<LeftPaneArchivePropsTy
return;
}
const { ctrlKey, metaKey, shiftKey, key } = event;
const { ctrlKey, metaKey, shiftKey } = event;
const commandKey = window.platform === 'darwin' && metaKey;
const controlKey = window.platform !== 'darwin' && ctrlKey;
const commandOrCtrl = commandKey || controlKey;
const commandAndCtrl = commandKey && ctrlKey;
const key = KeyboardLayout.lookup(event);
if (
commandOrCtrl &&
!commandAndCtrl &&
shiftKey &&
key.toLowerCase() === 'f' &&
(key === 'f' || key === 'F') &&
this.archivedConversations.some(({ id }) => id === selectedConversationId)
) {
searchInConversation(selectedConversationId);