Ver código fonte

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

Esc closes shortcuts dialog
master
yanas 8 anos atrás
pai
commit
0bf372b8ab
3 arquivos alterados com 31 adições e 30 exclusões
  1. 2
    1
      conference.js
  2. 0
    27
      modules/UI/UI.js
  3. 29
    2
      modules/keyboardshortcut/keyboardshortcut.js

+ 2
- 1
conference.js Ver arquivo

176
  * If we have a close page enabled, redirect to it without
176
  * If we have a close page enabled, redirect to it without
177
  * showing any other dialog.
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
  * @param {boolean} options.thankYouDialogVisible - whether we should
181
  * @param {boolean} options.thankYouDialogVisible - whether we should
181
  * show thank you dialog
182
  * show thank you dialog
182
  * @param {boolean} options.feedbackSubmitted - whether feedback was submitted
183
  * @param {boolean} options.feedbackSubmitted - whether feedback was submitted

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

1434
     GumPermissionsOverlay.hide();
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
 module.exports = UI;
1437
 module.exports = UI;

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

1
 /* global APP, $, JitsiMeetJS */
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
  * Initialise global shortcuts.
9
  * Initialise global shortcuts.
5
  * Global shortcuts are shortcuts for features that don't have a button or
10
  * Global shortcuts are shortcuts for features that don't have a button or
9
 function initGlobalShortcuts() {
14
 function initGlobalShortcuts() {
10
 
15
 
11
     KeyboardShortcut.registerShortcut("ESCAPE", null, function() {
16
     KeyboardShortcut.registerShortcut("ESCAPE", null, function() {
12
-        APP.UI.showKeyboardShortcutsPanel(false);
17
+        showKeyboardShortcutsPanel(false);
13
     });
18
     });
14
 
19
 
15
     KeyboardShortcut.registerShortcut("?", null, function() {
20
     KeyboardShortcut.registerShortcut("?", null, function() {
16
         JitsiMeetJS.analytics.sendEvent("shortcut.shortcut.help");
21
         JitsiMeetJS.analytics.sendEvent("shortcut.shortcut.help");
17
-        APP.UI.toggleKeyboardShortcutsPanel();
22
+        showKeyboardShortcutsPanel(true);
18
     }, "keyboardShortcuts.toggleShortcuts");
23
     }, "keyboardShortcuts.toggleShortcuts");
19
 
24
 
20
     // register SPACE shortcut in two steps to insure visibility of help message
25
     // register SPACE shortcut in two steps to insure visibility of help message
32
     KeyboardShortcut._addShortcutToHelp("1-9", "keyboardShortcuts.focusRemote");
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
  * Map of shortcuts. When a shortcut is registered it enters the mapping.
63
  * Map of shortcuts. When a shortcut is registered it enters the mapping.
37
  * @type {{}}
64
  * @type {{}}

Carregando…
Cancelar
Salvar