From 4a6bf097379e646d0b3a0f23e6fe9c32234e8274 Mon Sep 17 00:00:00 2001 From: Junyi Date: Wed, 23 Oct 2024 21:00:38 +0800 Subject: [PATCH] fix(client): fix special white space happens when paste content (#5497) --- .../client/src/schema-component/antd/variable/TextArea.tsx | 5 +++-- .../src/server/RequestInstruction.ts | 7 ++++--- 2 files changed, 7 insertions(+), 5 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 89ea49ad3f..724e9f4f1e 100644 --- a/packages/core/client/src/schema-component/antd/variable/TextArea.tsx +++ b/packages/core/client/src/schema-component/antd/variable/TextArea.tsx @@ -210,7 +210,7 @@ function getCurrentRange(element: HTMLElement): RangeIndexes { export function TextArea(props) { const { wrapSSR, hashId, componentCls } = useStyles(); - const { value = '', scope, onChange, multiline = true, changeOnSelect, style } = props; + const { value = '', scope, onChange, changeOnSelect, style } = props; const inputRef = useRef(null); const [options, setOptions] = useState([]); const form = useForm(); @@ -420,9 +420,10 @@ export function TextArea(props) { hashId, 'ant-input', { 'ant-input-disabled': disabled }, + // NOTE: `pre-wrap` here for avoid the ` ` (\x160) issue when paste content, we need normal space (\x32). css` overflow: auto; - white-space: ${multiline ? 'normal' : 'nowrap'}; + white-space: pre-wrap; &[placeholder]:empty::before { content: attr(placeholder); diff --git a/packages/plugins/@nocobase/plugin-workflow-request/src/server/RequestInstruction.ts b/packages/plugins/@nocobase/plugin-workflow-request/src/server/RequestInstruction.ts index 95e0bf0ea6..b3c41b0434 100644 --- a/packages/plugins/@nocobase/plugin-workflow-request/src/server/RequestInstruction.ts +++ b/packages/plugins/@nocobase/plugin-workflow-request/src/server/RequestInstruction.ts @@ -25,8 +25,8 @@ export type RequestConfig = Pick