Explorar el Código

Merge pull request #1103 from jitsi/esc-shortcuts-dialog

Esc closes shortcuts dialog
j8
yanas hace 8 años
padre
commit
0bf372b8ab
Se han modificado 3 ficheros con 31 adiciones y 30 borrados
  1. 2
    1
      conference.js
  2. 0
    27
      modules/UI/UI.js
  3. 29
    2
      modules/keyboardshortcut/keyboardshortcut.js

+ 2
- 1
conference.js Ver fichero

@@ -176,7 +176,8 @@ function muteLocalVideo (muted) {
176 176
  * If we have a close page enabled, redirect to it without
177 177
  * showing any other dialog.
178 178
  *
179
- * @param {object} options Feedback data
179
+ * @param {object} options used to decide which particular close page to show
180
+ * or if close page is disabled, whether we should show the thankyou dialog
180 181
  * @param {boolean} options.thankYouDialogVisible - whether we should
181 182
  * show thank you dialog
182 183
  * @param {boolean} options.feedbackSubmitted - whether feedback was submitted

+ 0
- 27
modules/UI/UI.js Ver fichero

@@ -1434,31 +1434,4 @@ UI.hideUserMediaPermissionsGuidanceOverlay = function () {
1434 1434
     GumPermissionsOverlay.hide();
1435 1435
 };
1436 1436
 
1437
-/**
1438
- * Shows or hides the keyboard shortcuts panel, depending on the current state.'
1439
- */
1440
-UI.toggleKeyboardShortcutsPanel = function() {
1441
-    if (!messageHandler.isDialogOpened()) {
1442
-        let msg = $('#keyboard-shortcuts').html();
1443
-        let buttons = { Close: true };
1444
-
1445
-        messageHandler.openDialog(
1446
-            'keyboardShortcuts.keyboardShortcuts', msg, true, buttons);
1447
-    } else {
1448
-        messageHandler.closeDialog();
1449
-    }
1450
-
1451
-};
1452
-
1453
-/**
1454
- * Shows or hides the keyboard shortcuts panel.'
1455
- */
1456
-UI.showKeyboardShortcutsPanel = function(show) {
1457
-    if (show) {
1458
-        $('#keyboard-shortcuts').show();
1459
-    } else {
1460
-        $('#keyboard-shortcuts').hide();
1461
-    }
1462
-};
1463
-
1464 1437
 module.exports = UI;

+ 29
- 2
modules/keyboardshortcut/keyboardshortcut.js Ver fichero

@@ -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 {{}}

Loading…
Cancelar
Guardar