summaryrefslogtreecommitdiffstats
path: root/web/react/components
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-12-09 12:24:34 -0500
committerJoramWilander <jwawilander@gmail.com>2015-12-09 12:24:34 -0500
commit699230bb3f14a55acbf49a678df7fd87f865ae5b (patch)
treeb46345cef45e9479b06d4237565e5379e429758a /web/react/components
parent7f1b0cbd1f85149d7dce4caec33cbe0579cb64e3 (diff)
downloadchat-699230bb3f14a55acbf49a678df7fd87f865ae5b.tar.gz
chat-699230bb3f14a55acbf49a678df7fd87f865ae5b.tar.bz2
chat-699230bb3f14a55acbf49a678df7fd87f865ae5b.zip
Fix OEmbeds when switching channel, vine/soundcloud heights, and youtube embeds
Diffstat (limited to 'web/react/components')
-rw-r--r--web/react/components/post_attachment_oembed.jsx9
-rw-r--r--web/react/components/post_body.jsx6
-rw-r--r--web/react/components/providers.json4
3 files changed, 13 insertions, 6 deletions
diff --git a/web/react/components/post_attachment_oembed.jsx b/web/react/components/post_attachment_oembed.jsx
index 13c32f744..4b12ee95e 100644
--- a/web/react/components/post_attachment_oembed.jsx
+++ b/web/react/components/post_attachment_oembed.jsx
@@ -14,7 +14,14 @@ export default class PostAttachmentOEmbed extends React.Component {
}
componentWillReceiveProps(nextProps) {
- this.fetchData(nextProps.link);
+ if (nextProps.link !== this.props.link) {
+ this.isLoading = false;
+ this.fetchData(nextProps.link);
+ }
+ }
+
+ componentDidMount() {
+ this.fetchData(this.props.link);
}
fetchData(link) {
diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx
index 35a7727e9..dcbe56399 100644
--- a/web/react/components/post_body.jsx
+++ b/web/react/components/post_body.jsx
@@ -214,14 +214,14 @@ export default class PostBody extends React.Component {
}
createYoutubeEmbed(link) {
- const ytRegex = /.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|watch\?(?:[a-zA-Z-_]+=[a-zA-Z0-9-_]+&)+v=)([^#\&\?]*).*/;
+ const ytRegex = /(?:http|https):\/\/(?:www\.)?(?:(?:youtube\.com\/(?:(?:v\/)|(\/u\/\w\/)|(?:(?:watch|embed\/watch)(?:\/|.*v=))|(?:embed\/)|(?:user\/[^\/]+\/u\/[0-9]\/)))|(?:youtu\.be\/))([^#\&\?]*)/;
const match = link.trim().match(ytRegex);
- if (!match || match[1].length !== 11) {
+ if (!match || match[2].length !== 11) {
return null;
}
- const youtubeId = match[1];
+ const youtubeId = match[2];
const time = this.handleYoutubeTime(link);
function onClick(e) {
diff --git a/web/react/components/providers.json b/web/react/components/providers.json
index 33e377a39..b5899c225 100644
--- a/web/react/components/providers.json
+++ b/web/react/components/providers.json
@@ -11,7 +11,7 @@
"https?://soundcloud.com/.*/.*"
],
"name": "SoundCloud",
- "height": 110
+ "height": 140
},
{
"patterns": [
@@ -349,7 +349,7 @@
"https?://vine.co/v/[a-zA-Z0-9]+"
],
"name": "Vine",
- "height": 110
+ "height": 490
},
{
"patterns": [