Fix #8264 - Do not override ctrl/cmd+click. (#8265)

This includes clicks on hashtags, mentions, display names and media in the
timeline; and usernames in reply-indicator, detailed status, and the boost
modal.
lolsob-rspec
M Somerville 2018-08-18 11:50:32 +01:00 committed by Eugen Rochko
parent 5c32fbce98
commit 65fc3d2699
6 changed files with 7 additions and 7 deletions

View File

@ -50,7 +50,7 @@ class Item extends React.PureComponent {
handleClick = (e) => { handleClick = (e) => {
const { index, onClick } = this.props; const { index, onClick } = this.props;
if (e.button === 0) { if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault(); e.preventDefault();
onClick(index); onClick(index);
} }

View File

@ -65,7 +65,7 @@ export default class Status extends ImmutablePureComponent {
} }
handleAccountClick = (e) => { handleAccountClick = (e) => {
if (this.context.router && e.button === 0) { if (this.context.router && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
const id = e.currentTarget.getAttribute('data-id'); const id = e.currentTarget.getAttribute('data-id');
e.preventDefault(); e.preventDefault();
this.context.router.history.push(`/accounts/${id}`); this.context.router.history.push(`/accounts/${id}`);

View File

@ -64,7 +64,7 @@ export default class StatusContent extends React.PureComponent {
} }
onMentionClick = (mention, e) => { onMentionClick = (mention, e) => {
if (this.context.router && e.button === 0) { if (this.context.router && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault(); e.preventDefault();
this.context.router.history.push(`/accounts/${mention.get('id')}`); this.context.router.history.push(`/accounts/${mention.get('id')}`);
} }
@ -73,7 +73,7 @@ export default class StatusContent extends React.PureComponent {
onHashtagClick = (hashtag, e) => { onHashtagClick = (hashtag, e) => {
hashtag = hashtag.replace(/^#/, '').toLowerCase(); hashtag = hashtag.replace(/^#/, '').toLowerCase();
if (this.context.router && e.button === 0) { if (this.context.router && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault(); e.preventDefault();
this.context.router.history.push(`/timelines/tag/${hashtag}`); this.context.router.history.push(`/timelines/tag/${hashtag}`);
} }

View File

@ -30,7 +30,7 @@ export default class ReplyIndicator extends ImmutablePureComponent {
} }
handleAccountClick = (e) => { handleAccountClick = (e) => {
if (e.button === 0) { if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault(); e.preventDefault();
this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`); this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
} }

View File

@ -26,7 +26,7 @@ export default class DetailedStatus extends ImmutablePureComponent {
}; };
handleAccountClick = (e) => { handleAccountClick = (e) => {
if (e.button === 0) { if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault(); e.preventDefault();
this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`); this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
} }

View File

@ -37,7 +37,7 @@ export default class BoostModal extends ImmutablePureComponent {
} }
handleAccountClick = (e) => { handleAccountClick = (e) => {
if (e.button === 0) { if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault(); e.preventDefault();
this.props.onClose(); this.props.onClose();
this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`); this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);