From a0af3d2e5f6009634faec9c5058a65b91941e859 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Fri, 1 Mar 2024 11:53:22 +0200 Subject: [PATCH] remove old comments from right panel --- .../src/CommentsService/components/BoxList.js | 5 +---- .../CommentsService/components/ConnectedComment.js | 14 ++++++-------- .../src/CommentsService/components/RightArea.js | 1 - 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/wax-prosemirror-services/src/CommentsService/components/BoxList.js b/wax-prosemirror-services/src/CommentsService/components/BoxList.js index d0b8abf7f..5ce698876 100644 --- a/wax-prosemirror-services/src/CommentsService/components/BoxList.js +++ b/wax-prosemirror-services/src/CommentsService/components/BoxList.js @@ -20,10 +20,7 @@ export default ({ commentsTracks, view, position, recalculateTops, users }) => { const top = position[index] ? position[index][id] : 0; - if ( - commentTrack?.type?.name === 'comment' || - commentTrack?.data?.type === 'comment' - ) { + if (commentTrack.data?.type === 'comment') { return ( <ConnectedComment comment={commentTrack} diff --git a/wax-prosemirror-services/src/CommentsService/components/ConnectedComment.js b/wax-prosemirror-services/src/CommentsService/components/ConnectedComment.js index 027bd9295..6f01b7540 100644 --- a/wax-prosemirror-services/src/CommentsService/components/ConnectedComment.js +++ b/wax-prosemirror-services/src/CommentsService/components/ConnectedComment.js @@ -39,10 +39,8 @@ export default ({ comment, top, commentId, recalculateTops, users }) => { const [clickPost, setClickPost] = useState(false); const { state, dispatch } = activeView; - const viewId = comment.attrs ? comment.attrs.viewid : comment.data.viewId; - const conversation = comment.attrs - ? comment.attrs.conversation - : comment.data.conversation; + const { viewId, conversation } = comment.data; + let allCommentsWithSameId = []; if (pmViews[viewId]) { @@ -165,7 +163,7 @@ export default ({ comment, top, commentId, recalculateTops, users }) => { // onClickPost(content); // } setTimeout(() => { - if (comment.attrs.conversation.length === 0 && !clickPost) { + if (conversation.length === 0 && !clickPost) { onClickResolve(); activeView.focus(); } @@ -177,12 +175,12 @@ export default ({ comment, top, commentId, recalculateTops, users }) => { <ConnectedCommentStyled active={isActive} data-box={commentId} - length={comment.attrs.conversation.length === 0} + length={conversation.length === 0} style={styles} > <CommentBox active={isActive} - commentData={comment.attrs.conversation} + commentData={conversation} commentId={commentId} isReadOnly={isReadOnly} key={commentId} @@ -197,7 +195,7 @@ export default ({ comment, top, commentId, recalculateTops, users }) => { /> </ConnectedCommentStyled> ), - [isActive, top, comment.attrs.conversation.length, users], + [isActive, top, conversation.length, users], ); return <>{MemorizedComponent}</>; }; diff --git a/wax-prosemirror-services/src/CommentsService/components/RightArea.js b/wax-prosemirror-services/src/CommentsService/components/RightArea.js index 6953db468..3be0be42c 100644 --- a/wax-prosemirror-services/src/CommentsService/components/RightArea.js +++ b/wax-prosemirror-services/src/CommentsService/components/RightArea.js @@ -213,7 +213,6 @@ const updateMarks = (views, comments) => { if (node.node.marks.length > 0) { node.node.marks.filter(mark => { if ( - mark.type.name === 'comment' || mark.type.name === 'insertion' || mark.type.name === 'deletion' || mark.type.name === 'format_change' -- GitLab