mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-29 11:01:34 +08:00
Remove some shortcuts due to conflicts, read #252
This commit is contained in:
parent
4250dcf3f0
commit
096faae844
8 changed files with 18 additions and 40 deletions
|
@ -29,16 +29,6 @@ export const
|
||||||
domItem && item && undefined !== item.disabled
|
domItem && item && undefined !== item.disabled
|
||||||
&& domItem.classList.toggle('disabled', domItem.disabled = 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
|
// unescape(encodeURIComponent()) makes the UTF-16 DOMString to an UTF-8 string
|
||||||
b64EncodeJSON = data => btoa(unescape(encodeURIComponent(JSON.stringify(data)))),
|
b64EncodeJSON = data => btoa(unescape(encodeURIComponent(JSON.stringify(data)))),
|
||||||
/* // Without deprecated 'unescape':
|
/* // Without deprecated 'unescape':
|
||||||
|
|
4
dev/External/SquireUI.js
vendored
4
dev/External/SquireUI.js
vendored
|
@ -354,8 +354,8 @@ class SquireUI
|
||||||
changes.redo.input.disabled = !state.canRedo;
|
changes.redo.input.disabled = !state.canRedo;
|
||||||
});
|
});
|
||||||
|
|
||||||
squire.addEventListener('focus', () => shortcuts.off());
|
// squire.addEventListener('focus', () => shortcuts.off());
|
||||||
squire.addEventListener('blur', () => shortcuts.on());
|
// squire.addEventListener('blur', () => shortcuts.on());
|
||||||
|
|
||||||
container.append(toolbar, wysiwyg, plain);
|
container.append(toolbar, wysiwyg, plain);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { inFocus } from 'Common/Utils';
|
|
||||||
import { addObservablesTo, addComputablesTo, addSubscribablesTo } from 'External/ko';
|
import { addObservablesTo, addComputablesTo, addSubscribablesTo } from 'External/ko';
|
||||||
import { Scope } from 'Common/Enums';
|
import { Scope } from 'Common/Enums';
|
||||||
import { keyScope, SettingsGet, leftPanelDisabled } from 'Common/Globals';
|
import { keyScope, SettingsGet, leftPanelDisabled } from 'Common/Globals';
|
||||||
|
@ -68,7 +67,6 @@ export class AbstractViewPopup extends AbstractView
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
shortcuts.add('backspace', '', name, inFocus());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Happens when user hits Escape or Close key
|
// Happens when user hits Escape or Close key
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
SetSystemFoldersNotification
|
SetSystemFoldersNotification
|
||||||
} from 'Common/EnumsUser';
|
} 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 { initFullscreen } from 'Common/UtilsUser';
|
||||||
import { encodeHtml, HtmlEditor, htmlToPlain } from 'Common/Html';
|
import { encodeHtml, HtmlEditor, htmlToPlain } from 'Common/Html';
|
||||||
import { koArrayWithDestroy } from 'External/ko';
|
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) {
|
onBuild(dom) {
|
||||||
// initUploader
|
// initUploader
|
||||||
const oJua = new Jua({
|
const oJua = new Jua({
|
||||||
|
@ -1326,8 +1318,10 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
shortcuts.add('q', 'meta', ScopeCompose, ()=>false);
|
shortcuts.add('q', 'meta', ScopeCompose, ()=>false);
|
||||||
shortcuts.add('w', 'meta', ScopeCompose, ()=>false);
|
shortcuts.add('w', 'meta', ScopeCompose, ()=>false);
|
||||||
|
|
||||||
shortcuts.add('contextmenu', '', ScopeCompose, e => this.popupMenu(e));
|
shortcuts.add('m', 'meta', ScopeCompose, () => {
|
||||||
shortcuts.add('m', 'meta', ScopeCompose, e => this.popupMenu(e));
|
this.identitiesDropdownTrigger(true);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
shortcuts.add('arrowdown', 'meta', ScopeCompose, () => {
|
shortcuts.add('arrowdown', 'meta', ScopeCompose, () => {
|
||||||
this.skipCommand();
|
this.skipCommand();
|
||||||
|
|
|
@ -24,7 +24,7 @@ import {
|
||||||
fireEvent
|
fireEvent
|
||||||
} from 'Common/Globals';
|
} from 'Common/Globals';
|
||||||
|
|
||||||
import { arrayLength, inFocus } from 'Common/Utils';
|
import { arrayLength } from 'Common/Utils';
|
||||||
import { download, mailToHelper, showMessageComposer, initFullscreen } from 'Common/UtilsUser';
|
import { download, mailToHelper, showMessageComposer, initFullscreen } from 'Common/UtilsUser';
|
||||||
|
|
||||||
import { SMAudio } from 'Common/Audio';
|
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
|
// initShortcuts
|
||||||
|
|
||||||
// exit fullscreen, back
|
// exit fullscreen, back
|
||||||
shortcuts.add('escape,backspace', '', Scope.MessageView, () => {
|
shortcuts.add('escape', '', Scope.MessageView, () => {
|
||||||
if (!this.viewModelDom.hidden && currentMessage()) {
|
if (!this.viewModelDom.hidden && currentMessage()) {
|
||||||
const preview = SettingsUserStore.usePreviewPane();
|
const preview = SettingsUserStore.usePreviewPane();
|
||||||
if (this.fullScreenMode()) {
|
if (this.fullScreenMode()) {
|
||||||
|
|
|
@ -125,7 +125,7 @@ export class SystemDropDownUserView extends AbstractViewRight {
|
||||||
}
|
}
|
||||||
|
|
||||||
onBuild() {
|
onBuild() {
|
||||||
shortcuts.add('m,contextmenu', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => {
|
shortcuts.add('m', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => {
|
||||||
if (!this.viewModelDom.hidden) {
|
if (!this.viewModelDom.hidden) {
|
||||||
MessageUserStore.fullScreen(false);
|
MessageUserStore.fullScreen(false);
|
||||||
this.accountMenuDropdownTrigger(true);
|
this.accountMenuDropdownTrigger(true);
|
||||||
|
|
|
@ -63,14 +63,10 @@ const
|
||||||
|
|
||||||
keydown = event => {
|
keydown = event => {
|
||||||
let key = (event.key || '').toLowerCase().replace(' ','space'),
|
let key = (event.key || '').toLowerCase().replace(' ','space'),
|
||||||
target = event.target;
|
modifiers = ['alt','ctrl','meta','shift'].filter(v => event[v+'Key']).join('+');
|
||||||
// ignore keydown in any element that supports keyboard input unless it's the Escape key
|
scope[key] && scope[key][modifiers] && scope[key][modifiers].forEach(cmd => exec(event, cmd));
|
||||||
if ('escape' === key || !target.closest || !target.closest('input,select,textarea,[contenteditable]')) {
|
!event.defaultPrevented && _scope !== 'all' && _scopes.all[key] && _scopes.all[key][modifiers]
|
||||||
let modifiers = ['alt','ctrl','meta','shift'].filter(v => event[v+'Key']).join('+');
|
&& _scopes.all[key][modifiers].forEach(cmd => exec(event, cmd));
|
||||||
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;
|
win.shortcuts = shortcuts;
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
data-i18n="SHORTCUTS_HELP/TAB_MAILBOX"></label>
|
data-i18n="SHORTCUTS_HELP/TAB_MAILBOX"></label>
|
||||||
<div class="tab-content" role="tabpanel" aria-hidden="false">
|
<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>
|
<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"></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_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>
|
<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">
|
<table class="table table-striped table-bordered">
|
||||||
<tbody>
|
<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_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_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_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>
|
<tr><td data-i18n="SHORTCUTS_HELP/LABEL_MINIMIZE_COMPOSE_POPUP"></td><td>Esc, Close</td></tr>
|
||||||
|
|
Loading…
Reference in a new issue