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

pull/1192/head
hristoterezov 9 years ago
parent a4d5c41b3a
commit 5d269ad0aa
  1. 20
      modules/keyboardshortcut/keyboardshortcut.js
  2. 2
      modules/remotecontrol/Controller.js

@ -65,6 +65,12 @@ function showKeyboardShortcutsPanel(show) {
*/ */
let _shortcuts = {}; let _shortcuts = {};
/**
* True if the keyboard shortcuts are enabled and false if not.
* @type {boolean}
*/
let enabled = true;
/** /**
* Maps keycode to character, id of popover for given function and function. * Maps keycode to character, id of popover for given function and function.
*/ */
@ -74,6 +80,9 @@ var KeyboardShortcut = {
var self = this; var self = this;
window.onkeyup = function(e) { window.onkeyup = function(e) {
if(!enabled) {
return;
}
var key = self._getKeyboardKey(e).toUpperCase(); var key = self._getKeyboardKey(e).toUpperCase();
var num = parseInt(key, 10); var num = parseInt(key, 10);
if(!($(":focus").is("input[type=text]") || if(!($(":focus").is("input[type=text]") ||
@ -93,6 +102,9 @@ var KeyboardShortcut = {
}; };
window.onkeydown = function(e) { window.onkeydown = function(e) {
if(!enabled) {
return;
}
if(!($(":focus").is("input[type=text]") || if(!($(":focus").is("input[type=text]") ||
$(":focus").is("input[type=password]") || $(":focus").is("input[type=password]") ||
$(":focus").is("textarea"))) { $(":focus").is("textarea"))) {
@ -105,6 +117,14 @@ var KeyboardShortcut = {
}; };
}, },
/**
* Enables/Disables the keyboard shortcuts.
* @param {boolean} value - the new value.
*/
enable: function (value) {
enabled = value;
},
/** /**
* Registers a new shortcut. * Registers a new shortcut.
* *

@ -167,6 +167,7 @@ export default class Controller extends RemoteControlParticipant {
_start() { _start() {
if(!this.enabled) if(!this.enabled)
return; return;
APP.keyboardshortcut.enable(false);
APP.conference.addConferenceListener( APP.conference.addConferenceListener(
ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
this._stopListener); this._stopListener);
@ -207,6 +208,7 @@ export default class Controller extends RemoteControlParticipant {
if(!this.controlledParticipant) { if(!this.controlledParticipant) {
return; return;
} }
APP.keyboardshortcut.enable(true);
APP.conference.removeConferenceListener( APP.conference.removeConferenceListener(
ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
this._stopListener); this._stopListener);

Loading…
Cancel
Save