mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 12:28:50 +03:00
isCtrlOrCmdKeyEvent -> isOnlyCtrlOrCmdKeyEvent
This commit is contained in:
parent
ddd0e161c0
commit
363fe04a10
5 changed files with 9 additions and 9 deletions
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
},
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue