Linkify search results properly

This commit is contained in:
Ken-Håvard Lieng 2017-03-24 21:14:45 +01:00
parent 8eea1e5cb0
commit eca5761098
2 changed files with 21 additions and 24 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,9 @@
import React, { PureComponent } from 'react';
import Autolinker from 'autolinker';
import { timestamp } from '../util';
import { timestamp, linkify } from '../util';
export default class Search extends PureComponent {
render() {
const { result } = this.props;
const content = Autolinker.link(result.content, { stripPrefix: false });
const style = {
paddingLeft: `${window.messageIndent}px`,
textIndent: `-${window.messageIndent}px`
@ -19,7 +16,7 @@ export default class Search extends PureComponent {
{' '}
<span className="message-sender">{result.from}</span>
</span>
<span dangerouslySetInnerHTML={{ __html: ` ${content}` }} />
<span>{' '}{linkify(result.content)}</span>
</p>
);
}