summaryrefslogtreecommitdiffstats
path: root/web/react/utils/utils.jsx
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-12-04 12:28:46 -0500
committerJoramWilander <jwawilander@gmail.com>2015-12-04 12:28:46 -0500
commit975074b2ae2692f596edb263bb27727b43f33489 (patch)
tree3ed8a698464cd87da20da04201fa0698ad4789d0 /web/react/utils/utils.jsx
parent622fbc67402fe36bc01163a5a80643a15758e094 (diff)
downloadchat-975074b2ae2692f596edb263bb27727b43f33489.tar.gz
chat-975074b2ae2692f596edb263bb27727b43f33489.tar.bz2
chat-975074b2ae2692f596edb263bb27727b43f33489.zip
Fix embeds and add default fixed height
Diffstat (limited to 'web/react/utils/utils.jsx')
-rw-r--r--web/react/utils/utils.jsx20
1 files changed, 11 insertions, 9 deletions
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index 0a52f5b37..f5e0cedf5 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -252,13 +252,6 @@ export function getTimestamp() {
// extracts links not styled by Markdown
export function extractLinks(text) {
- const urlMatcher = new Autolinker.matchParser.MatchParser({
- urls: true,
- emails: false,
- twitter: false,
- phone: false,
- hashtag: false
- });
const links = [];
let replaceText = text;
@@ -271,7 +264,7 @@ export function extractLinks(text) {
}
}
- function replaceFn(match) {
+ function replaceFn(autolinker, match) {
let link = '';
const matchText = match.getMatchedText();
const tempText = replaceText;
@@ -304,7 +297,16 @@ export function extractLinks(text) {
links.push(link);
}
- urlMatcher.replace(text, replaceFn, this);
+
+ Autolinker.link(text, {
+ replaceFn,
+ urls: true,
+ emails: false,
+ twitter: false,
+ phone: false,
+ hashtag: false
+ });
+
return {links, text};
}