Skip to content

Commit 2f9e3fc

Browse files
committed
Make images be normal hyperlinks if middle/command clicked
1 parent 33f2955 commit 2f9e3fc

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

‎skins/base/views/molecules/MImageTile.js‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,17 @@ module.exports = React.createClass({
5353
},
5454

5555
onClick: function(ev) {
56-
ev.preventDefault();
57-
var content = this.props.mxEvent.getContent();
58-
var httpUrl = MatrixClientPeg.get().mxcUrlToHttp(content.url);
59-
Modal.createDialog(ImageView, {
60-
src: httpUrl,
61-
width: content.info.w,
62-
height: content.info.h
63-
});
56+
var ms = ev.getModifierState();
57+
if (ev.button == 0 && !ev.metaKey) {
58+
ev.preventDefault();
59+
var content = this.props.mxEvent.getContent();
60+
var httpUrl = MatrixClientPeg.get().mxcUrlToHttp(content.url);
61+
Modal.createDialog(ImageView, {
62+
src: httpUrl,
63+
width: content.info.w,
64+
height: content.info.h
65+
});
66+
}
6467
},
6568

6669
render: function() {
@@ -75,7 +78,7 @@ module.exports = React.createClass({
7578

7679
return (
7780
<span className="mx_MImageTile">
78-
<a href="#" onClick={this.onClick}>
81+
<a href={cli.mxcUrlToHttp(content.url)} onClick={this.onClick}>
7982
<img src={cli.mxcUrlToHttp(content.url, 320, 240)} alt={content.body} style={imgStyle} />
8083
</a>
8184
</span>

0 commit comments

Comments
 (0)