diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2017-08-18 15:03:04 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-08-18 12:03:04 -0700 |
commit | 6df51f8617cb1a17dec0c49a6764c2ba1d7968c9 (patch) | |
tree | 7e1f0221e78e9bd79513ad8010f0d75a9ce340d8 /webapp/components/file_attachment.jsx | |
parent | 26ec8ffc3edc01fde2189f3465112c88fee5435b (diff) | |
download | chat-6df51f8617cb1a17dec0c49a6764c2ba1d7968c9.tar.gz chat-6df51f8617cb1a17dec0c49a6764c2ba1d7968c9.tar.bz2 chat-6df51f8617cb1a17dec0c49a6764c2ba1d7968c9.zip |
PLT-7397 Added loadImage function instead of Image.prototype.load (#7184)
Diffstat (limited to 'webapp/components/file_attachment.jsx')
-rw-r--r-- | webapp/components/file_attachment.jsx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/webapp/components/file_attachment.jsx b/webapp/components/file_attachment.jsx index 3d7f936c8..5642d33c5 100644 --- a/webapp/components/file_attachment.jsx +++ b/webapp/components/file_attachment.jsx @@ -48,14 +48,16 @@ export default class FileAttachment extends React.Component { if (fileType === 'image') { const thumbnailUrl = getFileThumbnailUrl(fileInfo.id); - const img = new Image(); - img.onload = () => { - this.setState({loaded: true}); - }; - img.load(thumbnailUrl); + Utils.loadImage(thumbnailUrl, this.handleImageLoaded); } } + handleImageLoaded = () => { + this.setState({ + loaded: true + }); + } + onAttachmentClick(e) { e.preventDefault(); this.props.handleImageClick(this.props.index); |