Skip to content
This repository has been archived by the owner on Apr 7, 2023. It is now read-only.

Commit

Permalink
Prevent a media from opening a browser
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed May 3, 2021
1 parent 53d3518 commit 5bd0edd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/retweet.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class Retweet extends Tweet {
tab: PropTypes.string.isRequired,
tweet: PropTypes.object.isRequired,
onClick: PropTypes.func.isRequired,
openMediaInWindow: PropTypes.func.isRequired,
openMediaInWindow: PropTypes.func.isRequired, // Used in the superclass
}

render() {
Expand Down
7 changes: 5 additions & 2 deletions src/components/tweet.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ export default class Tweet extends React.Component {
return entities.media.map((media) => {
if (media.type === 'photo' || media.type === 'video' || media.type === 'animated_gif') {
return (
<a href="javascript:void(0);" key={media.id_str} target='_blank'>
<img className='tweet_media' onClick={(event) => {this.props.openMediaInWindow(media)}} src={media.media_url} />
<a href='javascript:void(0);' key={media.id_str} target='_blank'>
<img className='tweet_media' onClick={ (event) => {
event.preventDefault();
this.props.openMediaInWindow(media);
} } src={media.media_url} />
</a>
);
} else {
Expand Down

0 comments on commit 5bd0edd

Please sign in to comment.