@@ -29,8 +29,10 @@ module.exports = React.createClass({
2929 propTypes : {
3030 mxEvent : React . PropTypes . object ,
3131 src : React . PropTypes . string . isRequired ,
32+ link : React . PropTypes . string ,
3233 width : React . PropTypes . number ,
3334 height : React . PropTypes . number ,
35+ size : React . PropTypes . number ,
3436 onFinished : React . PropTypes . func . isRequired ,
3537 name : React . PropTypes . string
3638 } ,
@@ -76,11 +78,15 @@ module.exports = React.createClass({
7678 if ( this . props . name ) {
7779 name = this . props . name ;
7880 } else if ( this . props . mxEvent ) {
79- name = props . mxEvent . getContent ( ) . body ;
81+ name = this . props . mxEvent . getContent ( ) . body ;
8082 } else {
8183 name = null ;
8284 }
8385
86+ if ( name && this . props . link ) {
87+ name = < a href = { this . props . link } target = "_blank" > { name } </ a > ;
88+ }
89+
8490 return name ;
8591 } ,
8692
@@ -121,14 +127,20 @@ module.exports = React.createClass({
121127 width : this . props . width ,
122128 height : this . props . height ,
123129 } ;
124- res = ", " + style . width + "x" + style . height + "px" ;
130+ res = style . width + "x" + style . height + "px" ;
125131 }
126132
127133 var size ;
128- if ( this . props . mxEvent &&
129- this . props . mxEvent . getContent ( ) . info &&
130- this . props . mxEvent . getContent ( ) . info . size ) {
131- size = filesize ( this . props . mxEvent . getContent ( ) . info . size ) ;
134+ if ( this . props . size ) {
135+ size = filesize ( this . props . size ) ;
136+ }
137+
138+ var size_res ;
139+ if ( size && res ) {
140+ size_res = size + ", " + res ;
141+ }
142+ else {
143+ size_res = size || res ;
132144 }
133145
134146 var showEventMeta = ! ! this . props . mxEvent ;
@@ -165,7 +177,7 @@ module.exports = React.createClass({
165177 < a className = "mx_ImageView_link" href = { this . props . src } target = "_blank" >
166178 < div className = "mx_ImageView_download" >
167179 Download this file< br />
168- < span className = "mx_ImageView_size" > { size } { res } </ span >
180+ < span className = "mx_ImageView_size" > { size_res } </ span >
169181 </ div >
170182 </ a >
171183 { eventRedact }
0 commit comments