Skip to content

Commit 3dbb4c0

Browse files
anjiazhuyouxing田丰
andauthored
docs: resolve ime error in search (#2651)
Co-authored-by: 田丰 <[email protected]>
1 parent f219141 commit 3dbb4c0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/semi-ui/jsonViewer/index.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class JsonViewerCom extends BaseComponent<JsonViewerProps, JsonViewerState> {
5555
private editorRef: React.RefObject<HTMLDivElement>;
5656
private searchInputRef: React.RefObject<HTMLInputElement>;
5757
private replaceInputRef: React.RefObject<HTMLInputElement>;
58+
private isComposing: boolean = false;
5859

5960
foundation: JsonViewerFoundation;
6061

@@ -190,6 +191,16 @@ class JsonViewerCom extends BaseComponent<JsonViewerProps, JsonViewerState> {
190191
className={`${prefixCls}-search-bar-input`}
191192
onChange={(_value, e) => {
192193
e.preventDefault();
194+
if (!this.isComposing) {
195+
this.searchHandler();
196+
}
197+
this.searchInputRef.current?.focus();
198+
}}
199+
onCompositionStart={() => {
200+
this.isComposing = true;
201+
}}
202+
onCompositionEnd={() => {
203+
this.isComposing = false;
193204
this.searchHandler();
194205
this.searchInputRef.current?.focus();
195206
}}

0 commit comments

Comments
 (0)