pull/2089/head
filip mertens 3 years ago
parent 658cff4810
commit e5ebc8926a
  1. 4
      libs/remix-ui/search/src/lib/components/results/Results.tsx
  2. 2
      libs/remix-ui/search/src/lib/components/results/SearchHelper.ts
  3. 4
      libs/remix-ui/search/src/lib/context/context.tsx

@ -1,10 +1,8 @@
import React, { useContext, useEffect, useState } from 'react' import React, { useContext, useEffect, useState } from 'react'
import { SearchContext } from '../../context/context' import { SearchContext } from '../../context/context'
import { ResultItem } from './ResultItem' import { ResultItem } from './ResultItem'
interface ResultsProps {
}
export const Results = (props: ResultsProps) => { export const Results = () => {
const { state} = useContext(SearchContext) const { state} = useContext(SearchContext)
const [alertText, setAlertText] = useState('') const [alertText, setAlertText] = useState('')

@ -54,7 +54,7 @@ export const findLinesInStringWithMatch = (str: string, re: RegExp) => {
const matchesInString = (str: string, re: RegExp) => { const matchesInString = (str: string, re: RegExp) => {
let a: RegExpExecArray let a: RegExpExecArray
let results:RegExpExecArray[] = []; const results:RegExpExecArray[] = [];
while ((a = re.exec(str || '')) !== null) { while ((a = re.exec(str || '')) !== null) {
results.push(a); results.push(a);
} }

@ -5,7 +5,7 @@ import {
SearchReducer, SearchReducer,
} from '../reducers/Reducer' } from '../reducers/Reducer'
import { SearchState, SearchResult, SearchResultLine, SearchResultLineLine, SearchingInitialState } from '../types' import { SearchState, SearchResult, SearchResultLine, SearchResultLineLine, SearchingInitialState } from '../types'
const filePathFilter = require('@jsdevtools/file-path-filter') import { filePathFilter } from '@jsdevtools/file-path-filter'
export interface SearchingStateInterface { export interface SearchingStateInterface {
state: SearchState state: SearchState
@ -125,7 +125,7 @@ export const SearchProvider = ({
replaceText: async(result: SearchResult, line: SearchResultLineLine) => { replaceText: async(result: SearchResult, line: SearchResultLineLine) => {
await plugin.call('editor', 'discardHighlight') await plugin.call('editor', 'discardHighlight')
await plugin.call('editor', 'highlight', line.position, result.path) await plugin.call('editor', 'highlight', line.position, result.path)
let content = await plugin.call('fileManager', 'readFile', result.path) const content = await plugin.call('fileManager', 'readFile', result.path)
await plugin.call('fileManager','setFile', result.path, replaceTextInLine(content, line, state.replace)) await plugin.call('fileManager','setFile', result.path, replaceTextInLine(content, line, state.replace))
} }
} }

Loading…
Cancel
Save