From fab448c486c229d39261d67eee224c32d86e30c6 Mon Sep 17 00:00:00 2001 From: Junyi Date: Wed, 10 May 2023 14:57:59 +0700 Subject: [PATCH] fix(client): fix ime status in variable textarea (#1832) --- .../client/src/schema-component/antd/variable/TextArea.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/variable/TextArea.tsx b/packages/core/client/src/schema-component/antd/variable/TextArea.tsx index c4854814a..ea0e01ed4 100644 --- a/packages/core/client/src/schema-component/antd/variable/TextArea.tsx +++ b/packages/core/client/src/schema-component/antd/variable/TextArea.tsx @@ -187,7 +187,6 @@ function getCurrentRange(element: HTMLElement): RangeIndexes { export function TextArea(props) { const { value = '', scope, onChange, multiline = true } = props; const compile = useCompile(); - const { t } = useTranslation(); const inputRef = useRef(null); const options = compile((typeof scope === 'function' ? scope() : scope) ?? []); const form = useForm(); @@ -291,7 +290,7 @@ export function TextArea(props) { if (ev.key === 'Enter') { ev.preventDefault(); } - setIME(ev.keyCode === 229); + setIME(ev.keyCode === 229 && ![' ', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'Enter'].includes(ev.key)); // if (ev.key === 'Control') { // console.debug(getSelection().getRangeAt(0)); // } @@ -381,7 +380,7 @@ export function TextArea(props) { ); } -TextArea.ReadPretty = (props) => { +TextArea.ReadPretty = function ReadPretty(props): JSX.Element { const { value, multiline = true, scope } = props; const compile = useCompile(); const options = compile((typeof scope === 'function' ? scope() : scope) ?? []);