|
|
|
@ -10,13 +10,17 @@ export const Find = () => { |
|
|
|
|
toggleMatchWholeWord, |
|
|
|
|
toggleUseRegex |
|
|
|
|
} = useContext(SearchContext) |
|
|
|
|
const timeOutId = useRef(null) |
|
|
|
|
const [inputValue, setInputValue] = useState(""); |
|
|
|
|
const change = async(e) => { |
|
|
|
|
|
|
|
|
|
const [inputValue, setInputValue] = useState('') |
|
|
|
|
const change = async e => { |
|
|
|
|
setInputValue(e.target.value) |
|
|
|
|
clearTimeout(timeOutId.current) |
|
|
|
|
await cancelSearch() |
|
|
|
|
timeOutId.current = setTimeout(async () => await setFind(e.target.value), 500) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const handleKeypress = async e => { |
|
|
|
|
if (e.charCode === 13 || e.keyCode === 13) { |
|
|
|
|
await setFind(inputValue) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
@ -28,15 +32,16 @@ export const Find = () => { |
|
|
|
|
<div className="search_plugin_find-part"> |
|
|
|
|
<div className="search_plugin_search-input"> |
|
|
|
|
<input |
|
|
|
|
id='search_input' |
|
|
|
|
placeholder="Search" |
|
|
|
|
id="search_input" |
|
|
|
|
placeholder="Search ( Enter to search )" |
|
|
|
|
className="form-control" |
|
|
|
|
value={inputValue} |
|
|
|
|
onChange={async(e) => await change(e)} |
|
|
|
|
onChange={async e => await change(e)} |
|
|
|
|
onKeyPress={handleKeypress} |
|
|
|
|
></input> |
|
|
|
|
<div className="search_plugin_controls"> |
|
|
|
|
<div |
|
|
|
|
data-id='search_case_sensitive' |
|
|
|
|
data-id="search_case_sensitive" |
|
|
|
|
title="Match Case" |
|
|
|
|
className={`monaco-custom-checkbox codicon codicon-case-sensitive ${ |
|
|
|
|
state.casesensitive ? 'checked' : '' |
|
|
|
@ -50,7 +55,7 @@ export const Find = () => { |
|
|
|
|
}} |
|
|
|
|
></div> |
|
|
|
|
<div |
|
|
|
|
data-id='search_whole_word' |
|
|
|
|
data-id="search_whole_word" |
|
|
|
|
title="Match Whole Word" |
|
|
|
|
className={`monaco-custom-checkbox codicon codicon-whole-word ${ |
|
|
|
|
state.matchWord ? 'checked' : '' |
|
|
|
@ -64,7 +69,7 @@ export const Find = () => { |
|
|
|
|
}} |
|
|
|
|
></div> |
|
|
|
|
<div |
|
|
|
|
data-id='search_use_regex' |
|
|
|
|
data-id="search_use_regex" |
|
|
|
|
title="Use Regular Expression" |
|
|
|
|
className={`monaco-custom-checkbox codicon codicon-regex ${ |
|
|
|
|
state.useRegExp ? 'checked' : '' |
|
|
|
|