diff --git a/wax-prosemirror-components/src/components/comments/ConnectedComment.js b/wax-prosemirror-components/src/components/comments/ConnectedComment.js index 15cf17eb58bdd5519ebd6a34aea8e34a8aea5b7e..68e9194904d7c695750088adc78ebb458ee2ab93 100644 --- a/wax-prosemirror-components/src/components/comments/ConnectedComment.js +++ b/wax-prosemirror-components/src/components/comments/ConnectedComment.js @@ -7,10 +7,26 @@ import CommentBox from '../../ui/comments/CommentBox'; export default ({ key, comment, dataBox, top, commentId, commentData }) => { const MemorizedComponent = memo(() => { + const { + view, + view: { + main: { + props: { user }, + }, + }, + app, + activeView, + } = useContext(WaxContext); + let active = false; + + const commentPlugin = app.PmPlugins.get('commentPlugin'); + const activeComment = commentPlugin.getState(activeView.state).comment; + + if (activeComment && commentId === activeComment.attrs.id) active = true; return ( <CommentBox key={commentId} - comment={commentData} + active={active} dataBox={commentId} top={top} commentId={commentId} diff --git a/wax-prosemirror-components/src/ui/comments/CommentBox.js b/wax-prosemirror-components/src/ui/comments/CommentBox.js index 47593084d8d99de89a7641609f257e08e49a1668..c89620ae15e2d025bb1a10f494fcd04de65797f0 100644 --- a/wax-prosemirror-components/src/ui/comments/CommentBox.js +++ b/wax-prosemirror-components/src/ui/comments/CommentBox.js @@ -79,6 +79,7 @@ const CommentBox = props => { <Wrapper style={style} active={active} + data-box={commentId} className={className} onClick={onClickWrapper} top={top}