Skip to content

Commit

Permalink
docs: resolve ime error in search (#2651)
Browse files Browse the repository at this point in the history
Co-authored-by: 田丰 <[email protected]>
  • Loading branch information
anjiazhuyouxing and 田丰 authored Jan 7, 2025
1 parent f219141 commit 3dbb4c0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/semi-ui/jsonViewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class JsonViewerCom extends BaseComponent<JsonViewerProps, JsonViewerState> {
private editorRef: React.RefObject<HTMLDivElement>;
private searchInputRef: React.RefObject<HTMLInputElement>;
private replaceInputRef: React.RefObject<HTMLInputElement>;
private isComposing: boolean = false;

foundation: JsonViewerFoundation;

Expand Down Expand Up @@ -190,6 +191,16 @@ class JsonViewerCom extends BaseComponent<JsonViewerProps, JsonViewerState> {
className={`${prefixCls}-search-bar-input`}
onChange={(_value, e) => {
e.preventDefault();
if (!this.isComposing) {
this.searchHandler();
}
this.searchInputRef.current?.focus();
}}
onCompositionStart={() => {
this.isComposing = true;
}}
onCompositionEnd={() => {
this.isComposing = false;
this.searchHandler();
this.searchInputRef.current?.focus();
}}
Expand Down

0 comments on commit 3dbb4c0

Please sign in to comment.