Quellcode durchsuchen

Updates show/hide of shortcuts dialog.

Fixes not able to close it with esc button.
master
damencho vor 9 Jahren
Ursprung
Commit
215d8b1355
2 geänderte Dateien mit 29 neuen und 29 gelöschten Zeilen
  1. 0
    27
      modules/UI/UI.js
  2. 29
    2
      modules/keyboardshortcut/keyboardshortcut.js

+ 0
- 27
modules/UI/UI.js Datei anzeigen

@@ -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 Datei anzeigen

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

Laden…
Abbrechen
Speichern