Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(find-replace): fix enter shortcut (#5657)

wpxp123456ae1dc2a93135
diff --git a/packages/find-replace/src/views/dialog/FindReplaceDialog.tsx b/packages/find-replace/src/views/dialog/FindReplaceDialog.tsx
index f4c278d405..5997d511e3 100644
--- a/packages/find-replace/src/views/dialog/FindReplaceDialog.tsx
+++ b/packages/find-replace/src/views/dialog/FindReplaceDialog.tsx
@@ -279,9 +279,9 @@ export function FindReplaceDialog() {
}
if (!focusRef.current || !focusRef.current.selectHasFocus()) {
- setDialogInputFocus(true);
- } else {
setDialogInputFocus(false);
+ } else {
+ setDialogInputFocus(true);
}
});
diff --git a/packages/find-replace/src/views/dialog/SearchInput.tsx b/packages/find-replace/src/views/dialog/SearchInput.tsx
index 6216bb8652..41436d0c59 100644
--- a/packages/find-replace/src/views/dialog/SearchInput.tsx
+++ b/packages/find-replace/src/views/dialog/SearchInput.tsx
@@ -16,7 +16,6 @@
import type { LocaleService } from '@univerjs/core';
import type { IInputProps } from '@univerjs/design';
-import type { KeyboardEvent } from 'react';
import type { IFindReplaceService } from '../../services/find-replace.service';
import { Input, Pager } from '@univerjs/design';
import { useState } from 'react';
@@ -62,12 +61,6 @@ export function SearchInput(props: ISearchInputProps) {
}
}
- function handleEnter(event: KeyboardEvent<HTMLInputElement>) {
- if (event.key === 'Enter') {
- handleChangePosition(matchesPosition + 1);
- }
- }
-
return (
<div className="univer-relative univer-flex univer-items-center univer-gap-2" onDrag={(e) => e.stopPropagation()}>
<Input
@@ -79,7 +72,6 @@ export function SearchInput(props: ISearchInputProps) {
setValue(value);
onChange?.(value);
}}
- onKeyDown={handleEnter}
slot={(
<Pager
loop