From 562d247e84c56a1f62218d6d2cdfef23ccc2b4d2 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Thu, 25 Apr 2024 03:29:20 +0300 Subject: [PATCH] fix --- .../CommentsService/plugins/CommentState.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js b/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js index 5637ce6e0..8d78ee54e 100644 --- a/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js +++ b/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js @@ -203,11 +203,6 @@ export default class CommentState { const ystate = ySyncPluginKey.getState(state); - this.decorations = this.decorations.map( - transaction.mapping, - transaction.doc, - ); - if (ystate?.isChangeOrigin) { this.updateCommentPostions(ystate); this.createDecorations(state); @@ -215,6 +210,20 @@ export default class CommentState { return this; } + this.decorations = this.decorations.map( + transaction.mapping, + transaction.doc, + ); + + map.forEach((annotation, _) => { + if ('from' in annotation && 'to' in annotation) { + annotation.data.pmFrom = transaction.mapping.map( + annotation.data.pmFrom, + ); + annotation.data.pmTo = transaction.mapping.map(annotation.data.pmTo); + } + }); + if (ystate?.binding && ystate?.binding.mapping) { this.updateCommentPostions(ystate); this.createDecorations(state); -- GitLab