diff --git a/client/coral-embed-stream/src/components/Comment.js b/client/coral-embed-stream/src/components/Comment.js index 9d3cb0218..44448786a 100644 --- a/client/coral-embed-stream/src/components/Comment.js +++ b/client/coral-embed-stream/src/components/Comment.js @@ -16,7 +16,7 @@ import mapValues from 'lodash/mapValues'; import LoadMore from './LoadMore'; import {getEditableUntilDate} from './util'; import {findCommentWithId} from '../graphql/utils'; -import CommentContent from './CommentContent'; +import CommentContent from 'coral-framework/components/CommentContent'; import Slot from 'coral-framework/components/Slot'; import CommentTombstone from './CommentTombstone'; import InactiveCommentLabel from './InactiveCommentLabel'; diff --git a/client/coral-embed-stream/src/components/CommentContent.js b/client/coral-framework/components/CommentContent.js similarity index 70% rename from client/coral-embed-stream/src/components/CommentContent.js rename to client/coral-framework/components/CommentContent.js index 4d56ec0d5..0895ab6d5 100644 --- a/client/coral-embed-stream/src/components/CommentContent.js +++ b/client/coral-framework/components/CommentContent.js @@ -2,18 +2,18 @@ import React from 'react'; const CommentContent = ({comment}) => { const textbreaks = comment.body.split('\n'); - return
+ return { textbreaks.map((line, i) => { return ( {line} -
+ {i === textbreaks.length - 1 &&
}
); }) } -
; + ; }; export default CommentContent; diff --git a/client/talk-plugin-history/Comment.js b/client/talk-plugin-history/Comment.js index 7532548cf..9d1208708 100644 --- a/client/talk-plugin-history/Comment.js +++ b/client/talk-plugin-history/Comment.js @@ -4,7 +4,7 @@ import {Icon} from '../coral-ui'; import styles from './Comment.css'; import Slot from 'coral-framework/components/Slot'; import CommentTimestamp from 'coral-framework/components/CommentTimestamp'; -import CommentContent from '../coral-embed-stream/src/components/CommentContent'; +import CommentContent from 'coral-framework/components/CommentContent'; import cn from 'classnames'; import {getTotalReactionsCount} from 'coral-framework/utils'; diff --git a/plugin-api/beta/client/components/index.js b/plugin-api/beta/client/components/index.js index a0ae0f3da..392d923a0 100644 --- a/plugin-api/beta/client/components/index.js +++ b/plugin-api/beta/client/components/index.js @@ -4,3 +4,4 @@ export {default as IfSlotIsEmpty} from 'coral-framework/components/IfSlotIsEmpty export {default as IfSlotIsNotEmpty} from 'coral-framework/components/IfSlotIsNotEmpty'; export {default as CommentAuthorName} from 'coral-framework/components/CommentAuthorName'; export {default as CommentTimestamp} from 'coral-framework/components/CommentTimestamp'; +export {default as CommentContent} from 'coral-framework/components/CommentContent'; diff --git a/plugins/talk-plugin-comment-content/client/components/CommentContent.js b/plugins/talk-plugin-comment-content/client/components/CommentContent.js index cc42f1b8d..8819d63ce 100644 --- a/plugins/talk-plugin-comment-content/client/components/CommentContent.js +++ b/plugins/talk-plugin-comment-content/client/components/CommentContent.js @@ -5,20 +5,20 @@ const name = 'talk-plugin-comment-content'; const CommentContent = ({comment}) => { const textbreaks = comment.body.split('\n'); - return
+ return { textbreaks.map((line, i) => { return ( - {line} + {line.trim()} -
+ {i !== textbreaks.length - 1 &&
}
); }) } -
; + ; }; export default CommentContent; diff --git a/plugins/talk-plugin-featured-comments/client/components/Comment.js b/plugins/talk-plugin-featured-comments/client/components/Comment.js index a8c7cb6f1..8396e27fb 100644 --- a/plugins/talk-plugin-featured-comments/client/components/Comment.js +++ b/plugins/talk-plugin-featured-comments/client/components/Comment.js @@ -2,7 +2,7 @@ import React from 'react'; import cn from 'classnames'; import styles from './Comment.css'; import {t} from 'plugin-api/beta/client/services'; -import {Slot, CommentAuthorName, CommentTimestamp} from 'plugin-api/beta/client/components'; +import {Slot, CommentAuthorName, CommentTimestamp, CommentContent} from 'plugin-api/beta/client/components'; import {Icon} from 'plugin-api/beta/client/components/ui'; import {pluginName} from '../../package.json'; import FeaturedButton from '../containers/FeaturedButton'; @@ -19,9 +19,14 @@ class Comment extends React.Component { return (
-
- {comment.body} -
+