Remove some shortcuts due to conflicts, read #252

This commit is contained in:
the-djmaze 2022-03-02 09:26:30 +01:00
parent 4250dcf3f0
commit 096faae844
8 changed files with 18 additions and 40 deletions

View file

@ -29,16 +29,6 @@ export const
domItem && item && undefined !== item.disabled
&& domItem.classList.toggle('disabled', domItem.disabled = item.disabled),
inFocus = () => {
try {
return doc.activeElement && doc.activeElement.matches(
'input,textarea,[contenteditable]'
);
} catch (e) {
return false;
}
},
// unescape(encodeURIComponent()) makes the UTF-16 DOMString to an UTF-8 string
b64EncodeJSON = data => btoa(unescape(encodeURIComponent(JSON.stringify(data)))),
/* // Without deprecated 'unescape':

View file

@ -354,8 +354,8 @@ class SquireUI
changes.redo.input.disabled = !state.canRedo;
});
squire.addEventListener('focus', () => shortcuts.off());
squire.addEventListener('blur', () => shortcuts.on());
// squire.addEventListener('focus', () => shortcuts.off());
// squire.addEventListener('blur', () => shortcuts.on());
container.append(toolbar, wysiwyg, plain);

View file

@ -1,6 +1,5 @@
import ko from 'ko';
import { inFocus } from 'Common/Utils';
import { addObservablesTo, addComputablesTo, addSubscribablesTo } from 'External/ko';
import { Scope } from 'Common/Enums';
import { keyScope, SettingsGet, leftPanelDisabled } from 'Common/Globals';
@ -68,7 +67,6 @@ export class AbstractViewPopup extends AbstractView
}
return true;
});
shortcuts.add('backspace', '', name, inFocus());
}
// Happens when user hits Escape or Close key

View file

@ -11,7 +11,7 @@ import {
SetSystemFoldersNotification
} from 'Common/EnumsUser';
import { inFocus, pInt, isArray, arrayLength, forEachObjectEntry } from 'Common/Utils';
import { pInt, isArray, arrayLength, forEachObjectEntry } from 'Common/Utils';
import { initFullscreen } from 'Common/UtilsUser';
import { encodeHtml, HtmlEditor, htmlToPlain } from 'Common/Html';
import { koArrayWithDestroy } from 'External/ko';
@ -1197,14 +1197,6 @@ export class ComposePopupView extends AbstractViewPopup {
}
}
popupMenu(event) {
if (event.ctrlKey || event.metaKey || 'ContextMenu' == event.key
|| (this.oEditor && !this.oEditor.hasFocus() && !inFocus())) {
this.identitiesDropdownTrigger(true);
return false;
}
}
onBuild(dom) {
// initUploader
const oJua = new Jua({
@ -1326,8 +1318,10 @@ export class ComposePopupView extends AbstractViewPopup {
shortcuts.add('q', 'meta', ScopeCompose, ()=>false);
shortcuts.add('w', 'meta', ScopeCompose, ()=>false);
shortcuts.add('contextmenu', '', ScopeCompose, e => this.popupMenu(e));
shortcuts.add('m', 'meta', ScopeCompose, e => this.popupMenu(e));
shortcuts.add('m', 'meta', ScopeCompose, () => {
this.identitiesDropdownTrigger(true);
return false;
});
shortcuts.add('arrowdown', 'meta', ScopeCompose, () => {
this.skipCommand();

View file

@ -24,7 +24,7 @@ import {
fireEvent
} from 'Common/Globals';
import { arrayLength, inFocus } from 'Common/Utils';
import { arrayLength } from 'Common/Utils';
import { download, mailToHelper, showMessageComposer, initFullscreen } from 'Common/UtilsUser';
import { SMAudio } from 'Common/Audio';
@ -333,12 +333,12 @@ export class MailMessageView extends AbstractViewRight {
}
});
keyScopeReal.subscribe(value => this.messageDomFocused(Scope.MessageView === value && !inFocus()));
keyScopeReal.subscribe(value => this.messageDomFocused(Scope.MessageView === value));
// initShortcuts
// exit fullscreen, back
shortcuts.add('escape,backspace', '', Scope.MessageView, () => {
shortcuts.add('escape', '', Scope.MessageView, () => {
if (!this.viewModelDom.hidden && currentMessage()) {
const preview = SettingsUserStore.usePreviewPane();
if (this.fullScreenMode()) {

View file

@ -125,7 +125,7 @@ export class SystemDropDownUserView extends AbstractViewRight {
}
onBuild() {
shortcuts.add('m,contextmenu', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => {
shortcuts.add('m', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => {
if (!this.viewModelDom.hidden) {
MessageUserStore.fullScreen(false);
this.accountMenuDropdownTrigger(true);

View file

@ -63,14 +63,10 @@ const
keydown = event => {
let key = (event.key || '').toLowerCase().replace(' ','space'),
target = event.target;
// ignore keydown in any element that supports keyboard input unless it's the Escape key
if ('escape' === key || !target.closest || !target.closest('input,select,textarea,[contenteditable]')) {
let modifiers = ['alt','ctrl','meta','shift'].filter(v => event[v+'Key']).join('+');
scope[key] && scope[key][modifiers] && scope[key][modifiers].forEach(cmd => exec(event, cmd));
!event.defaultPrevented && _scope !== 'all' && _scopes.all[key] && _scopes.all[key][modifiers]
&& _scopes.all[key][modifiers].forEach(cmd => exec(event, cmd));
}
modifiers = ['alt','ctrl','meta','shift'].filter(v => event[v+'Key']).join('+');
scope[key] && scope[key][modifiers] && scope[key][modifiers].forEach(cmd => exec(event, cmd));
!event.defaultPrevented && _scope !== 'all' && _scopes.all[key] && _scopes.all[key][modifiers]
&& _scopes.all[key][modifiers].forEach(cmd => exec(event, cmd));
};
win.shortcuts = shortcuts;

View file

@ -14,9 +14,9 @@
tabindex="0"
data-i18n="SHORTCUTS_HELP/TAB_MAILBOX"></label>
<div class="tab-content" role="tabpanel" aria-hidden="false">
<table class="table table-striped table-bordered">
<table class="table table-striped table-bordered" style="border-radius: 0 4px 4px 4px">
<tbody>
<tr><td></td><td data-i18n="SHORTCUTS_HELP/LABEL_OPEN_USER_DROPDOWN"></td><td>M, Menu</td></tr>
<tr><td></td><td data-i18n="SHORTCUTS_HELP/LABEL_OPEN_USER_DROPDOWN"></td><td>M</td></tr>
<tr><td class="fontastic"></td><td data-i18n="SHORTCUTS_HELP/LABEL_REPLY"></td><td>R, Reply</td></tr>
<tr><td class="fontastic"></td><td data-i18n="SHORTCUTS_HELP/LABEL_REPLY_ALL"></td><td>A, Shift + Reply</td></tr>
<tr><td class="fontastic"></td><td data-i18n="SHORTCUTS_HELP/LABEL_FORWARD"></td><td>F, Fwd</td></tr>
@ -84,7 +84,7 @@
<table class="table table-striped table-bordered">
<tbody>
<tr><td data-i18n="SHORTCUTS_HELP/LABEL_OPEN_COMPOSE_POPUP"></td><td>W, C, New</td></tr>
<tr><td data-i18n="SHORTCUTS_HELP/LABEL_OPEN_IDENTITIES_DROPDOWN"></td><td>Menu, <!-- ko text: metaKey --><!-- /ko --> + M</td></tr>
<tr><td data-i18n="SHORTCUTS_HELP/LABEL_OPEN_IDENTITIES_DROPDOWN"></td><td><!-- ko text: metaKey --><!-- /ko --> + M</td></tr>
<tr><td data-i18n="SHORTCUTS_HELP/LABEL_SAVE_MESSAGE"></td><td><!-- ko text: metaKey --><!-- /ko --> + S, Save</td></tr>
<tr><td data-i18n="SHORTCUTS_HELP/LABEL_SEND_MESSAGE"></td><td>Send, <!-- ko text: metaKey --><!-- /ko --> + Enter</td></tr>
<tr><td data-i18n="SHORTCUTS_HELP/LABEL_MINIMIZE_COMPOSE_POPUP"></td><td>Esc, Close</td></tr>