summaryrefslogtreecommitdiffstats
path: root/webapp/utils
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-06-28 10:30:02 -0400
committerChristopher Speller <crspeller@gmail.com>2017-06-28 07:30:02 -0700
commit2dea567dcfcdfcd016c0da55a120c6e854760fb0 (patch)
treeae718a1d36b8a6f48eb3684ff7b57c3b7b2eac6d /webapp/utils
parent0f6992034229f542d823f73cf740002ad0ac48e3 (diff)
downloadchat-2dea567dcfcdfcd016c0da55a120c6e854760fb0.tar.gz
chat-2dea567dcfcdfcd016c0da55a120c6e854760fb0.tar.bz2
chat-2dea567dcfcdfcd016c0da55a120c6e854760fb0.zip
Added MarkdownImage component (#6774)
* Added MarkdownImage component * Fixed unit tests
Diffstat (limited to 'webapp/utils')
-rw-r--r--webapp/utils/markdown.jsx22
1 files changed, 1 insertions, 21 deletions
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;
}