mirror of
https://github.com/wassname/talk.git
synced 2026-08-10 12:41:02 +08:00
Comment previous edit
This commit is contained in:
@@ -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