PLT-3473 Made shortcuts only work for CMD on OSX (#3479)
* checked for CMD key * changed method of checking
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
6c33350f5c
Коммит
96ca098f4b
@@ -155,7 +155,7 @@ export default class ChannelHeader extends React.Component {
|
||||
}
|
||||
|
||||
openRecentMentions(e) {
|
||||
if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.keyCode === Constants.KeyCodes.M) {
|
||||
if (Utils.cmdOrCtrlPressed(e) && e.shiftKey && e.keyCode === Constants.KeyCodes.M) {
|
||||
e.preventDefault();
|
||||
this.searchMentions(e);
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ class FileUpload extends React.Component {
|
||||
}
|
||||
|
||||
keyUpload(e) {
|
||||
if ((e.ctrlKey || e.metaKey) && e.keyCode === Constants.KeyCodes.U) {
|
||||
if (Utils.cmdOrCtrlPressed(e) && e.keyCode === Constants.KeyCodes.U) {
|
||||
e.preventDefault();
|
||||
if (this.props.postType === 'post' && document.activeElement.id === 'post_textbox' || this.props.postType === 'comment' && document.activeElement.id === 'reply_textbox') {
|
||||
$(this.refs.fileInput).focus().trigger('click');
|
||||
|
||||
@@ -163,7 +163,7 @@ export default class Navbar extends React.Component {
|
||||
});
|
||||
}
|
||||
showChannelSwitchModal(e) {
|
||||
if ((e.ctrlKey || e.metaKey) && e.keyCode === Constants.KeyCodes.K) {
|
||||
if (Utils.cmdOrCtrlPressed(e) && e.keyCode === Constants.KeyCodes.K) {
|
||||
e.preventDefault();
|
||||
this.setState({
|
||||
showChannelSwitchModal: true
|
||||
|
||||
@@ -70,7 +70,7 @@ export default class NavbarDropdown extends React.Component {
|
||||
document.removeEventListener('keydown', this.openAccountSettings);
|
||||
}
|
||||
openAccountSettings(e) {
|
||||
if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.keyCode === Constants.KeyCodes.A) {
|
||||
if (Utils.cmdOrCtrlPressed(e) && e.shiftKey && e.keyCode === Constants.KeyCodes.A) {
|
||||
e.preventDefault();
|
||||
this.setState({showUserSettingsModal: true});
|
||||
}
|
||||
|
||||
@@ -32,6 +32,14 @@ export function cleanUpUrlable(input) {
|
||||
return cleaned;
|
||||
}
|
||||
|
||||
export function isMac() {
|
||||
return navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
||||
}
|
||||
|
||||
export function cmdOrCtrlPressed(e) {
|
||||
return (isMac() && e.metaKey) || (!isMac() && e.ctrlKey);
|
||||
}
|
||||
|
||||
export function isChrome() {
|
||||
if (navigator.userAgent.indexOf('Chrome') > -1) {
|
||||
return true;
|
||||
|
||||
Ссылка в новой задаче
Block a user