mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 03:05:24 +08:00
25 lines
629 B
JavaScript
25 lines
629 B
JavaScript
import React from 'react';
|
|
import Linkify from 'react-linkify';
|
|
|
|
const name = 'talk-plugin-comment-content';
|
|
|
|
const CommentContent = ({comment}) => {
|
|
const textbreaks = comment.body.split('\n');
|
|
return <span className={`${name}-text`}>
|
|
{
|
|
textbreaks.map((line, i) => {
|
|
return (
|
|
<span key={i} className={`${name}-line`}>
|
|
<Linkify properties={{target: '_blank'}}>
|
|
{line.trim()}
|
|
</Linkify>
|
|
{i !== textbreaks.length - 1 && <br className={`${name}-linebreak`}/>}
|
|
</span>
|
|
);
|
|
})
|
|
}
|
|
</span>;
|
|
};
|
|
|
|
export default CommentContent;
|