Skip to content

Commit

Permalink
feat: input enter with ime (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
islxyqwe authored Sep 30, 2024
1 parent d15ac9a commit 9d0c30a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/graphic-walker/src/components/askViz/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const AskViz: React.FC<{
value={query}
onChange={(e) => setQuery(e.target.value)}
onKeyDown={(e) => {
if (e.key === 'Enter' && loading === false && query.length > 0) {
if (e.key === 'Enter' && !e.nativeEvent.isComposing && loading === false && query.length > 0) {
startQuery();
}
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/graphic-walker/src/components/chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export const VegaliteChat = observer(function VegaliteChat(props: {
rows={1}
value={query}
onKeyDown={(e) => {
if (e.key === 'Enter' && !e.shiftKey && loading === false && query.length > 0) {
if (e.key === 'Enter' && !e.nativeEvent.isComposing && !e.shiftKey && loading === false && query.length > 0) {
e.preventDefault();
submit();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const ClickInput = (props: { value: string; onChange: (v: string) => void
defaultValue={props.value}
onBlur={doChange}
onKeyUp={(e) => {
if (e.key === 'Enter') {
if (e.key === 'Enter' && !e.nativeEvent.isComposing) {
doChange(e as unknown as { target: HTMLInputElement });
return false;
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphic-walker/src/fields/filterField/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const ValueInput: React.FC<ValueInputProps> = (props) => {
onChange={(e) => setInnerValue(e.target.value)}
onBlur={handleSubmitValue}
onKeyDown={(e) => {
if (e.key === 'Enter') {
if (e.key === 'Enter' && !e.nativeEvent.isComposing) {
handleSubmitValue();
}
}}
Expand Down

0 comments on commit 9d0c30a

Please sign in to comment.