Semicolons and a bug fix

This commit is contained in:
nickago
2015-07-08 10:32:33 -07:00
parent 9873ffd05f
commit 126c2e56e0

View File

@@ -231,11 +231,11 @@ module.exports.extractLinks = function(text) {
var repRegex = new RegExp("<br>", "g");
var matches = testUrlMatch(text.replace(repRegex, "\n"));
if (!matches) return { "links": null, "text": text };
if (!matches.length) return { "links": null, "text": text };
var links = []
var links = [];
for (var i = 0; i < matches.length; i++) {
links.push(matches[i].link)
links.push(matches[i].link);
}
return { "links": links, "text": text };
@@ -450,9 +450,9 @@ module.exports.textToJsx = function(text, options) {
inner.push(<span key={name+i+z+"_span"}>{prefix}<a className={mClass + highlightSearchClass + " mention-link"} key={name+i+z+"_link"} href="#" onClick={function(value) { return function() { module.exports.searchForTerm(value); } }(name)}>@{name}</a>{suffix} </span>);
} else if (testUrlMatch(word).length) {
var match = testUrlMatch(word)[0];
var link = match.link
var link = match.link;
var prefix = word.substring(0,word.indexOf(match.text))
var prefix = word.substring(0,word.indexOf(match.text));
var suffix = word.substring(word.indexOf(match.text)+match.text.length);
inner.push(<span key={word+i+z+"_span"}>{prefix}<a key={word+i+z+"_link"} className={"theme" + highlightSearchClass} target="_blank" href={link}>{match.text}</a>{suffix} </span>);