From 1fa2ecdc841fe7e0b7d494bd1ba5db2d1655fa3f Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Tue, 17 Jan 2023 20:06:36 +0200
Subject: [PATCH] coko docs fixes

---
 editors/demo/src/Editoria/Editoria.js                      | 2 ++
 wax-prosemirror-core/src/Wax.js                            | 4 ++++
 wax-prosemirror-core/src/WaxView.js                        | 6 ++++--
 .../src/CommentsService/components/RightArea.js            | 7 ++++---
 wax-prosemirror-services/src/ImageService/Image.js         | 2 +-
 5 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/editors/demo/src/Editoria/Editoria.js b/editors/demo/src/Editoria/Editoria.js
index 4293bf1a1..3a72be1e7 100644
--- a/editors/demo/src/Editoria/Editoria.js
+++ b/editors/demo/src/Editoria/Editoria.js
@@ -57,6 +57,8 @@ const Editoria = () => {
           //   console.log(JSON.stringify(source));
           // }, 200)}
           user={user}
+          scrollMargin={200}
+          scrollThreshold={200}
         />
       </>
     ),
diff --git a/wax-prosemirror-core/src/Wax.js b/wax-prosemirror-core/src/Wax.js
index a4cc8235e..b4207c52b 100644
--- a/wax-prosemirror-core/src/Wax.js
+++ b/wax-prosemirror-core/src/Wax.js
@@ -45,6 +45,8 @@ const Wax = forwardRef((props, ref) => {
     user,
     onChange,
     targetFormat,
+    scrollMargin,
+    scrollThreshold,
   } = props;
 
   if (!application) return null;
@@ -71,6 +73,8 @@ const Wax = forwardRef((props, ref) => {
           placeholder={placeholder}
           readonly={readonly}
           ref={ref}
+          scrollMargin={scrollMargin}
+          scrollThreshold={scrollThreshold}
           serializer={serializer}
           targetFormat={targetFormat}
           TrackChange={
diff --git a/wax-prosemirror-core/src/WaxView.js b/wax-prosemirror-core/src/WaxView.js
index 0ac0dd1a0..40ad70192 100644
--- a/wax-prosemirror-core/src/WaxView.js
+++ b/wax-prosemirror-core/src/WaxView.js
@@ -42,6 +42,8 @@ const WaxView = forwardRef((props, ref) => {
     user,
     targetFormat,
     serializer,
+    scrollMargin,
+    scrollThreshold,
   } = props;
 
   const WaxEditorRef = useRef();
@@ -77,8 +79,8 @@ const WaxView = forwardRef((props, ref) => {
             dispatchTransaction,
             disallowedTools: [],
             user,
-            scrollMargin: 200,
-            scrollThreshold: 200,
+            scrollMargin: scrollMargin || 200,
+            scrollThreshold: scrollThreshold || 200,
             attributes: {
               spellcheck: browserSpellCheck ? 'true' : 'false',
             },
diff --git a/wax-prosemirror-services/src/CommentsService/components/RightArea.js b/wax-prosemirror-services/src/CommentsService/components/RightArea.js
index 3147319c2..76917053b 100644
--- a/wax-prosemirror-services/src/CommentsService/components/RightArea.js
+++ b/wax-prosemirror-services/src/CommentsService/components/RightArea.js
@@ -39,10 +39,11 @@ export default ({ area }) => {
     each(marksNodes[area], (markNode, pos) => {
       const id =
         markNode instanceof Mark ? markNode.attrs.id : markNode.node.attrs.id;
-
+      let activeTrackChange = null;
       const activeComment = commentPlugin.getState(activeView.state).comment;
-      const activeTrackChange = trakChangePlugin.getState(activeView.state)
-        .trackChange;
+      if (trakChangePlugin)
+        activeTrackChange = trakChangePlugin.getState(activeView.state)
+          .trackChange;
 
       let isActive = false;
       if (
diff --git a/wax-prosemirror-services/src/ImageService/Image.js b/wax-prosemirror-services/src/ImageService/Image.js
index 789f921fb..b81daf643 100644
--- a/wax-prosemirror-services/src/ImageService/Image.js
+++ b/wax-prosemirror-services/src/ImageService/Image.js
@@ -33,8 +33,8 @@ export default class Image extends Tools {
   }
 
   renderTool(view) {
-    if (isEmpty(view)) return null;
     const context = useContext(WaxContext);
+    if (isEmpty(view)) return null;
     const upload = fileUpload(
       view,
       this.config.get('fileUpload'),
-- 
GitLab