diff --git a/wax-prosemirror-components/src/components/findAndReplace/FindComponent.js b/wax-prosemirror-components/src/components/findAndReplace/FindComponent.js index 8dbc8d995bca36958b33e3d2d1890ddb9084d2f5..03d0d39522c77698a863296c83de80fe1698f5d0 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 2bc31ee51bf32e9d060bf4c5745e614838999911..6cc641c8898501b2f89b65ede853a67dc0aecf75 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) => {