Skip to content
Snippets Groups Projects
Commit 11455811 authored by chris's avatar chris
Browse files

find correct comment position

parent 2bd11fa0
No related branches found
No related tags found
1 merge request!110Display comment conversation
...@@ -9,6 +9,7 @@ import { v4 as uuidv4 } from "uuid"; ...@@ -9,6 +9,7 @@ import { v4 as uuidv4 } from "uuid";
import styled from "styled-components"; import styled from "styled-components";
import { WaxContext } from "wax-prosemirror-core"; import { WaxContext } from "wax-prosemirror-core";
import { DocumentHelpers } from "wax-prosemirror-utilities";
const SinlgeCommentRow = styled.div` const SinlgeCommentRow = styled.div`
padding: 4px; padding: 4px;
...@@ -36,11 +37,12 @@ export default ({ comment, activeView, user }) => { ...@@ -36,11 +37,12 @@ export default ({ comment, activeView, user }) => {
const obj = { [user.username]: value }; const obj = { [user.username]: value };
commentAnnotation.attrs.conversation.push(obj); commentAnnotation.attrs.conversation.push(obj);
const actualComment = DocumentHelpers.findMark(state, commentMark);
dispatch( dispatch(
tr.addMark( tr.addMark(
commentAnnotation.pos, actualComment.from,
commentAnnotation.pos + commentAnnotation.node.nodeSize, actualComment.to,
commentMark.create({ commentMark.create({
...((commentAnnotation && commentAnnotation.attrs) || {}), ...((commentAnnotation && commentAnnotation.attrs) || {}),
conversation: commentAnnotation.attrs.conversation conversation: commentAnnotation.attrs.conversation
......
...@@ -156,7 +156,6 @@ const updateMarks = view => { ...@@ -156,7 +156,6 @@ const updateMarks = view => {
mark.type.name === "format_change" mark.type.name === "format_change"
) { ) {
mark.pos = node.pos; mark.pos = node.pos;
mark.node = node.node;
finalMarks.push(mark); finalMarks.push(mark);
} }
}); });
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment