|
@@ -26,7 +26,7 @@ import CommentControl from './CommentControl';
|
|
|
* @class Comment
|
|
* @class Comment
|
|
|
* @extends {React.Component}
|
|
* @extends {React.Component}
|
|
|
*/
|
|
*/
|
|
|
-class Comment extends React.Component {
|
|
|
|
|
|
|
+class Comment extends React.PureComponent {
|
|
|
|
|
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
super(props);
|
|
super(props);
|
|
@@ -62,13 +62,20 @@ class Comment extends React.Component {
|
|
|
this.renderHtml();
|
|
this.renderHtml();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- componentWillReceiveProps(nextProps) {
|
|
|
|
|
- this.renderHtml(nextProps.comment.comment);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ componentDidUpdate(prevProps) {
|
|
|
|
|
+ const { comment: prevComment } = prevProps;
|
|
|
|
|
+ const { comment } = this.props;
|
|
|
|
|
+
|
|
|
|
|
+ // render only when props.markdown is updated
|
|
|
|
|
+ if (comment !== prevComment) {
|
|
|
|
|
+ this.initCurrentRenderingContext();
|
|
|
|
|
+ this.renderHtml();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const { interceptorManager } = this.props.appContainer;
|
|
|
|
|
|
|
|
- // not used
|
|
|
|
|
- setMarkdown(markdown) {
|
|
|
|
|
- this.renderHtml(markdown);
|
|
|
|
|
|
|
+ interceptorManager.process('postRenderCommentHtml', this.currentRenderingContext);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
checkPermissionToControlComment() {
|
|
checkPermissionToControlComment() {
|