mirror of
https://github.com/wassname/talk.git
synced 2026-07-08 04:03:09 +08:00
Comment previous edit
This commit is contained in:
@@ -112,6 +112,7 @@ export class CommentForm extends React.Component {
|
||||
disabled={disableTextArea}
|
||||
charCountEnable={this.props.charCountEnable}
|
||||
maxCharCount={this.props.maxCharCount}
|
||||
comment={this.props.comment}
|
||||
/>
|
||||
<div className={cn(styles.buttonContainer, `${name}-button-container`)}>
|
||||
{this.props.buttonContainerStart}
|
||||
|
||||
@@ -38,6 +38,7 @@ export default class DraftArea extends React.Component {
|
||||
charCountEnable,
|
||||
maxCharCount,
|
||||
onChange,
|
||||
comment,
|
||||
} = this.props;
|
||||
|
||||
const tASettings = {
|
||||
@@ -47,6 +48,7 @@ export default class DraftArea extends React.Component {
|
||||
onChange,
|
||||
rows,
|
||||
disabled,
|
||||
comment,
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -140,6 +140,7 @@ export class EditableCommentContent extends React.Component {
|
||||
return (
|
||||
<div className={styles.editCommentForm}>
|
||||
<CommentForm
|
||||
comment={this.props.comment}
|
||||
defaultValue={this.props.comment.body}
|
||||
bodyInputId={id}
|
||||
charCountEnable={this.props.charCountEnable}
|
||||
|
||||
@@ -50,6 +50,7 @@ export default class DraftAreaContainer extends React.Component {
|
||||
charCountEnable={this.props.charCountEnable}
|
||||
maxCharCount={this.props.maxCharCount}
|
||||
label={this.props.label}
|
||||
comment={this.props.comment}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
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>
|
||||
);
|
||||
class CommentContent extends React.Component {
|
||||
render() {
|
||||
const { comment } = this.props;
|
||||
return comment.htmlBody ? (
|
||||
<div
|
||||
className={`${name}-text`}
|
||||
dangerouslySetInnerHTML={{ __html: comment.htmlBody }}
|
||||
/>
|
||||
) : (
|
||||
<div className={`${name}-text`}>{comment.body}</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
CommentContent.propTypes = {
|
||||
comment: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
export default CommentContent;
|
||||
|
||||
@@ -36,10 +36,16 @@ class Editor extends React.Component {
|
||||
button: cn(styles.button, classNames.button, `${pluginName}-button`),
|
||||
},
|
||||
});
|
||||
|
||||
// To edit comments and have the previous html comment
|
||||
if (this.props.comment && this.props.comment.htmlBody) {
|
||||
this.ref.content.innerHTML = this.props.comment.htmlBody;
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { id, classNames } = this.props;
|
||||
console.log(this.props);
|
||||
return (
|
||||
<div
|
||||
id={id}
|
||||
|
||||
Reference in New Issue
Block a user