Merge branch 'dev' into immediate-finds

This commit is contained in:
Nuckyz 2024-05-18 21:55:23 -03:00
commit 118361723c
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -306,20 +306,16 @@ function PatchHelper() {
}, [parsedFind, match, replacement]);
function onFindChange(v: string) {
setFindError(void 0);
setFind(v);
}
function onFindBlur() {
try {
let parsedFind = find as string | RegExp;
if (/^\/.+?\/$/.test(find)) parsedFind = new RegExp(find.slice(1, -1));
let parsedFind = v as string | RegExp;
if (/^\/.+?\/$/.test(v)) parsedFind = new RegExp(v.slice(1, -1));
setFindError(void 0);
setFind(find);
setParsedFind(parsedFind);
if (find.length) {
if (v.length) {
findCandidates({ find: parsedFind, setModule, setError: setFindError });
}
} catch (e: any) {
@ -328,15 +324,11 @@ function PatchHelper() {
}
function onMatchChange(v: string) {
setMatchError(void 0);
setMatch(v);
}
function onMatchBlur() {
try {
new RegExp(match);
new RegExp(v);
setMatchError(void 0);
setMatch(match);
} catch (e: any) {
setMatchError((e as Error).message);
}
@ -357,7 +349,6 @@ function PatchHelper() {
type="text"
value={find}
onChange={onFindChange}
onBlur={onFindBlur}
error={findError}
/>
@ -366,7 +357,6 @@ function PatchHelper() {
type="text"
value={match}
onChange={onMatchChange}
onBlur={onMatchBlur}
error={matchError}
/>