Shortcuts: Check for both capital and lowercase characters
This commit is contained in:
parent
d187ab11b2
commit
3c6e23cc5e
3 changed files with 84 additions and 19 deletions
|
@ -657,7 +657,7 @@
|
|||
// Show keyboard shortcuts - handled by Electron-managed keyboard shortcuts
|
||||
|
||||
// Navigate by section
|
||||
if (ctrlOrCommand && !shiftKey && key === 't') {
|
||||
if (ctrlOrCommand && !shiftKey && (key === 't' || key === 'T')) {
|
||||
const focusedElement = document.activeElement;
|
||||
|
||||
const targets = [
|
||||
|
@ -853,7 +853,12 @@
|
|||
// Preferences - handled by Electron-managed keyboard shortcuts
|
||||
|
||||
// Open the top-right menu for current conversation
|
||||
if (conversation && ctrlOrCommand && shiftKey && key === 'i') {
|
||||
if (
|
||||
conversation &&
|
||||
ctrlOrCommand &&
|
||||
shiftKey &&
|
||||
(key === 'i' || key === 'I')
|
||||
) {
|
||||
const button = document.querySelector(
|
||||
'.module-conversation-header__more-button'
|
||||
);
|
||||
|
@ -891,7 +896,7 @@
|
|||
}
|
||||
|
||||
// Search
|
||||
if (ctrlOrCommand && !shiftKey && key === 'f') {
|
||||
if (ctrlOrCommand && !shiftKey && (key === 'f' || key === 'F')) {
|
||||
const { startSearch } = actions.search;
|
||||
startSearch();
|
||||
|
||||
|
@ -901,7 +906,12 @@
|
|||
}
|
||||
|
||||
// Search in conversation
|
||||
if (conversation && ctrlOrCommand && shiftKey && key === 'f') {
|
||||
if (
|
||||
conversation &&
|
||||
ctrlOrCommand &&
|
||||
shiftKey &&
|
||||
(key === 'f' || key === 'F')
|
||||
) {
|
||||
const { searchInConversation } = actions.search;
|
||||
const name = conversation.isMe()
|
||||
? window.i18n('noteToSelf')
|
||||
|
@ -914,7 +924,12 @@
|
|||
}
|
||||
|
||||
// Focus composer field
|
||||
if (conversation && ctrlOrCommand && shiftKey && key === 't') {
|
||||
if (
|
||||
conversation &&
|
||||
ctrlOrCommand &&
|
||||
shiftKey &&
|
||||
(key === 't' || key === 'T')
|
||||
) {
|
||||
conversation.trigger('focus-composer');
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
@ -922,7 +937,12 @@
|
|||
}
|
||||
|
||||
// Open all media
|
||||
if (conversation && ctrlOrCommand && shiftKey && key === 'm') {
|
||||
if (
|
||||
conversation &&
|
||||
ctrlOrCommand &&
|
||||
shiftKey &&
|
||||
(key === 'm' || key === 'M')
|
||||
) {
|
||||
conversation.trigger('open-all-media');
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
@ -934,7 +954,12 @@
|
|||
// Open sticker picker - handled by component
|
||||
|
||||
// Begin recording voice note
|
||||
if (conversation && ctrlOrCommand && shiftKey && key === 'v') {
|
||||
if (
|
||||
conversation &&
|
||||
ctrlOrCommand &&
|
||||
shiftKey &&
|
||||
(key === 'v' || key === 'V')
|
||||
) {
|
||||
conversation.trigger('begin-recording');
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
@ -947,7 +972,7 @@
|
|||
!conversation.get('isArchived') &&
|
||||
ctrlOrCommand &&
|
||||
shiftKey &&
|
||||
key === 'a'
|
||||
(key === 'a' || key === 'A')
|
||||
) {
|
||||
conversation.setArchived(true);
|
||||
conversation.trigger('unload', 'keyboard shortcut archive');
|
||||
|
@ -965,7 +990,7 @@
|
|||
conversation.get('isArchived') &&
|
||||
ctrlOrCommand &&
|
||||
shiftKey &&
|
||||
key === 'u'
|
||||
(key === 'u' || key === 'U')
|
||||
) {
|
||||
conversation.setArchived(false);
|
||||
Whisper.ToastView.show(
|
||||
|
@ -983,7 +1008,12 @@
|
|||
// Scroll to top of list - handled by component
|
||||
|
||||
// Close conversation
|
||||
if (conversation && ctrlOrCommand && shiftKey && key === 'c') {
|
||||
if (
|
||||
conversation &&
|
||||
ctrlOrCommand &&
|
||||
shiftKey &&
|
||||
(key === 'c' || key === 'C')
|
||||
) {
|
||||
conversation.trigger('unload', 'keyboard shortcut close');
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
@ -993,7 +1023,12 @@
|
|||
// MESSAGES
|
||||
|
||||
// Show message details
|
||||
if (conversation && ctrlOrCommand && !shiftKey && key === 'd') {
|
||||
if (
|
||||
conversation &&
|
||||
ctrlOrCommand &&
|
||||
!shiftKey &&
|
||||
(key === 'd' || key === 'D')
|
||||
) {
|
||||
const { selectedMessage } = state.conversations;
|
||||
if (!selectedMessage) {
|
||||
return;
|
||||
|
@ -1006,7 +1041,12 @@
|
|||
}
|
||||
|
||||
// Toggle reply to message
|
||||
if (conversation && ctrlOrCommand && shiftKey && key === 'r') {
|
||||
if (
|
||||
conversation &&
|
||||
ctrlOrCommand &&
|
||||
shiftKey &&
|
||||
(key === 'r' || key === 'R')
|
||||
) {
|
||||
const { selectedMessage } = state.conversations;
|
||||
|
||||
conversation.trigger('toggle-reply', selectedMessage);
|
||||
|
@ -1016,7 +1056,12 @@
|
|||
}
|
||||
|
||||
// Save attachment
|
||||
if (conversation && ctrlOrCommand && !shiftKey && key === 's') {
|
||||
if (
|
||||
conversation &&
|
||||
ctrlOrCommand &&
|
||||
!shiftKey &&
|
||||
(key === 's' || key === 'S')
|
||||
) {
|
||||
const { selectedMessage } = state.conversations;
|
||||
|
||||
if (selectedMessage) {
|
||||
|
@ -1028,7 +1073,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (conversation && ctrlOrCommand && shiftKey && key === 'd') {
|
||||
if (
|
||||
conversation &&
|
||||
ctrlOrCommand &&
|
||||
shiftKey &&
|
||||
(key === 'd' || key === 'D')
|
||||
) {
|
||||
const { selectedMessage } = state.conversations;
|
||||
|
||||
if (selectedMessage) {
|
||||
|
@ -1049,7 +1099,12 @@
|
|||
// Send in expanded composer - handled by component
|
||||
|
||||
// Attach file
|
||||
if (conversation && ctrlOrCommand && !shiftKey && key === 'u') {
|
||||
if (
|
||||
conversation &&
|
||||
ctrlOrCommand &&
|
||||
!shiftKey &&
|
||||
(key === 'u' || key === 'U')
|
||||
) {
|
||||
conversation.trigger('attach-file');
|
||||
|
||||
event.preventDefault();
|
||||
|
@ -1058,7 +1113,12 @@
|
|||
}
|
||||
|
||||
// Remove draft link preview
|
||||
if (conversation && ctrlOrCommand && !shiftKey && key === 'p') {
|
||||
if (
|
||||
conversation &&
|
||||
ctrlOrCommand &&
|
||||
!shiftKey &&
|
||||
(key === 'p' || key === 'P')
|
||||
) {
|
||||
conversation.trigger('remove-link-review');
|
||||
|
||||
event.preventDefault();
|
||||
|
@ -1067,7 +1127,12 @@
|
|||
}
|
||||
|
||||
// Attach file
|
||||
if (conversation && ctrlOrCommand && shiftKey && key === 'p') {
|
||||
if (
|
||||
conversation &&
|
||||
ctrlOrCommand &&
|
||||
shiftKey &&
|
||||
(key === 'p' || key === 'P')
|
||||
) {
|
||||
conversation.trigger('remove-all-draft-attachments');
|
||||
|
||||
event.preventDefault();
|
||||
|
|
|
@ -88,7 +88,7 @@ export const EmojiButton = React.memo(
|
|||
const { ctrlKey, key, metaKey, shiftKey } = event;
|
||||
const ctrlOrCommand = metaKey || ctrlKey;
|
||||
|
||||
if (ctrlOrCommand && shiftKey && key === 'e') {
|
||||
if (ctrlOrCommand && shiftKey && (key === 'e' || key === 'E')) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ export const StickerButton = React.memo(
|
|||
const { ctrlKey, key, metaKey, shiftKey } = event;
|
||||
const ctrlOrCommand = metaKey || ctrlKey;
|
||||
|
||||
if (ctrlOrCommand && shiftKey && key === 's') {
|
||||
if (ctrlOrCommand && shiftKey && (key === 's' || key === 'S')) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue