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