Skip to content
Snippets Groups Projects
Commit b397bead authored by chris's avatar chris
Browse files

fix replace all

parent a2bb39c9
No related branches found
No related tags found
1 merge request!257Editoria fixes
...@@ -8,6 +8,7 @@ import React, { ...@@ -8,6 +8,7 @@ import React, {
} from 'react'; } from 'react';
import { each, eachRight, debounce } from 'lodash'; import { each, eachRight, debounce } from 'lodash';
import { WaxContext } from 'wax-prosemirror-core'; import { WaxContext } from 'wax-prosemirror-core';
import { DocumentHelpers } from 'wax-prosemirror-utilities';
import styled from 'styled-components'; import styled from 'styled-components';
import { grid, th } from '@pubsweet/ui-toolkit'; import { grid, th } from '@pubsweet/ui-toolkit';
import Icon from '../../helpers/Icon'; import Icon from '../../helpers/Icon';
...@@ -137,7 +138,7 @@ const PreviousNextButton = styled.span` ...@@ -137,7 +138,7 @@ const PreviousNextButton = styled.span`
} }
`; `;
const ExandedFindAndReplaceComponent = ({ const ExpandedFindAndReplaceComponent = ({
close, close,
findNextMatch, findNextMatch,
findPreviousMatch, findPreviousMatch,
...@@ -255,7 +256,10 @@ const ExandedFindAndReplaceComponent = ({ ...@@ -255,7 +256,10 @@ const ExandedFindAndReplaceComponent = ({
const replaceAll = () => { const replaceAll = () => {
each(view, (singleView, viewId) => { each(view, (singleView, viewId) => {
const results = helpers.findMatches(singleView.state.doc, searchValue); const results = DocumentHelpers.findMatches(
singleView.state.doc,
searchValue,
);
const { const {
state: { tr }, state: { tr },
} = singleView; } = singleView;
...@@ -340,4 +344,4 @@ const ExandedFindAndReplaceComponent = ({ ...@@ -340,4 +344,4 @@ const ExandedFindAndReplaceComponent = ({
); );
}; };
export default ExandedFindAndReplaceComponent; export default ExpandedFindAndReplaceComponent;
...@@ -3,7 +3,7 @@ import React, { useState, useContext, useEffect } from 'react'; ...@@ -3,7 +3,7 @@ import React, { useState, useContext, useEffect } from 'react';
import { TextSelection } from 'prosemirror-state'; import { TextSelection } from 'prosemirror-state';
import { WaxContext } from 'wax-prosemirror-core'; import { WaxContext } from 'wax-prosemirror-core';
import FindComponent from './FindComponent'; import FindComponent from './FindComponent';
import ExandedFindAndReplaceComponent from './ExandedFindAndReplaceComponent'; import ExpandedFindAndReplaceComponent from './ExpandedFindAndReplaceComponent';
import helpers from './helpers'; import helpers from './helpers';
let lastActiveViewId; let lastActiveViewId;
...@@ -228,7 +228,7 @@ const FindAndReplaceComponent = ({ close }) => { ...@@ -228,7 +228,7 @@ const FindAndReplaceComponent = ({ close }) => {
}; };
return isExpanded ? ( return isExpanded ? (
<ExandedFindAndReplaceComponent <ExpandedFindAndReplaceComponent
close={close} close={close}
findNextMatch={findNextMatch} findNextMatch={findNextMatch}
findPreviousMatch={findPreviousMatch} findPreviousMatch={findPreviousMatch}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment