From b560abb79c9dd299c9d74c68cd1df3fa60b076af Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Sun, 31 Jan 2021 19:58:22 +0200
Subject: [PATCH] notes fix

---
 wax-prosemirror-core/src/WaxView.js                |  2 --
 wax-prosemirror-services/src/NoteService/Editor.js | 12 +++++++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/wax-prosemirror-core/src/WaxView.js b/wax-prosemirror-core/src/WaxView.js
index 2ca97051b..43147ae4e 100644
--- a/wax-prosemirror-core/src/WaxView.js
+++ b/wax-prosemirror-core/src/WaxView.js
@@ -32,8 +32,6 @@ export default props => {
           state: EditorState.create(options),
           dispatchTransaction,
           user,
-          scrollMargin: 200,
-          scrollThreshold: 200,
           handleDOMEvents: {
             blur: onBlur
               ? view => {
diff --git a/wax-prosemirror-services/src/NoteService/Editor.js b/wax-prosemirror-services/src/NoteService/Editor.js
index 79d3f2766..039b1b13c 100644
--- a/wax-prosemirror-services/src/NoteService/Editor.js
+++ b/wax-prosemirror-services/src/NoteService/Editor.js
@@ -19,6 +19,7 @@ export default ({ node, view }) => {
   const noteId = node.attrs.id;
   let noteView;
   let clickInNote = false;
+  let typing = false;
   // eslint-disable-next-line react/destructuring-assignment
   const isEditable = context.view.main.props.editable(editable => {
     return editable;
@@ -45,6 +46,9 @@ export default ({ node, view }) => {
             if (noteView.hasFocus()) noteView.focus();
           },
         },
+        handleTextInput: (editorView, from, to, text) => {
+          typing = true;
+        },
         transformPasted: slice => {
           return transformPasted(slice, noteView);
         },
@@ -98,6 +102,12 @@ export default ({ node, view }) => {
         context.updateView({}, noteId);
     }, 20);
 
+    const findReplace = context.app.PmPlugins.get('findAndReplacePlugin');
+    const matches = findReplace.getState(noteView.state).allMatches;
+    if (matches.length > 0 && !typing) context.updateView({}, noteId);
+    typing = false;
+    // UNTIL HERE
+
     if (!tr.getMeta('fromOutside')) {
       const outerTr = view.state.tr;
       const offsetMap = StepMap.offset(noteFound[0].pos + 1);
@@ -108,7 +118,7 @@ export default ({ node, view }) => {
       }
 
       if (outerTr.docChanged)
-        view.dispatch(outerTr.setMeta('outsideView', 'notes'));
+        view.dispatch(outerTr.setMeta('outsideView', noteId));
     }
   };
 
-- 
GitLab