Kaynağa Gözat

Registers filmstrip shortcut from bottom toolbar

master
yanas 9 yıl önce
ebeveyn
işleme
9693cba17a

+ 25
- 1
modules/UI/toolbars/BottomToolbar.js Dosyayı Görüntüle

@@ -10,7 +10,14 @@ const defaultBottomToolbarButtons = {
10 10
         id: '#bottom_toolbar_contact_list'
11 11
     },
12 12
     'filmstrip': {
13
-        id: '#bottom_toolbar_film_strip'
13
+        id: '#bottom_toolbar_film_strip',
14
+        shortcut: "F",
15
+        shortcutAttr: "filmstripPopover",
16
+        shortcutFunc: function() {
17
+            JitsiMeetJS.analytics.sendEvent("shortcut.film.toggled");
18
+            APP.UI.toggleFilmStrip();
19
+        },
20
+        shortcutDescription: "keyboardShortcuts.toggleFilmstrip"
14 21
     }
15 22
 };
16 23
 
@@ -38,6 +45,7 @@ const BottomToolbar = {
38 45
     isEnabled() {
39 46
         return this.enabled;
40 47
     },
48
+
41 49
     setupListeners (emitter) {
42 50
         UIUtil.hideDisabledButtons(defaultBottomToolbarButtons);
43 51
 
@@ -58,6 +66,22 @@ const BottomToolbar = {
58 66
             }
59 67
         };
60 68
 
69
+        Object.keys(defaultBottomToolbarButtons).forEach(
70
+                id => {
71
+                if (UIUtil.isButtonEnabled(id)) {
72
+                    var button = defaultBottomToolbarButtons[id];
73
+
74
+                    if (button.shortcut)
75
+                        APP.keyboardshortcut.registerShortcut(
76
+                            button.shortcut,
77
+                            button.shortcutAttr,
78
+                            button.shortcutFunc,
79
+                            button.shortcutDescription
80
+                        );
81
+                }
82
+            }
83
+        );
84
+
61 85
         Object.keys(buttonHandlers).forEach(
62 86
             buttonId => $(`#${buttonId}`).click(buttonHandlers[buttonId])
63 87
         );

+ 1
- 2
modules/UI/toolbars/Toolbar.js Dosyayı Görüntüle

@@ -2,7 +2,6 @@
2 2
 /* jshint -W101 */
3 3
 import UIUtil from '../util/UIUtil';
4 4
 import UIEvents from '../../../service/UI/UIEvents';
5
-import KeyboardShortcut from '../../keyboardshortcut/keyboardshortcut';
6 5
 
7 6
 let roomUrl = null;
8 7
 let emitter = null;
@@ -253,7 +252,7 @@ const Toolbar = {
253 252
                     var button = defaultToolbarButtons[id];
254 253
 
255 254
                     if (button.shortcut)
256
-                        KeyboardShortcut.registerShortcut(
255
+                        APP.keyboardshortcut.registerShortcut(
257 256
                             button.shortcut,
258 257
                             button.shortcutAttr,
259 258
                             button.shortcutFunc,

+ 22
- 6
modules/keyboardshortcut/keyboardshortcut.js Dosyayı Görüntüle

@@ -27,12 +27,10 @@ function initGlobalShortcuts() {
27 27
         APP.conference.muteAudio(true);
28 28
     }, "keyboardShortcuts.pushToTalk");
29 29
 
30
-    KeyboardShortcut.registerShortcut("F", 'filmstripPopover', function() {
31
-        JitsiMeetJS.analytics.sendEvent("shortcut.film.toggled");
32
-        APP.UI.toggleFilmStrip();
33
-    }, "keyboardShortcuts.toggleFilmstrip");
34
-
35
-    // Focus keys are directly implemented below.
30
+    /**
31
+     * FIXME: Currently focus keys are directly implemented below in onkeyup.
32
+     * They should be moved to the SmallVideo instead.
33
+     */
36 34
     KeyboardShortcut._addShortcutToHelp("0", "keyboardShortcuts.focusLocal");
37 35
     KeyboardShortcut._addShortcutToHelp("1-9", "keyboardShortcuts.focusRemote");
38 36
 }
@@ -123,6 +121,8 @@ var KeyboardShortcut = {
123 121
      */
124 122
     unregisterShortcut: function(shortcutChar) {
125 123
         _shortcuts.remove(shortcutChar);
124
+
125
+        this._removeShortcutFromHelp(shortcutChar);
126 126
     },
127 127
 
128 128
     /**
@@ -177,6 +177,7 @@ var KeyboardShortcut = {
177 177
     _addShortcutToHelp: function (shortcutChar, shortcutDescriptionKey) {
178 178
 
179 179
         var listElement = document.createElement("li");
180
+        listElement.id = shortcutChar;
180 181
 
181 182
         var spanElement = document.createElement("span");
182 183
         spanElement.className = "item-action";
@@ -200,6 +201,21 @@ var KeyboardShortcut = {
200 201
 
201 202
         if (parentListElement)
202 203
             parentListElement.appendChild(listElement);
204
+    },
205
+
206
+    /**
207
+     * Removes the list element corresponding to the given shortcut from the
208
+     * help dialog
209
+     * @private
210
+     */
211
+    _removeShortcutFromHelp: function (shortcutChar) {
212
+        var parentListElement
213
+            = document.getElementById("keyboard-shortcuts-list");
214
+
215
+        var shortcutElement = document.getElementById(shortcutChar);
216
+
217
+        if (shortcutElement)
218
+            parentListElement.removeChild(shortcutElement);
203 219
     }
204 220
 };
205 221
 

Loading…
İptal
Kaydet