mirror of
https://github.com/wassname/talk.git
synced 2026-08-13 12:40:11 +08:00
Implement AdminCommentContent for text and html
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
.content {
|
||||
composes: content from "./CommentContent.css";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import styles from './AdminCommentContent.css';
|
||||
import { AdminCommentContent as Content } from 'plugin-api/beta/client/components';
|
||||
|
||||
class AdminCommentContent extends React.Component {
|
||||
render() {
|
||||
const { comment, suspectWords, bannedWords } = this.props;
|
||||
return (
|
||||
<Content
|
||||
className={styles.content}
|
||||
body={comment.richTextBody ? comment.richTextBody : comment.body}
|
||||
suspectWords={suspectWords}
|
||||
bannedWords={bannedWords}
|
||||
html={!!comment.richTextBody}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
AdminCommentContent.propTypes = {
|
||||
comment: PropTypes.object.isRequired,
|
||||
suspectWords: PropTypes.array.isRequired,
|
||||
bannedWords: PropTypes.array.isRequired,
|
||||
};
|
||||
|
||||
export default AdminCommentContent;
|
||||
@@ -0,0 +1,12 @@
|
||||
import { gql } from 'react-apollo';
|
||||
import { withFragments } from 'plugin-api/beta/client/hocs';
|
||||
import AdminCommentContent from '../components/AdminCommentContent';
|
||||
|
||||
export default withFragments({
|
||||
comment: gql`
|
||||
fragment TalkPluginRichText_AdminCommentContent_comment on Comment {
|
||||
body
|
||||
richTextBody
|
||||
}
|
||||
`,
|
||||
})(AdminCommentContent);
|
||||
@@ -1,13 +1,15 @@
|
||||
import Editor from './containers/Editor';
|
||||
import CommentContent from './containers/CommentContent';
|
||||
import AdminCommentContent from './containers/AdminCommentContent';
|
||||
|
||||
import { gql } from 'react-apollo';
|
||||
|
||||
export default {
|
||||
slots: {
|
||||
draftArea: [Editor],
|
||||
commentContent: [CommentContent],
|
||||
adminCommentContent: [CommentContent],
|
||||
userDetailCommentContent: [CommentContent],
|
||||
adminCommentContent: [AdminCommentContent],
|
||||
userDetailCommentContent: [AdminCommentContent],
|
||||
},
|
||||
fragments: {
|
||||
CreateCommentResponse: gql`
|
||||
|
||||
Reference in New Issue
Block a user