Merge pull request #1103 from jitsi/esc-shortcuts-dialog
Esc closes shortcuts dialog
This commit is contained in:
commit
0bf372b8ab
|
@ -176,7 +176,8 @@ function muteLocalVideo (muted) {
|
|||
* If we have a close page enabled, redirect to it without
|
||||
* showing any other dialog.
|
||||
*
|
||||
* @param {object} options Feedback data
|
||||
* @param {object} options used to decide which particular close page to show
|
||||
* or if close page is disabled, whether we should show the thankyou dialog
|
||||
* @param {boolean} options.thankYouDialogVisible - whether we should
|
||||
* show thank you dialog
|
||||
* @param {boolean} options.feedbackSubmitted - whether feedback was submitted
|
||||
|
|
|
@ -1434,31 +1434,4 @@ UI.hideUserMediaPermissionsGuidanceOverlay = function () {
|
|||
GumPermissionsOverlay.hide();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shows or hides the keyboard shortcuts panel, depending on the current state.'
|
||||
*/
|
||||
UI.toggleKeyboardShortcutsPanel = function() {
|
||||
if (!messageHandler.isDialogOpened()) {
|
||||
let msg = $('#keyboard-shortcuts').html();
|
||||
let buttons = { Close: true };
|
||||
|
||||
messageHandler.openDialog(
|
||||
'keyboardShortcuts.keyboardShortcuts', msg, true, buttons);
|
||||
} else {
|
||||
messageHandler.closeDialog();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Shows or hides the keyboard shortcuts panel.'
|
||||
*/
|
||||
UI.showKeyboardShortcutsPanel = function(show) {
|
||||
if (show) {
|
||||
$('#keyboard-shortcuts').show();
|
||||
} else {
|
||||
$('#keyboard-shortcuts').hide();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = UI;
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
/* global APP, $, JitsiMeetJS */
|
||||
|
||||
/**
|
||||
* The reference to the shortcut dialogs when opened.
|
||||
*/
|
||||
let keyboardShortcutDialog = null;
|
||||
|
||||
/**
|
||||
* Initialise global shortcuts.
|
||||
* Global shortcuts are shortcuts for features that don't have a button or
|
||||
|
@ -9,12 +14,12 @@
|
|||
function initGlobalShortcuts() {
|
||||
|
||||
KeyboardShortcut.registerShortcut("ESCAPE", null, function() {
|
||||
APP.UI.showKeyboardShortcutsPanel(false);
|
||||
showKeyboardShortcutsPanel(false);
|
||||
});
|
||||
|
||||
KeyboardShortcut.registerShortcut("?", null, function() {
|
||||
JitsiMeetJS.analytics.sendEvent("shortcut.shortcut.help");
|
||||
APP.UI.toggleKeyboardShortcutsPanel();
|
||||
showKeyboardShortcutsPanel(true);
|
||||
}, "keyboardShortcuts.toggleShortcuts");
|
||||
|
||||
// register SPACE shortcut in two steps to insure visibility of help message
|
||||
|
@ -32,6 +37,28 @@ function initGlobalShortcuts() {
|
|||
KeyboardShortcut._addShortcutToHelp("1-9", "keyboardShortcuts.focusRemote");
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows or hides the keyboard shortcuts dialog.
|
||||
* @param {boolean} show whether to show or hide the dialog
|
||||
*/
|
||||
function showKeyboardShortcutsPanel(show) {
|
||||
if (show
|
||||
&& !APP.UI.messageHandler.isDialogOpened()
|
||||
&& keyboardShortcutDialog === null) {
|
||||
|
||||
let msg = $('#keyboard-shortcuts').html();
|
||||
let buttons = { Close: true };
|
||||
|
||||
keyboardShortcutDialog = APP.UI.messageHandler.openDialog(
|
||||
'keyboardShortcuts.keyboardShortcuts', msg, true, buttons);
|
||||
} else {
|
||||
if (keyboardShortcutDialog !== null) {
|
||||
keyboardShortcutDialog.close();
|
||||
keyboardShortcutDialog = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Map of shortcuts. When a shortcut is registered it enters the mapping.
|
||||
* @type {{}}
|
||||
|
|
Loading…
Reference in New Issue