Merge pull request #705 from bgrozev/esc-shortcut

Hide the shortcuts panel when the Escape key is pressed.
This commit is contained in:
Дамян Минков 2016-06-23 16:24:10 -05:00 committed by GitHub
commit f3dc6f15e4
2 changed files with 25 additions and 8 deletions

View File

@ -1416,10 +1416,21 @@ UI.hideRingOverLay = function () {
};
/**
* Shows or hides the keyboard shortcuts panel.'
* Shows or hides the keyboard shortcuts panel, depending on the current state.'
*/
UI.toggleKeyboardShortcutsPanel = function() {
$('#keyboard-shortcuts').toggle();
};
/**
* Shows or hides the keyboard shortcuts panel.'
*/
UI.showKeyboardShortcutsPanel = function(show) {
if (show) {
$('#keyboard-shortcuts').show();
} else {
$('#keyboard-shortcuts').hide();
}
};
module.exports = UI;

View File

@ -3,13 +3,10 @@
var shortcuts = {};
function initShortcutHandlers() {
shortcuts = {
191: {
character: "/",
function: function(e) {
// Only trigger on "?", not on "/".
if (e.shiftKey) {
APP.UI.toggleKeyboardShortcutsPanel();
}
27: {
character: "Esc",
function: function() {
APP.UI.showKeyboardShortcutsPanel(false);
}
},
67: {
@ -59,6 +56,15 @@ function initShortcutHandlers() {
function: function() {
APP.conference.toggleVideoMuted();
}
},
191: {
character: "/",
function: function(e) {
// Only trigger on "?", not on "/".
if (e.shiftKey) {
APP.UI.toggleKeyboardShortcutsPanel();
}
}
}
};
}