mirror of
https://github.com/wassname/talk.git
synced 2026-07-20 12:40:47 +08:00
Comment Content renderer
This commit is contained in:
@@ -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);
|
||||
@@ -1,7 +1,9 @@
|
||||
import Editor from './components/Editor';
|
||||
import CommentContent from './containers/CommentContent';
|
||||
|
||||
export default {
|
||||
slots: {
|
||||
textArea: [Editor],
|
||||
commentContent: [CommentContent],
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user