diff --git a/src/components/views/elements/ImageView.js b/src/components/views/elements/ImageView.js index a55e59e0..361e18fd 100644 --- a/src/components/views/elements/ImageView.js +++ b/src/components/views/elements/ImageView.js @@ -29,8 +29,10 @@ module.exports = React.createClass({ propTypes: { mxEvent: React.PropTypes.object, src: React.PropTypes.string.isRequired, + link: React.PropTypes.string, width: React.PropTypes.number, height: React.PropTypes.number, + size: React.PropTypes.number, onFinished: React.PropTypes.func.isRequired, name: React.PropTypes.string }, @@ -76,11 +78,15 @@ module.exports = React.createClass({ if(this.props.name) { name = this.props.name; } else if(this.props.mxEvent) { - name = props.mxEvent.getContent().body; + name = this.props.mxEvent.getContent().body; } else { name = null; } + if (name && this.props.link) { + name = { name }; + } + return name; }, @@ -121,14 +127,20 @@ module.exports = React.createClass({ width: this.props.width, height: this.props.height, }; - res = ", " + style.width + "x" + style.height + "px"; + res = style.width + "x" + style.height + "px"; } var size; - if (this.props.mxEvent && - this.props.mxEvent.getContent().info && - this.props.mxEvent.getContent().info.size) { - size = filesize(this.props.mxEvent.getContent().info.size); + if (this.props.size) { + size = filesize(this.props.size); + } + + var size_res; + if (size && res) { + size_res = size + ", " + res; + } + else { + size_res = size || res; } var showEventMeta = !!this.props.mxEvent; @@ -165,7 +177,7 @@ module.exports = React.createClass({
Download this file
- { size } { res } + { size_res }
{ eventRedact }