summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webapp/components/channel_header.jsx2
-rw-r--r--webapp/components/file_upload.jsx2
-rw-r--r--webapp/components/navbar.jsx2
-rw-r--r--webapp/components/navbar_dropdown.jsx2
-rw-r--r--webapp/utils/utils.jsx8
5 files changed, 12 insertions, 4 deletions
diff --git a/webapp/components/channel_header.jsx b/webapp/components/channel_header.jsx
index 2b9b1e1cc..cfffc70ee 100644
--- a/webapp/components/channel_header.jsx
+++ b/webapp/components/channel_header.jsx
@@ -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);
}
diff --git a/webapp/components/file_upload.jsx b/webapp/components/file_upload.jsx
index 89b184ea6..2f485d4d3 100644
--- a/webapp/components/file_upload.jsx
+++ b/webapp/components/file_upload.jsx
@@ -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');
diff --git a/webapp/components/navbar.jsx b/webapp/components/navbar.jsx
index c8fa29e34..bd151dffa 100644
--- a/webapp/components/navbar.jsx
+++ b/webapp/components/navbar.jsx
@@ -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
diff --git a/webapp/components/navbar_dropdown.jsx b/webapp/components/navbar_dropdown.jsx
index bc7aaeb5f..3ad69a972 100644
--- a/webapp/components/navbar_dropdown.jsx
+++ b/webapp/components/navbar_dropdown.jsx
@@ -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});
}
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index 65a203ab0..ee2c4099f 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -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;