diff --git a/src/Keyboard.js b/src/Keyboard.js index 50ed78e063..9c872e1c66 100644 --- a/src/Keyboard.js +++ b/src/Keyboard.js @@ -60,7 +60,7 @@ export const KeyCode = { KEY_Z: 90, }; -export function isCtrlOrCmdKeyEvent(ev) { +export function isOnlyCtrlOrCmdKeyEvent(ev) { const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0; if (isMac) { return ev.metaKey && !ev.altKey && !ev.ctrlKey && !ev.shiftKey; diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index 89971eb5eb..01abf966f9 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -19,7 +19,7 @@ limitations under the License. import * as Matrix from 'matrix-js-sdk'; import React from 'react'; -import { KeyCode, isCtrlOrCmdKeyEvent } from '../../Keyboard'; +import { KeyCode, isOnlyCtrlOrCmdKeyEvent } from '../../Keyboard'; import Notifier from '../../Notifier'; import PageTypes from '../../PageTypes'; import CallMediaHandler from '../../CallMediaHandler'; @@ -153,7 +153,7 @@ export default React.createClass({ */ let handled = false; - const ctrlCmdOnly = isCtrlOrCmdKeyEvent(ev); + const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev); switch (ev.keyCode) { case KeyCode.UP: diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index e506a3fd00..1fda05fb76 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -41,7 +41,7 @@ const rate_limited_func = require('../../ratelimitedfunc'); const ObjectUtils = require('../../ObjectUtils'); const Rooms = require('../../Rooms'); -import { KeyCode, isCtrlOrCmdKeyEvent } from '../../Keyboard'; +import { KeyCode, isOnlyCtrlOrCmdKeyEvent } from '../../Keyboard'; import RoomViewStore from '../../stores/RoomViewStore'; import RoomScrollStateStore from '../../stores/RoomScrollStateStore'; @@ -433,7 +433,7 @@ module.exports = React.createClass({ onKeyDown: function(ev) { let handled = false; - const ctrlCmdOnly = isCtrlOrCmdKeyEvent(ev); + const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev); switch (ev.keyCode) { case KeyCode.KEY_D: diff --git a/src/components/structures/TagPanel.js b/src/components/structures/TagPanel.js index fb92ec52d6..e9b7657345 100644 --- a/src/components/structures/TagPanel.js +++ b/src/components/structures/TagPanel.js @@ -22,7 +22,7 @@ import FilterStore from '../../stores/FilterStore'; import FlairStore from '../../stores/FlairStore'; import sdk from '../../index'; import dis from '../../dispatcher'; -import { isCtrlOrCmdKeyEvent } from '../../Keyboard'; +import { isOnlyCtrlOrCmdKeyEvent } from '../../Keyboard'; const TagTile = React.createClass({ displayName: 'TagTile', @@ -51,7 +51,7 @@ const TagTile = React.createClass({ dis.dispatch({ action: 'select_tag', tag: this.props.groupProfile.groupId, - ctrlOrCmdKey: isCtrlOrCmdKeyEvent(e), + ctrlOrCmdKey: isOnlyCtrlOrCmdKeyEvent(e), shiftKey: e.shiftKey, }); }, diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 8b222d1ef2..cd30f20645 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -28,7 +28,7 @@ import Promise from 'bluebird'; import MatrixClientPeg from '../../../MatrixClientPeg'; import type {MatrixClient} from 'matrix-js-sdk/lib/matrix'; import SlashCommands from '../../../SlashCommands'; -import { KeyCode, isCtrlOrCmdKeyEvent } from '../../../Keyboard'; +import { KeyCode, isOnlyCtrlOrCmdKeyEvent } from '../../../Keyboard'; import Modal from '../../../Modal'; import sdk from '../../../index'; import { _t, _td } from '../../../languageHandler'; @@ -105,7 +105,7 @@ export default class MessageComposerInput extends React.Component { }; static getKeyBinding(ev: SyntheticKeyboardEvent): string { - const ctrlCmdOnly = isCtrlOrCmdKeyEvent(ev); + const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev); // Restrict a subset of key bindings to ONLY having ctrl/meta* pressed and // importantly NOT having alt, shift, meta/ctrl* pressed. draft-js does not