1
0
mirror of https://github.com/moparisthebest/mail synced 2025-01-11 05:28:00 -05:00

Global key shortcut to close lightbox

This commit is contained in:
Tankred Hase 2014-04-23 17:45:02 +02:00
parent 6bb1bd2239
commit 23be9c823d

View File

@ -143,13 +143,13 @@ define(function(require) {
var modifier = e.ctrlKey || e.metaKey; var modifier = e.ctrlKey || e.metaKey;
if (modifier && e.keyCode === 78 && scope.state.writer && !scope.state.writer.open) { if (modifier && e.keyCode === 78 && scope.state.lightbox !== 'write') {
// n -> new mail // n -> new mail
e.preventDefault(); e.preventDefault();
scope.state.writer.write(); scope.state.writer.write();
scope.$apply(); scope.$apply();
} else if (modifier && e.keyCode === 70 && !scope.state.writer.open) { } else if (modifier && e.keyCode === 70 && scope.state.lightbox !== 'write') {
// f -> find // f -> find
e.preventDefault(); e.preventDefault();
scope.state.mailList.searching = true; scope.state.mailList.searching = true;
@ -158,34 +158,22 @@ define(function(require) {
}, 200); }, 200);
scope.$apply(); scope.$apply();
} else if (modifier && e.keyCode === 82 && scope.state.writer && !scope.state.writer.open && scope.state.mailList.selected) { } else if (modifier && e.keyCode === 82 && scope.state.lightbox !== 'write' && scope.state.mailList.selected) {
// r -> reply // r -> reply
e.preventDefault(); e.preventDefault();
scope.state.writer.write(scope.state.mailList.selected); scope.state.writer.write(scope.state.mailList.selected);
scope.$apply(); scope.$apply();
} else if (modifier && e.keyCode === 83 && scope.state.writer && !scope.state.writer.open && scope.state.mailList.synchronize) { } else if (modifier && e.keyCode === 83 && scope.state.lightbox !== 'write' && scope.state.mailList.synchronize) {
// s -> sync folder // s -> sync folder
e.preventDefault(); e.preventDefault();
scope.state.mailList.synchronize(); scope.state.mailList.synchronize();
scope.$apply(); scope.$apply();
} else if (e.keyCode === 27 && scope.state.writer.open) { } else if (e.keyCode === 27 && scope.state.lightbox !== undefined) {
// escape -> close writer // escape -> close current lightbox
e.preventDefault(); e.preventDefault();
scope.state.writer.close(); scope.state.lightbox = undefined;
scope.$apply();
} else if (e.keyCode === 27 && scope.state.account.open) {
// escape -> close account view
e.preventDefault();
scope.state.account.toggle(false);
scope.$apply();
} else if (e.keyCode === 27 && scope.state.contacts.open) {
// escape -> close contacts view
e.preventDefault();
scope.state.contacts.toggle(false);
scope.$apply(); scope.$apply();
} else if (e.keyCode === 27 && scope.state.nav.open) { } else if (e.keyCode === 27 && scope.state.nav.open) {