Comment Content renderer

This commit is contained in:
okbel
2018-02-21 17:08:39 -03:00
parent 38352e9e3c
commit 46a1857abe
3 changed files with 28 additions and 0 deletions
@@ -0,0 +1,15 @@
import React from 'react';
import { name } from '../../package.json';
const CommentContent = ({ comment }) => {
return comment.htmlBody ? (
<div
className={`${name}-text`}
dangerouslySetInnerHTML={{ __html: comment.htmlBody }}
/>
) : (
<div className={`${name}-text`}>{comment.body}</div>
);
};
export default CommentContent;
@@ -0,0 +1,11 @@
import { gql } from 'react-apollo';
import { withFragments } from 'plugin-api/beta/client/hocs';
import CommentContent from '../components/CommentContent';
export default withFragments({
comment: gql`
fragment TalkPluginRTECommentContent_comment on Comment {
htmlBody
}
`,
})(CommentContent);
+2
View File
@@ -1,7 +1,9 @@
import Editor from './components/Editor';
import CommentContent from './containers/CommentContent';
export default {
slots: {
textArea: [Editor],
commentContent: [CommentContent],
},
};