summaryrefslogtreecommitdiffstats
path: root/web/react/components/post_body.jsx
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-12-04 15:22:21 -0800
committerCorey Hulen <corey@hulen.com>2015-12-04 15:22:21 -0800
commit7aab27c8ec251d9ed300772cbcae5a7f909750f7 (patch)
treeec5aa97a50904e35f8f4c22fc41ba034450ae4e4 /web/react/components/post_body.jsx
parent8ae357c535d3f8068cd0e42ed00d48061e3ffa1d (diff)
parent975074b2ae2692f596edb263bb27727b43f33489 (diff)
downloadchat-7aab27c8ec251d9ed300772cbcae5a7f909750f7.tar.gz
chat-7aab27c8ec251d9ed300772cbcae5a7f909750f7.tar.bz2
chat-7aab27c8ec251d9ed300772cbcae5a7f909750f7.zip
Merge pull request #1623 from mattermost/fixed-height-embeds
Fix embeds and add default fixed height
Diffstat (limited to 'web/react/components/post_body.jsx')
-rw-r--r--web/react/components/post_body.jsx12
1 files changed, 7 insertions, 5 deletions
diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx
index 27f7ad2de..3e335b901 100644
--- a/web/react/components/post_body.jsx
+++ b/web/react/components/post_body.jsx
@@ -109,10 +109,11 @@ export default class PostBody extends React.Component {
const trimmedLink = link.trim();
- if (this.checkForOembedContent(trimmedLink)) {
+ const provider = this.getOembedProvider(trimmedLink);
+ if (provider != null) {
post.props.oEmbedLink = trimmedLink;
post.type = 'oEmbed';
- this.setState({post});
+ this.setState({post, provider});
return '';
}
@@ -133,15 +134,15 @@ export default class PostBody extends React.Component {
return null;
}
- checkForOembedContent(link) {
+ getOembedProvider(link) {
for (let i = 0; i < providers.length; i++) {
for (let j = 0; j < providers[i].patterns.length; j++) {
if (link.match(providers[i].patterns[j])) {
- return true;
+ return providers[i];
}
}
}
- return false;
+ return null;
}
loadImg(src) {
@@ -399,6 +400,7 @@ export default class PostBody extends React.Component {
</div>
<PostBodyAdditionalContent
post={this.state.post}
+ provider={this.state.provider}
/>
{fileAttachmentHolder}
{this.embed}