From 6353a2af7c88e88f1500799187e011d810394793 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Thu, 21 Jan 2021 23:07:18 +0200 Subject: [PATCH] dont scroll into view for notes --- .../src/components/findAndReplace/FindComponent.js | 3 +-- .../src/components/findAndReplace/helpers.js | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/wax-prosemirror-components/src/components/findAndReplace/FindComponent.js b/wax-prosemirror-components/src/components/findAndReplace/FindComponent.js index 8dbc8d995..03d0d3952 100644 --- a/wax-prosemirror-components/src/components/findAndReplace/FindComponent.js +++ b/wax-prosemirror-components/src/components/findAndReplace/FindComponent.js @@ -169,7 +169,6 @@ const FindComponent = ({ close, expand, setPreviousSearcValue }) => { }; const findNext = () => { - view[lastActiveViewId].focus(); const results = helpers.getAllResultsByView( view, searchValue, @@ -205,11 +204,11 @@ const FindComponent = ({ close, expand, setPreviousSearcValue }) => { results.main.length > 0 ) { setLastSelection(view[activeViewId].state.selection); + setlastActiveViewId(activeViewId); helpers.moveToMatch(view, 'main', results, 0); helpers.clearViewSelection(view, lastActiveViewId); } else { for (let i = 0; i < notesIds.length; i++) { - console.log('here?'); if ( results[notesIds[i]].length > 0 && notesIds[i] !== lastActiveViewId diff --git a/wax-prosemirror-components/src/components/findAndReplace/helpers.js b/wax-prosemirror-components/src/components/findAndReplace/helpers.js index 2bc31ee51..6cc641c88 100644 --- a/wax-prosemirror-components/src/components/findAndReplace/helpers.js +++ b/wax-prosemirror-components/src/components/findAndReplace/helpers.js @@ -137,11 +137,11 @@ const moveToMatch = (view, lastActiveViewId, results, position) => { TextSelection.between(selectionFrom.$anchor, selectionTo.$head), ), ); - - view[lastActiveViewId].dispatch( - view[lastActiveViewId].state.tr.scrollIntoView(), - ); - view[lastActiveViewId].focus(); + if (lastActiveViewId === 'main') { + view[lastActiveViewId].dispatch( + view[lastActiveViewId].state.tr.scrollIntoView(), + ); + } }; const clearViewSelection = (view, lastActiveViewId) => { -- GitLab