From 2dea567dcfcdfcd016c0da55a120c6e854760fb0 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Wed, 28 Jun 2017 10:30:02 -0400 Subject: Added MarkdownImage component (#6774) * Added MarkdownImage component * Fixed unit tests --- webapp/utils/markdown.jsx | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'webapp/utils') diff --git a/webapp/utils/markdown.jsx b/webapp/utils/markdown.jsx index 65c4c0396..8733e6200 100644 --- a/webapp/utils/markdown.jsx +++ b/webapp/utils/markdown.jsx @@ -4,29 +4,9 @@ import * as TextFormatting from './text_formatting.jsx'; import * as SyntaxHighlighting from './syntax_highlighting.jsx'; -import {postListScrollChange} from 'actions/global_actions.jsx'; - import marked from 'marked'; import katex from 'katex'; -function markdownImageLoaded(image) { - if (image.hasAttribute('height') && image.attributes.height.value !== 'auto') { - const maxHeight = parseInt(global.getComputedStyle(image).maxHeight, 10); - - if (image.attributes.height.value > maxHeight) { - image.style.height = maxHeight + 'px'; - image.style.width = ((maxHeight * image.attributes.width.value) / image.attributes.height.value) + 'px'; - } else { - image.style.height = image.attributes.height.value + 'px'; - } - } else { - image.style.height = 'auto'; - } - - postListScrollChange(); -} -global.markdownImageLoaded = markdownImageLoaded; - class MattermostMarkdownRenderer extends marked.Renderer { constructor(options, formattingOptions = {}) { super(options); @@ -155,7 +135,7 @@ class MattermostMarkdownRenderer extends marked.Renderer { if (dimensions.length > 1) { out += ' height="' + dimensions[1] + '"'; } - out += ' onload="window.markdownImageLoaded(this)" onerror="window.markdownImageLoaded(this)" class="markdown-inline-img"'; + out += ' class="markdown-inline-img"'; out += this.options.xhtml ? '/>' : '>'; return out; } -- cgit v1.2.3-1-g7c22