Resolve #265 regarding shortcuts in certain input fields.

As we want other shortcuts do work in input fields (which couldn't in previous releases).
This commit is contained in:
the-djmaze 2022-03-04 14:43:58 +01:00
parent 54f48fbe4d
commit a503329b77
5 changed files with 35 additions and 28 deletions

View file

@ -6,7 +6,11 @@ import { ComposeType, FolderType, MessageSetAction } from 'Common/EnumsUser';
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { doc, leftPanelDisabled, moveAction, Settings, SettingsCapa, SettingsGet, fireEvent, addEventsListeners } from 'Common/Globals';
import { doc, leftPanelDisabled, moveAction,
Settings, SettingsCapa, SettingsGet,
fireEvent, addEventsListeners,
registerShortcut
} from 'Common/Globals';
import { computedPaginatorHelper, showMessageComposer, populateMessageBody } from 'Common/UtilsUser';
import { FileInfo } from 'Common/File';
@ -694,7 +698,7 @@ export class MailMessageList extends AbstractViewRight {
// initShortcuts
shortcuts.add('enter,open', '', Scope.MessageList, () => {
registerShortcut('enter,open', '', Scope.MessageList, () => {
if (MessageUserStore.message() && this.useAutoSelect()) {
fireEvent('mailbox.message-view.toggle-full-screen');
return false;
@ -702,18 +706,18 @@ export class MailMessageList extends AbstractViewRight {
});
// archive (zip)
shortcuts.add('z', '', [Scope.MessageList, Scope.MessageView], () => {
registerShortcut('z', '', [Scope.MessageList, Scope.MessageView], () => {
this.archiveCommand();
return false;
});
// delete
shortcuts.add('delete', 'shift', Scope.MessageList, () => {
registerShortcut('delete', 'shift', Scope.MessageList, () => {
MessagelistUserStore.listCheckedOrSelected().length && this.deleteWithoutMoveCommand();
return false;
});
// shortcuts.add('3', 'shift', Scope.MessageList, () => {
shortcuts.add('delete', '', Scope.MessageList, () => {
// registerShortcut('3', 'shift', Scope.MessageList, () => {
registerShortcut('delete', '', Scope.MessageList, () => {
MessagelistUserStore.listCheckedOrSelected().length && this.deleteCommand();
return false;
});
@ -731,18 +735,18 @@ export class MailMessageList extends AbstractViewRight {
});
// write/compose (open compose popup)
shortcuts.add('w,c,new', '', [Scope.MessageList, Scope.MessageView], () => {
registerShortcut('w,c,new', '', [Scope.MessageList, Scope.MessageView], () => {
showMessageComposer();
return false;
});
// important - star/flag messages
shortcuts.add('i', '', [Scope.MessageList, Scope.MessageView], () => {
registerShortcut('i', '', [Scope.MessageList, Scope.MessageView], () => {
this.flagMessagesFast();
return false;
});
shortcuts.add('t', '', [Scope.MessageList], () => {
registerShortcut('t', '', [Scope.MessageList], () => {
let message = MessagelistUserStore.selectedMessage();
if (!message) {
message = MessagelistUserStore.focusedMessage();
@ -756,7 +760,7 @@ export class MailMessageList extends AbstractViewRight {
});
// move
shortcuts.add('insert', '', Scope.MessageList, () => {
registerShortcut('insert', '', Scope.MessageList, () => {
if (this.newMoveToFolder) {
this.moveNewCommand();
} else {
@ -767,13 +771,13 @@ export class MailMessageList extends AbstractViewRight {
});
// read
shortcuts.add('q', '', [Scope.MessageList, Scope.MessageView], () => {
registerShortcut('q', '', [Scope.MessageList, Scope.MessageView], () => {
this.seenMessagesFast(true);
return false;
});
// unread
shortcuts.add('u', '', [Scope.MessageList, Scope.MessageView], () => {
registerShortcut('u', '', [Scope.MessageList, Scope.MessageView], () => {
this.seenMessagesFast(false);
return false;
});

View file

@ -22,7 +22,8 @@ import {
SettingsCapa,
getFullscreenElement,
exitFullscreen,
fireEvent
fireEvent,
registerShortcut
} from 'Common/Globals';
import { arrayLength } from 'Common/Utils';
@ -379,7 +380,7 @@ export class MailMessageView extends AbstractViewRight {
});
// reply
shortcuts.add('r,mailreply', '', [Scope.MessageList, Scope.MessageView], () => {
registerShortcut('r,mailreply', '', [Scope.MessageList, Scope.MessageView], () => {
if (currentMessage()) {
this.replyCommand();
return false;
@ -388,13 +389,13 @@ export class MailMessageView extends AbstractViewRight {
});
// replyAll
shortcuts.add('a', '', [Scope.MessageList, Scope.MessageView], () => {
registerShortcut('a', '', [Scope.MessageList, Scope.MessageView], () => {
if (currentMessage()) {
this.replyAllCommand();
return false;
}
});
shortcuts.add('mailreply', 'shift', [Scope.MessageList, Scope.MessageView], () => {
registerShortcut('mailreply', 'shift', [Scope.MessageList, Scope.MessageView], () => {
if (currentMessage()) {
this.replyAllCommand();
return false;
@ -402,7 +403,7 @@ export class MailMessageView extends AbstractViewRight {
});
// forward
shortcuts.add('f,mailforward', '', [Scope.MessageList, Scope.MessageView], () => {
registerShortcut('f,mailforward', '', [Scope.MessageList, Scope.MessageView], () => {
if (currentMessage()) {
this.forwardCommand();
return false;
@ -410,7 +411,7 @@ export class MailMessageView extends AbstractViewRight {
});
// message information
shortcuts.add('i', 'meta', [Scope.MessageList, Scope.MessageView], () => {
registerShortcut('i', 'meta', [Scope.MessageList, Scope.MessageView], () => {
if (currentMessage()) {
this.showFullInfo(!this.showFullInfo());
}
@ -418,7 +419,7 @@ export class MailMessageView extends AbstractViewRight {
});
// toggle message blockquotes
shortcuts.add('b', '', [Scope.MessageList, Scope.MessageView], () => {
registerShortcut('b', '', [Scope.MessageList, Scope.MessageView], () => {
const message = currentMessage();
if (message && message.body) {
message.body.querySelectorAll('.rlBlockquoteSwitcher').forEach(node => node.click());

View file

@ -13,7 +13,7 @@ import { KeyboardShortcutsHelpPopupView } from 'View/Popup/KeyboardShortcutsHelp
import { AccountPopupView } from 'View/Popup/Account';
import { ContactsPopupView } from 'View/Popup/Contacts';
import { doc, leftPanelDisabled, fireEvent, SettingsCapa } from 'Common/Globals';
import { doc, leftPanelDisabled, fireEvent, SettingsCapa, registerShortcut } from 'Common/Globals';
import { ThemeStore } from 'Stores/Theme';
@ -123,7 +123,7 @@ export class SystemDropDownUserView extends AbstractViewRight {
}
onBuild() {
shortcuts.add('m', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => {
registerShortcut('m', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => {
if (!this.viewModelDom.hidden) {
MessageUserStore.fullScreen(false);
this.accountMenuDropdownTrigger(true);
@ -132,7 +132,7 @@ export class SystemDropDownUserView extends AbstractViewRight {
});
// shortcuts help
shortcuts.add('?,f1,help', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => {
registerShortcut('?,f1,help', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => {
if (!this.viewModelDom.hidden) {
showScreenPopup(KeyboardShortcutsHelpPopupView);
return false;