From 11455811f4746a9e552bf06aa325cfceedec26e8 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Fri, 26 Jun 2020 16:38:27 +0300 Subject: [PATCH] find correct comment position --- .../src/components/comments/Comment.js | 6 ++++-- .../src/components/rightArea/RightArea.js | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wax-prosemirror-components/src/components/comments/Comment.js b/wax-prosemirror-components/src/components/comments/Comment.js index f24c6b777..e0b9f1205 100644 --- a/wax-prosemirror-components/src/components/comments/Comment.js +++ b/wax-prosemirror-components/src/components/comments/Comment.js @@ -9,6 +9,7 @@ import { v4 as uuidv4 } from "uuid"; import styled from "styled-components"; import { WaxContext } from "wax-prosemirror-core"; +import { DocumentHelpers } from "wax-prosemirror-utilities"; const SinlgeCommentRow = styled.div` padding: 4px; @@ -36,11 +37,12 @@ export default ({ comment, activeView, user }) => { const obj = { [user.username]: value }; commentAnnotation.attrs.conversation.push(obj); + const actualComment = DocumentHelpers.findMark(state, commentMark); dispatch( tr.addMark( - commentAnnotation.pos, - commentAnnotation.pos + commentAnnotation.node.nodeSize, + actualComment.from, + actualComment.to, commentMark.create({ ...((commentAnnotation && commentAnnotation.attrs) || {}), conversation: commentAnnotation.attrs.conversation diff --git a/wax-prosemirror-components/src/components/rightArea/RightArea.js b/wax-prosemirror-components/src/components/rightArea/RightArea.js index 4eae5f947..fe0fc66e1 100644 --- a/wax-prosemirror-components/src/components/rightArea/RightArea.js +++ b/wax-prosemirror-components/src/components/rightArea/RightArea.js @@ -156,7 +156,6 @@ const updateMarks = view => { mark.type.name === "format_change" ) { mark.pos = node.pos; - mark.node = node.node; finalMarks.push(mark); } }); -- GitLab