forked from matrix/element-web
Make images be normal hyperlinks if middle/command clicked
This commit is contained in:
parent
33f2955927
commit
2f9e3fcaea
|
@ -53,6 +53,8 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onClick: function(ev) {
|
onClick: function(ev) {
|
||||||
|
var ms = ev.getModifierState();
|
||||||
|
if (ev.button == 0 && !ev.metaKey) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
var content = this.props.mxEvent.getContent();
|
var content = this.props.mxEvent.getContent();
|
||||||
var httpUrl = MatrixClientPeg.get().mxcUrlToHttp(content.url);
|
var httpUrl = MatrixClientPeg.get().mxcUrlToHttp(content.url);
|
||||||
|
@ -61,6 +63,7 @@ module.exports = React.createClass({
|
||||||
width: content.info.w,
|
width: content.info.w,
|
||||||
height: content.info.h
|
height: content.info.h
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
|
@ -75,7 +78,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span className="mx_MImageTile">
|
<span className="mx_MImageTile">
|
||||||
<a href="#" onClick={this.onClick}>
|
<a href={cli.mxcUrlToHttp(content.url)} onClick={this.onClick}>
|
||||||
<img src={cli.mxcUrlToHttp(content.url, 320, 240)} alt={content.body} style={imgStyle} />
|
<img src={cli.mxcUrlToHttp(content.url, 320, 240)} alt={content.body} style={imgStyle} />
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in New Issue