Update the scroll offset when images load
In order to deal with image-loading reshaping the DOM, wire up ScrollPanel.checkScroll to the image load events. Fixes https://github.com/vector-im/vector-web/issues/984
This commit is contained in:
parent
26e66326a2
commit
99d2392b6f
6 changed files with 57 additions and 12 deletions
|
@ -27,6 +27,14 @@ var dis = require("../../../dispatcher");
|
|||
module.exports = React.createClass({
|
||||
displayName: 'MImageBody',
|
||||
|
||||
propTypes: {
|
||||
/* the MatrixEvent to show */
|
||||
mxEvent: React.PropTypes.object.isRequired,
|
||||
|
||||
/* callback called when images in events are loaded */
|
||||
onImageLoad: React.PropTypes.func,
|
||||
},
|
||||
|
||||
thumbHeight: function(fullWidth, fullHeight, thumbWidth, thumbHeight) {
|
||||
if (!fullWidth || !fullHeight) {
|
||||
// Cannot calculate thumbnail height for image: missing w/h in metadata. We can't even
|
||||
|
@ -116,7 +124,8 @@ module.exports = React.createClass({
|
|||
<img className="mx_MImageBody_thumbnail" src={thumbUrl}
|
||||
alt={content.body} style={imgStyle}
|
||||
onMouseEnter={this.onImageEnter}
|
||||
onMouseLeave={this.onImageLeave} />
|
||||
onMouseLeave={this.onImageLeave}
|
||||
onLoad={this.props.onImageLoad} />
|
||||
</a>
|
||||
<div className="mx_MImageBody_download">
|
||||
<a href={cli.mxcUrlToHttp(content.url)} target="_blank">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue