Fix shift-ctrl-click

isOnlyCtrlOrCmdKeyEvent is predicated on !shiftKey, so another function was needed for cases where we ignore other keys
This commit is contained in:
lukebarnard 2018-01-03 11:39:15 +00:00
parent 85cdd888e8
commit d495519986
2 changed files with 11 additions and 2 deletions

View file

@ -68,3 +68,12 @@ export function isOnlyCtrlOrCmdKeyEvent(ev) {
return ev.ctrlKey && !ev.altKey && !ev.metaKey && !ev.shiftKey;
}
}
export function isCtrlOrCmdKeyEvent(ev) {
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
if (isMac) {
return ev.metaKey && !ev.ctrlKey;
} else {
return ev.ctrlKey && !ev.metaKey;
}
}

View file

@ -20,7 +20,7 @@ import classNames from 'classnames';
import { MatrixClient } from 'matrix-js-sdk';
import sdk from '../../../index';
import dis from '../../../dispatcher';
import { isOnlyCtrlOrCmdKeyEvent } from '../../../Keyboard';
import { isCtrlOrCmdKeyEvent } from '../../../Keyboard';
import FlairStore from '../../../stores/FlairStore';
@ -76,7 +76,7 @@ export default React.createClass({
dis.dispatch({
action: 'select_tag',
tag: this.props.tag,
ctrlOrCmdKey: isOnlyCtrlOrCmdKeyEvent(e),
ctrlOrCmdKey: isCtrlOrCmdKeyEvent(e),
shiftKey: e.shiftKey,
});
},