Make images be normal hyperlinks if middle/command clicked

This commit is contained in:
David Baker 2015-07-23 20:07:34 -07:00
parent 33f2955927
commit 2f9e3fcaea

View File

@ -53,14 +53,17 @@ module.exports = React.createClass({
}, },
onClick: function(ev) { onClick: function(ev) {
ev.preventDefault(); var ms = ev.getModifierState();
var content = this.props.mxEvent.getContent(); if (ev.button == 0 && !ev.metaKey) {
var httpUrl = MatrixClientPeg.get().mxcUrlToHttp(content.url); ev.preventDefault();
Modal.createDialog(ImageView, { var content = this.props.mxEvent.getContent();
src: httpUrl, var httpUrl = MatrixClientPeg.get().mxcUrlToHttp(content.url);
width: content.info.w, Modal.createDialog(ImageView, {
height: content.info.h src: httpUrl,
}); width: content.info.w,
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>