From e0b0443911f1d19b57f451517878f354cc36ade2 Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Wed, 24 Apr 2024 13:01:37 +0300
Subject: [PATCH] map position

---
 .../ui/comments/CommentBubbleComponent.js     | 21 +++++++++++--------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/wax-prosemirror-services/src/CommentsService/components/ui/comments/CommentBubbleComponent.js b/wax-prosemirror-services/src/CommentsService/components/ui/comments/CommentBubbleComponent.js
index eb9b7f503..ecc679833 100644
--- a/wax-prosemirror-services/src/CommentsService/components/ui/comments/CommentBubbleComponent.js
+++ b/wax-prosemirror-services/src/CommentsService/components/ui/comments/CommentBubbleComponent.js
@@ -36,21 +36,24 @@ const CommentBubbleComponent = ({ setPosition, position, group }) => {
     event.preventDefault();
     const { selection } = state;
 
-    if (context.app.config.get('config.YjsService')) {
-      return createYjsComments(selection);
-    }
+    // if (context.app.config.get('config.YjsService')) {
+    //   return createYjsComments(selection);
+    // }
+
+    const fromPos = state.tr.mapping.map(selection.from);
+    const toPos = state.tr.mapping.map(selection.to);
 
     dispatch(
       state.tr.setMeta(CommentDecorationPluginKey, {
         type: 'addComment',
-        from: selection.from,
-        to: selection.to,
+        from: fromPos,
+        to: toPos,
         data: {
           type: 'comment',
-          yjsFrom: selection.from,
-          yjsTo: selection.to,
-          pmFrom: selection.from,
-          pmTo: selection.to,
+          yjsFrom: fromPos,
+          yjsTo: toPos,
+          pmFrom: fromPos,
+          pmTo: toPos,
           conversation: [],
           title: '',
           group,
-- 
GitLab