Comment previous edit

This commit is contained in:
okbel
2018-02-22 11:24:37 -03:00
parent 4579537709
commit 2f4c084811
6 changed files with 28 additions and 9 deletions
@@ -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}