From cf28dafc1a56688f77fb2e9b34b79acbf83d2e6f Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Tue, 16 Apr 2024 18:24:46 +0300
Subject: [PATCH] handle remove text that contains comment

---
 editors/demo/src/Editoria/Editoria.js                      | 2 +-
 .../src/CommentsService/components/RightArea.js            | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/editors/demo/src/Editoria/Editoria.js b/editors/demo/src/Editoria/Editoria.js
index 3e85568ea..8837b278e 100644
--- a/editors/demo/src/Editoria/Editoria.js
+++ b/editors/demo/src/Editoria/Editoria.js
@@ -55,7 +55,7 @@ const Editoria = () => {
           autoFocus
           placeholder="Type Something..."
           fileUpload={file => renderImage(file)}
-          // value={demo}
+          value={demo}
           // readonly
           layout={layout}
           // onChange={debounce(source => {
diff --git a/wax-prosemirror-services/src/CommentsService/components/RightArea.js b/wax-prosemirror-services/src/CommentsService/components/RightArea.js
index 49ff827a2..8ce766e6a 100644
--- a/wax-prosemirror-services/src/CommentsService/components/RightArea.js
+++ b/wax-prosemirror-services/src/CommentsService/components/RightArea.js
@@ -79,6 +79,13 @@ export default ({ area, users }) => {
             markNodeEl.getBoundingClientRect().top -
             WaxSurface.top +
             parseInt(WaxSurfaceMarginTop.slice(0, -2), 10);
+        } else {
+          // comment is deleted
+          context.setOption({
+            comments: comments.filter(comment => {
+              return comment.id !== id;
+            }),
+          });
         }
       } else {
         // Notes
-- 
GitLab