Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix the ctrl+e mute camera shortcut
Browse files Browse the repository at this point in the history
 * Fixes the altgr+e shortcut on Windows
   (Fixes element-hq/element-web#2561)
 * Fixes the shortcuts to be cmd+e on mac rather than ctrl+e
   which is more normal and doesn't clobber ctrl+e which old
   school unix types use for go-to-end-of-line.
  • Loading branch information
dbkr committed Nov 8, 2016
1 parent 884ae0e commit a008f50
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/structures/RoomView.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,18 +358,25 @@ module.exports = React.createClass({
},

onKeyDown: function(ev) {
var handled = false;
let handled = false;
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
let ctrlCmdOnly;
if (isMac) {
ctrlCmdOnly = ev.metaKey && !ev.altKey && !ev.ctrlKey && !ev.shiftKey;
} else {
ctrlCmdOnly = ev.ctrlKey && !ev.altKey && !ev.metaKey && !ev.shiftKey;
}

switch (ev.keyCode) {
case KeyCode.KEY_D:
if (ev.ctrlKey) {
if (ctrlCmdOnly) {
this.onMuteAudioClick();
handled = true;
}
break;

case KeyCode.KEY_E:
if (ev.ctrlKey) {
if (ctrlCmdOnly) {
this.onMuteVideoClick();
handled = true;
}
Expand Down

0 comments on commit a008f50

Please sign in to comment.