Keep url text intact when linkifying it
This commit is contained in:
parent
cb4b5e4f6f
commit
6b6a1172f9
@ -25,6 +25,6 @@
|
||||
"react-router": "0.12.0",
|
||||
"react": "0.12.2",
|
||||
"react-infinite": "0.2.3",
|
||||
"autolinker": "~0.15.2"
|
||||
"autolinker": "khlieng/Autolinker.js"
|
||||
}
|
||||
}
|
||||
|
@ -84,9 +84,11 @@ var MessageBox = React.createClass({
|
||||
lines.push(<MessageHeader key={key} message={message} />);
|
||||
|
||||
for (var i = 1; i < message.lines.length; i++) {
|
||||
var line = Autolinker.link(message.lines[i], { keepOriginalText: true });
|
||||
|
||||
lines.push(
|
||||
<p key={key + '-' + i} className={messageClass} style={innerStyle}>
|
||||
<span dangerouslySetInnerHTML={{ __html: Autolinker.link(message.lines[i]) }}></span>
|
||||
<span dangerouslySetInnerHTML={{ __html: line }}></span>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ var MessageHeader = React.createClass({
|
||||
var message = this.props.message;
|
||||
var sender = null;
|
||||
var messageClass = 'message';
|
||||
var line = Autolinker.link(message.lines[0], { keepOriginalText: true });
|
||||
|
||||
if (message.from) {
|
||||
sender = (
|
||||
@ -38,7 +39,7 @@ var MessageHeader = React.createClass({
|
||||
<p className={messageClass}>
|
||||
<span className="message-time">{util.timestamp(message.time)}</span>
|
||||
{sender}
|
||||
<span dangerouslySetInnerHTML={{ __html: ' ' + Autolinker.link(message.lines[0]) }}></span>
|
||||
<span dangerouslySetInnerHTML={{ __html: ' ' + line }}></span>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user