This commit is contained in:
Matthew Hodgson 2015-12-08 19:49:16 +00:00
parent 8edfd60b64
commit 072130466c

View file

@ -48,18 +48,23 @@ module.exports = React.createClass({
} }
}, },
onClick: function(ev) { onClick: function onClick(ev) {
if (ev.button == 0 && !ev.metaKey) { 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);
var ImageView = sdk.getComponent("elements.ImageView"); var ImageView = sdk.getComponent("elements.ImageView");
Modal.createDialog(ImageView, { var params = {
src: httpUrl, src: httpUrl,
width: content.info.w, mxEvent: this.props.mxEvent
height: content.info.h, };
mxEvent: this.props.mxEvent,
}, "mx_Dialog_lightbox"); if (content.info) {
params.width = content.info.w;
params.height = content.info.h;
}
Modal.createDialog(ImageView, params, "mx_Dialog_lightbox");
} }
}, },