From 63d03478aab11f583615888cc02e72ff4362ad78 Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Mon, 22 Apr 2024 18:05:02 +0300
Subject: [PATCH] update comments

---
 editors/demo/src/Editoria/Editoria.js          |  2 +-
 editors/demo/src/Editoria/config/config.js     | 18 +++++++++---------
 .../plugins/CommentDecorationPlugin.js         |  8 ++++++--
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/editors/demo/src/Editoria/Editoria.js b/editors/demo/src/Editoria/Editoria.js
index 8837b278e..3e85568ea 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/editors/demo/src/Editoria/config/config.js b/editors/demo/src/Editoria/config/config.js
index 8d4dc6ce5..4bb09f337 100644
--- a/editors/demo/src/Editoria/config/config.js
+++ b/editors/demo/src/Editoria/config/config.js
@@ -225,7 +225,7 @@ export default {
         'HighlightToolGroup',
         'TransformToolGroup',
         'CustomTagInline',
-        'Notes',
+        // 'Notes',
         'Lists',
         'Images',
         'SpecialCharacters',
@@ -303,12 +303,12 @@ export default {
     ],
     updateTags: saveTags,
   },
-  // YjsService: {
-  //   // eslint-disable-next-line no-restricted-globals
-  //   connectionUrl: 'ws://localhost:4000',
-  //   docIdentifier: 'prosemirror-demo',
-  //   YjsType: 'prosemirror',
-  // },
+  YjsService: {
+    // eslint-disable-next-line no-restricted-globals
+    connectionUrl: 'ws://localhost:4000',
+    docIdentifier: 'prosemirror-demo',
+    YjsType: 'prosemirror',
+  },
 
   AskAiContentService: {
     AskAiContentTransformation: DummyPromise,
@@ -316,7 +316,7 @@ export default {
   },
 
   services: [
-    // new YjsService(),
+    new YjsService(),
     new BlockDropDownToolGroupService(),
     new AskAiContentService(),
     new CustomTagService(),
@@ -330,7 +330,7 @@ export default {
     new ImageService(),
     new TablesService(),
     new BaseService(),
-    new NoteService(),
+    // new NoteService(),
     new CodeBlockService(),
     new EditingSuggestingService(),
     new DisplayTextToolGroupService(),
diff --git a/wax-prosemirror-services/src/CommentsService/plugins/CommentDecorationPlugin.js b/wax-prosemirror-services/src/CommentsService/plugins/CommentDecorationPlugin.js
index 96cc05e15..dd895567b 100644
--- a/wax-prosemirror-services/src/CommentsService/plugins/CommentDecorationPlugin.js
+++ b/wax-prosemirror-services/src/CommentsService/plugins/CommentDecorationPlugin.js
@@ -19,6 +19,9 @@ export const CommentDecorationPlugin = (name, options) => {
         });
       },
       apply(transaction, pluginState, oldState, newState) {
+        console.log(transaction);
+        const yjsSync = transaction.getMeta('y-sync$');
+        if (yjsSync) console.log('hodododo');
         return pluginState.apply(transaction, newState);
       },
     },
@@ -36,9 +39,10 @@ export const CommentDecorationPlugin = (name, options) => {
           // options.onSelectionChange(annotations);
 
           options.onSelectionChange(this.getState(state).allCommentsList());
+          this.getState(state).createDecorations(state);
         }
-        contentSize = state.doc.content.size;
-        allCommentsCount = this.getState(state).allCommentsList().length;
+        // contentSize = state.doc.content.size;
+        // allCommentsCount = this.getState(state).allCommentsList().length;
         return decorations;
       },
     },
-- 
GitLab