mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 05:59:21 +03:00
Revamp shortcuts handler (not tested yet)
This commit is contained in:
parent
31828b125f
commit
5e7f531c7f
21 changed files with 190 additions and 170 deletions
|
|
@ -86,7 +86,8 @@ class AskPopupView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
onBuild() {
|
||||
key('tab, shift+tab, right, left', KeyState.PopupAsk, () => {
|
||||
// shortcuts.add('tab', 'shift', KeyState.PopupAsk, () => {
|
||||
shortcuts.add(['tab','arrowright','arrowleft'], '', KeyState.PopupAsk, () => {
|
||||
let btn = this.querySelector('.buttonYes');
|
||||
if (btn.matches(':focus')) {
|
||||
btn = this.querySelector('.buttonNo');
|
||||
|
|
@ -95,7 +96,7 @@ class AskPopupView extends AbstractViewNext {
|
|||
return false;
|
||||
});
|
||||
|
||||
key('esc', KeyState.PopupAsk, () => {
|
||||
shortcuts.add('escape', '', KeyState.PopupAsk, () => {
|
||||
this.noClick();
|
||||
return false;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1114,9 +1114,10 @@ class ComposePopupView extends AbstractViewNext {
|
|||
onBuild(dom) {
|
||||
this.initUploader();
|
||||
|
||||
key('ctrl+q, command+q, ctrl+w, command+w', KeyState.Compose, ()=>false);
|
||||
shortcuts.add('q', 'meta', KeyState.Compose, ()=>false);
|
||||
shortcuts.add('w', 'meta', KeyState.Compose, ()=>false);
|
||||
|
||||
key('`', KeyState.Compose, () => {
|
||||
shortcuts.add('`', '', KeyState.Compose, () => {
|
||||
if (this.oEditor && !this.oEditor.hasFocus() && !inFocus()) {
|
||||
this.identitiesDropdownTrigger(true);
|
||||
return false;
|
||||
|
|
@ -1125,31 +1126,35 @@ class ComposePopupView extends AbstractViewNext {
|
|||
return true;
|
||||
});
|
||||
|
||||
key('ctrl+`', KeyState.Compose, () => {
|
||||
shortcuts.add('`', 'ctrl', KeyState.Compose, () => {
|
||||
this.identitiesDropdownTrigger(true);
|
||||
return false;
|
||||
});
|
||||
|
||||
key('esc, ctrl+down, command+down', KeyState.Compose, () => {
|
||||
shortcuts.add('escape', '', KeyState.Compose, () => {
|
||||
this.skipCommand();
|
||||
return false;
|
||||
});
|
||||
shortcuts.add('arrowdown', 'meta', KeyState.Compose, () => {
|
||||
this.skipCommand();
|
||||
return false;
|
||||
});
|
||||
|
||||
if (this.allowFolders) {
|
||||
key('ctrl+s, command+s', KeyState.Compose, () => {
|
||||
shortcuts.add('s', 'meta', KeyState.Compose, () => {
|
||||
this.saveCommand();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (Settings.app('allowCtrlEnterOnCompose')) {
|
||||
key('ctrl+enter, command+enter', KeyState.Compose, () => {
|
||||
shortcuts.add('enter', 'meta', KeyState.Compose, () => {
|
||||
this.sendCommand();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
key('shift+esc', KeyState.Compose, () => {
|
||||
shortcuts.add('escape', 'shift', KeyState.Compose, () => {
|
||||
if (this.modalVisibility()) {
|
||||
this.tryToClosePopup();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,7 +303,8 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
onBuild() {
|
||||
key('tab,shift+tab', KeyState.PopupComposeOpenPGP, () => {
|
||||
// shortcuts.add(('tab', 'shift', KeyState.PopupComposeOpenPGP, () => {
|
||||
shortcuts.add('tab', '', KeyState.PopupComposeOpenPGP, () => {
|
||||
let btn = this.querySelector('.inputPassword');
|
||||
if (btn.matches(':focus')) {
|
||||
btn = this.querySelector('.buttonDo');
|
||||
|
|
|
|||
|
|
@ -606,12 +606,12 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
onBuild(dom) {
|
||||
this.selector.init(dom.querySelector('.b-list-content'), KeyState.ContactList);
|
||||
|
||||
key('delete', KeyState.ContactList, () => {
|
||||
shortcuts.add('delete', '', KeyState.ContactList, () => {
|
||||
this.deleteCommand();
|
||||
return false;
|
||||
});
|
||||
|
||||
key('c, w', KeyState.ContactList, () => {
|
||||
shortcuts.add(['c','w'], '', KeyState.ContactList, () => {
|
||||
this.newMessageCommand();
|
||||
return false;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ class KeyboardShortcutsHelpPopupView extends AbstractViewNext {
|
|||
onBuild(dom) {
|
||||
dom.querySelectorAll('a[data-toggle="tab"]').forEach(node => node.Tab || new BSN.Tab(node));
|
||||
|
||||
key(
|
||||
'tab, shift+tab, left, right',
|
||||
// shortcuts.add('tab', 'shift',
|
||||
shortcuts.add(['tab','arrowleft','arrowright'], '',
|
||||
KeyState.PopupKeyboardShortcutsHelp,
|
||||
((event, handler)=>{
|
||||
if (event && handler) {
|
||||
|
|
@ -26,7 +26,7 @@ class KeyboardShortcutsHelpPopupView extends AbstractViewNext {
|
|||
let next = 0;
|
||||
tabs.forEach((node, index) => {
|
||||
if (node.matches('.active')) {
|
||||
if (['tab','right'].includes(handler.shortcut)) {
|
||||
if (['tab','arrowright'].includes(handler.shortcut)) {
|
||||
next = index < last ? index+1 : 0;
|
||||
} else {
|
||||
next = index ? index-1 : last;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,8 @@ class MessageOpenPgpPopupView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
onBuild(oDom) {
|
||||
key('tab,shift+tab', KeyState.PopupMessageOpenPGP, () => {
|
||||
// shortcuts.add('tab','shift', KeyState.PopupMessageOpenPGP, () => {
|
||||
shortcuts.add('tab', '', KeyState.PopupMessageOpenPGP, () => {
|
||||
let btn = this.querySelector('.inputPassword');
|
||||
if (btn.matches(':focus')) {
|
||||
btn = this.querySelector('.buttonDo');
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class PluginPopupView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
onBuild() {
|
||||
key('esc', KeyState.All, () => {
|
||||
shortcuts.add('escape', '', KeyState.All, () => {
|
||||
if (this.modalVisibility()) {
|
||||
this.tryToClosePopup();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class ViewOpenPgpKeyPopupView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
onBuild() {
|
||||
key('ctrl+a, command+a', KeyState.PopupViewOpenPGP, () => {
|
||||
shortcuts.add('a', 'meta', KeyState.PopupViewOpenPGP, () => {
|
||||
this.selectKey();
|
||||
return false;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue