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

This commit is contained in:
hristoterezov 2017-01-06 16:03:54 -06:00
parent a4d5c41b3a
commit 5d269ad0aa
2 changed files with 22 additions and 0 deletions

View File

@ -65,6 +65,12 @@ function showKeyboardShortcutsPanel(show) {
*/
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.
*/
@ -74,6 +80,9 @@ var KeyboardShortcut = {
var self = this;
window.onkeyup = function(e) {
if(!enabled) {
return;
}
var key = self._getKeyboardKey(e).toUpperCase();
var num = parseInt(key, 10);
if(!($(":focus").is("input[type=text]") ||
@ -93,6 +102,9 @@ var KeyboardShortcut = {
};
window.onkeydown = function(e) {
if(!enabled) {
return;
}
if(!($(":focus").is("input[type=text]") ||
$(":focus").is("input[type=password]") ||
$(":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.
*

View File

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