Make images be normal hyperlinks if middle/command clicked

pull/4/head
David Baker 2015-07-23 20:07:34 -07:00
parent 33f2955927
commit 2f9e3fcaea
1 changed files with 12 additions and 9 deletions

View File

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