summaryrefslogtreecommitdiffstats
path: root/webapp/components/markdown_image.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-09-06 23:04:13 -0700
committerChristopher Speller <crspeller@gmail.com>2017-09-06 23:11:58 -0700
commitd8bd57901e33a7057e26e782e295099ffcc0da89 (patch)
treee12dfc8cad42b1576756d19d7fbfd82646a009bf /webapp/components/markdown_image.jsx
parent7bc8e9a08dfde56387f946fdf5086252aa4d0491 (diff)
downloadchat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.gz
chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.bz2
chat-d8bd57901e33a7057e26e782e295099ffcc0da89.zip
Removing webapp
Diffstat (limited to 'webapp/components/markdown_image.jsx')
-rw-r--r--webapp/components/markdown_image.jsx67
1 files changed, 0 insertions, 67 deletions
diff --git a/webapp/components/markdown_image.jsx b/webapp/components/markdown_image.jsx
deleted file mode 100644
index 2634ef3f6..000000000
--- a/webapp/components/markdown_image.jsx
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import PropTypes from 'prop-types';
-import React from 'react';
-
-import {postListScrollChange} from 'actions/global_actions.jsx';
-
-const WAIT_FOR_HEIGHT_TIMEOUT = 100;
-
-export default class MarkdownImage extends React.PureComponent {
- static propTypes = {
-
- /*
- * The href of the image to be loaded
- */
- href: PropTypes.string
- }
-
- constructor(props) {
- super(props);
-
- this.heightTimeout = 0;
- }
-
- componentDidMount() {
- this.waitForHeight();
- }
-
- componentDidUpdate(prevProps) {
- if (this.props.href !== prevProps.href) {
- this.waitForHeight();
- }
- }
-
- componentWillUnmount() {
- this.stopWaitingForHeight();
- }
-
- waitForHeight = () => {
- if (this.refs.image.height) {
- setTimeout(postListScrollChange, 0);
-
- this.heightTimeout = 0;
- } else {
- this.heightTimeout = setTimeout(this.waitForHeight, WAIT_FOR_HEIGHT_TIMEOUT);
- }
- }
-
- stopWaitingForHeight = () => {
- if (this.heightTimeout !== 0) {
- clearTimeout(this.heightTimeout);
- this.heightTimeout = 0;
- }
- }
-
- render() {
- return (
- <img
- {...this.props}
- ref='image'
- onLoad={this.stopWaitingForHeight}
- onError={this.stopWaitingForHeight}
- />
- );
- }
-}