From a6e096e719e2df45004f29fb8d1aa4fe0f6629ed Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Thu, 23 Nov 2023 06:12:39 +0200
Subject: [PATCH] fix for activeView

---
 .../components/ConnectedComment.js            | 51 +++++++++++--------
 1 file changed, 29 insertions(+), 22 deletions(-)

diff --git a/wax-prosemirror-services/src/CommentsService/components/ConnectedComment.js b/wax-prosemirror-services/src/CommentsService/components/ConnectedComment.js
index 76fc7096e..2c7310e6f 100644
--- a/wax-prosemirror-services/src/CommentsService/components/ConnectedComment.js
+++ b/wax-prosemirror-services/src/CommentsService/components/ConnectedComment.js
@@ -33,6 +33,7 @@ export default ({ comment, top, commentId, recalculateTops }) => {
     },
     app,
     activeView,
+    activeViewId,
   } = context;
 
   const [isActive, setIsActive] = useState(false);
@@ -91,29 +92,35 @@ export default ({ comment, top, commentId, recalculateTops }) => {
           commentMark,
         ),
       );
-      // activeView.dispatch(
-      //   activeView.state.tr
-      //     .addMark(
-      //       singleComment.pos,
-      //       singleComment.pos + singleComment.node.nodeSize,
-      //       commentMark.create({
-      //         id,
-      //         group: comment.attrs.group,
-      //         viewid: comment.attrs.viewid,
-      //         conversation: comment.attrs.conversation,
-      //         title: comment.attrs.title,
-      //       }),
-      //     )
-      //     .setMeta('forceUpdate', true),
-      // );
+
+      if (activeViewId !== 'main') {
+        activeView.dispatch(
+          activeView.state.tr
+            .addMark(
+              singleComment.pos,
+              singleComment.pos + singleComment.node.nodeSize,
+              commentMark.create({
+                id,
+                group: comment.attrs.group,
+                viewid: comment.attrs.viewid,
+                conversation: comment.attrs.conversation,
+                title: comment.attrs.title,
+              }),
+            )
+            .setMeta('forceUpdate', true),
+        );
+      }
     });
-    Commands.createComment(
-      activeView.state,
-      activeView.dispatch,
-      comment.attrs.group,
-      comment.attrs.viewid,
-      comment.attrs.conversation,
-    );
+
+    if (activeViewId === 'main') {
+      Commands.createComment(
+        pmViews.main.state,
+        pmViews.main.dispatch,
+        comment.attrs.group,
+        comment.attrs.viewid,
+        comment.attrs.conversation,
+      );
+    }
     activeView.focus();
     recalculateTops();
   };
-- 
GitLab