Selaa lähdekoodia

fix(remotecontrol): Disable the keyboard shortcuts during remote control

master
hristoterezov 8 vuotta sitten
vanhempi
commit
5d269ad0aa

+ 20
- 0
modules/keyboardshortcut/keyboardshortcut.js Näytä tiedosto

@@ -65,6 +65,12 @@ function showKeyboardShortcutsPanel(show) {
65 65
  */
66 66
 let _shortcuts = {};
67 67
 
68
+/**
69
+ * True if the keyboard shortcuts are enabled and false if not.
70
+ * @type {boolean}
71
+ */
72
+let enabled = true;
73
+
68 74
 /**
69 75
  * Maps keycode to character, id of popover for given function and function.
70 76
  */
@@ -74,6 +80,9 @@ var KeyboardShortcut = {
74 80
 
75 81
         var self = this;
76 82
         window.onkeyup = function(e) {
83
+            if(!enabled) {
84
+                return;
85
+            }
77 86
             var key = self._getKeyboardKey(e).toUpperCase();
78 87
             var num = parseInt(key, 10);
79 88
             if(!($(":focus").is("input[type=text]") ||
@@ -93,6 +102,9 @@ var KeyboardShortcut = {
93 102
         };
94 103
 
95 104
         window.onkeydown = function(e) {
105
+            if(!enabled) {
106
+                return;
107
+            }
96 108
             if(!($(":focus").is("input[type=text]") ||
97 109
                 $(":focus").is("input[type=password]") ||
98 110
                 $(":focus").is("textarea"))) {
@@ -105,6 +117,14 @@ var KeyboardShortcut = {
105 117
         };
106 118
     },
107 119
 
120
+    /**
121
+     * Enables/Disables the keyboard shortcuts.
122
+     * @param {boolean} value - the new value.
123
+     */
124
+    enable: function (value) {
125
+        enabled = value;
126
+    },
127
+
108 128
     /**
109 129
      * Registers a new shortcut.
110 130
      *

+ 2
- 0
modules/remotecontrol/Controller.js Näytä tiedosto

@@ -167,6 +167,7 @@ export default class Controller extends RemoteControlParticipant {
167 167
     _start() {
168 168
         if(!this.enabled)
169 169
             return;
170
+        APP.keyboardshortcut.enable(false);
170 171
         APP.conference.addConferenceListener(
171 172
             ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
172 173
             this._stopListener);
@@ -207,6 +208,7 @@ export default class Controller extends RemoteControlParticipant {
207 208
         if(!this.controlledParticipant) {
208 209
             return;
209 210
         }
211
+        APP.keyboardshortcut.enable(true);
210 212
         APP.conference.removeConferenceListener(
211 213
             ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
212 214
             this._stopListener);

Loading…
Peruuta
Tallenna