diff --git a/editors/demo/src/Editoria/config/config.js b/editors/demo/src/Editoria/config/config.js index 636a4101be8b9de0c6f86f69fe258919403b69a5..e643d45305b693ffd8e57ac99b3b878ec6c43870 100644 --- a/editors/demo/src/Editoria/config/config.js +++ b/editors/demo/src/Editoria/config/config.js @@ -119,6 +119,74 @@ const setComments = ( }, endHeight: 266.3579406738281, }, + { + id: 'b8d907d4-1859-49a9-abcd-13788d497758', + from: { + type: { + client: 2887320119, + clock: 150, + }, + tname: null, + item: { + client: 2887320119, + clock: 185, + }, + assoc: 0, + }, + to: { + type: { + client: 2887320119, + clock: 150, + }, + tname: null, + item: { + client: 2887320119, + clock: 195, + }, + assoc: 0, + }, + data: { + yjsFrom: { + type: { + client: 2887320119, + clock: 150, + }, + tname: null, + item: { + client: 2887320119, + clock: 185, + }, + assoc: 0, + }, + yjsTo: { + type: { + client: 2887320119, + clock: 150, + }, + tname: null, + item: { + client: 2887320119, + clock: 195, + }, + assoc: 0, + }, + pmFrom: 164, + pmTo: 174, + type: 'comment', + conversation: [ + { + content: 'dfgdfgd', + displayName: 'admin', + userId: 'b3cfc28e-0f2e-45b5-b505-e66783d4f946', + timestamp: 1713699155995, + }, + ], + title: 'dgfdgf', + group: 'main', + viewId: 'main', + }, + endHeight: 406.734375, + }, ], ) => { return comments; diff --git a/wax-prosemirror-services/src/CommentsService/components/RightArea.js b/wax-prosemirror-services/src/CommentsService/components/RightArea.js index 81907dd0becded954453b5eae1c9dc96e30234b8..d62b3c771a16354d4e3c777afe3c8882f4421667 100644 --- a/wax-prosemirror-services/src/CommentsService/components/RightArea.js +++ b/wax-prosemirror-services/src/CommentsService/components/RightArea.js @@ -287,7 +287,7 @@ const updateMarks = (views, comments) => { groupedMarkNodes.notes = groupedMarkNodes.notes.concat(newComments.notes); return { - main: sortBy(groupedMarkNodes.main, ['from']), + main: sortBy(groupedMarkNodes.main, ['data.pmFrom']), notes: groupedMarkNodes.notes, }; } diff --git a/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js b/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js index 5697fcaf240e945ebdf24bef3f17fcdccbd8b34b..314d202ac35a79fc6511c5e5e29047af7888b489 100644 --- a/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js +++ b/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js @@ -61,22 +61,20 @@ export default class CommentState { if (ystate?.binding) { const { doc, type, binding } = ystate; - + console.log(this.allCommentsList()); this.allCommentsList().forEach((annotation, id) => { - if (typeof annotation.data.yjsFrom === 'number') { - annotation.data.yjsFrom = absolutePositionToRelativePosition( - annotation.data.yjsFrom, - type, - binding.mapping, - ); - } - if (typeof annotation.data.yjsTo === 'number') { - annotation.data.yjsTo = absolutePositionToRelativePosition( - annotation.data.yjsTo, - type, - binding.mapping, - ); - } + annotation.data.yjsFrom = absolutePositionToRelativePosition( + annotation.data.pmFrom, + type, + binding.mapping, + ); + + annotation.data.yjsTo = absolutePositionToRelativePosition( + annotation.data.pmTo, + type, + binding.mapping, + ); + const from = relativePositionToAbsolutePosition( doc, type,