diff --git a/packages/react-shared-components/src/PreviewText.tsx b/packages/react-shared-components/src/PreviewText.tsx index d61daaa9860..8f2c1124d28 100644 --- a/packages/react-shared-components/src/PreviewText.tsx +++ b/packages/react-shared-components/src/PreviewText.tsx @@ -43,6 +43,12 @@ export const PreviewText: React.FC & { value = String( props.value === undefined || props.value === null ? '' : props.value ) + // 如果有换行符,拆分成多行 + if (value.match('\n')) { + value = value + .split('\n') + .map((subStr, index) =>
{subStr}
) + } } } const placeholder = isFn(context.previewPlaceholder)