|
@@ -1,5 +1,10 @@
|
1
|
1
|
/* global APP, $, JitsiMeetJS */
|
2
|
2
|
|
|
3
|
+/**
|
|
4
|
+ * The reference to the shortcut dialogs when opened.
|
|
5
|
+ */
|
|
6
|
+let keyboardShortcutDialog = null;
|
|
7
|
+
|
3
|
8
|
/**
|
4
|
9
|
* Initialise global shortcuts.
|
5
|
10
|
* Global shortcuts are shortcuts for features that don't have a button or
|
|
@@ -9,12 +14,12 @@
|
9
|
14
|
function initGlobalShortcuts() {
|
10
|
15
|
|
11
|
16
|
KeyboardShortcut.registerShortcut("ESCAPE", null, function() {
|
12
|
|
- APP.UI.showKeyboardShortcutsPanel(false);
|
|
17
|
+ showKeyboardShortcutsPanel(false);
|
13
|
18
|
});
|
14
|
19
|
|
15
|
20
|
KeyboardShortcut.registerShortcut("?", null, function() {
|
16
|
21
|
JitsiMeetJS.analytics.sendEvent("shortcut.shortcut.help");
|
17
|
|
- APP.UI.toggleKeyboardShortcutsPanel();
|
|
22
|
+ showKeyboardShortcutsPanel(true);
|
18
|
23
|
}, "keyboardShortcuts.toggleShortcuts");
|
19
|
24
|
|
20
|
25
|
// register SPACE shortcut in two steps to insure visibility of help message
|
|
@@ -32,6 +37,28 @@ function initGlobalShortcuts() {
|
32
|
37
|
KeyboardShortcut._addShortcutToHelp("1-9", "keyboardShortcuts.focusRemote");
|
33
|
38
|
}
|
34
|
39
|
|
|
40
|
+/**
|
|
41
|
+ * Shows or hides the keyboard shortcuts dialog.
|
|
42
|
+ * @param {boolean} show whether to show or hide the dialog
|
|
43
|
+ */
|
|
44
|
+function showKeyboardShortcutsPanel(show) {
|
|
45
|
+ if (show
|
|
46
|
+ && !APP.UI.messageHandler.isDialogOpened()
|
|
47
|
+ && keyboardShortcutDialog === null) {
|
|
48
|
+
|
|
49
|
+ let msg = $('#keyboard-shortcuts').html();
|
|
50
|
+ let buttons = { Close: true };
|
|
51
|
+
|
|
52
|
+ keyboardShortcutDialog = APP.UI.messageHandler.openDialog(
|
|
53
|
+ 'keyboardShortcuts.keyboardShortcuts', msg, true, buttons);
|
|
54
|
+ } else {
|
|
55
|
+ if (keyboardShortcutDialog !== null) {
|
|
56
|
+ keyboardShortcutDialog.close();
|
|
57
|
+ keyboardShortcutDialog = null;
|
|
58
|
+ }
|
|
59
|
+ }
|
|
60
|
+}
|
|
61
|
+
|
35
|
62
|
/**
|
36
|
63
|
* Map of shortcuts. When a shortcut is registered it enters the mapping.
|
37
|
64
|
* @type {{}}
|