summaryrefslogtreecommitdiffstats
path: root/webapp/components/post_view
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/components/post_view
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/components/post_view')
-rw-r--r--webapp/components/post_view/post_message_view/post_message_view.jsx17
1 files changed, 17 insertions, 0 deletions
diff --git a/webapp/components/post_view/post_message_view/post_message_view.jsx b/webapp/components/post_view/post_message_view/post_message_view.jsx
index d066183ff..76037741f 100644
--- a/webapp/components/post_view/post_message_view/post_message_view.jsx
+++ b/webapp/components/post_view/post_message_view/post_message_view.jsx
@@ -7,6 +7,7 @@ import React from 'react';
import {FormattedMessage} from 'react-intl';
import AtMention from 'components/at_mention';
+import MarkdownImage from 'components/markdown_image';
import store from 'stores/redux_store.jsx';
@@ -114,6 +115,22 @@ export default class PostMessageView extends React.PureComponent {
}
},
{
+ shouldProcessNode: (node) => node.type === 'tag' && node.name === 'img',
+ processNode: (node) => {
+ const {
+ class: className,
+ ...attribs
+ } = node.attribs;
+
+ return (
+ <MarkdownImage
+ className={className}
+ {...attribs}
+ />
+ );
+ }
+ },
+ {
shouldProcessNode: () => true,
processNode: processNodeDefinitions.processDefaultNode
}