diff --git a/packages/core/client/src/schema-component/antd/variable/Input.tsx b/packages/core/client/src/schema-component/antd/variable/Input.tsx index 364df26cb3d..d75bcec3eae 100644 --- a/packages/core/client/src/schema-component/antd/variable/Input.tsx +++ b/packages/core/client/src/schema-component/antd/variable/Input.tsx @@ -39,7 +39,7 @@ function parseValue(value: any, options: ParseOptions = {}): string | string[] { if (type === 'string') { const matched = value.match(JT_VALUE_RE); if (matched) { - return matched[1].split('.'); + return matched[1].trim().split('.'); } if (options.stringToDate) { if (!Number.isNaN(Date.parse(value))) { 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 24bc05ce728..a8a11073e06 100644 --- a/packages/core/client/src/schema-component/antd/variable/TextArea.tsx +++ b/packages/core/client/src/schema-component/antd/variable/TextArea.tsx @@ -236,7 +236,7 @@ function useVariablesFromValue(value: string, delimiters: [string, string] = ['{ } const variableRegExp = new RegExp(`${delimiters[0]}\\s*([^{}]+)\\s*${delimiters[1]}`, 'g'); const matches = value.match(variableRegExp); - return matches?.map((m) => m.replace(variableRegExp, '$1')) ?? []; + return matches?.map((m) => m.replace(variableRegExp, '$1').trim()) ?? []; }, [value, delimitersString]); }