ant-design / pro-components

🏆 Use Ant Design like a Pro!
https://pro-components.antdigital.dev
MIT License
4.3k stars 1.36k forks source link

🐛[BUG] 表单 readonly 模式下,输入超长英文单词没有自动换行,导致文本溢出 #8581

Open polaris-dxz opened 3 months ago

polaris-dxz commented 3 months ago

🐛 bug 描述

表单 readonly 模式下,输入超长英文单词没有自动换行,导致文本溢出

📷 复现步骤

image

https://codesandbox.io/p/github/polaris-dxz/procomponents-demo/master?file=%2Fsrc%2Fpages%2FHome%2Findex.tsx&workspaceId=21d3a789-2efe-4b29-bfbd-e3f861d8c45b

https://54yjky-8000.csb.app/home

🏞 期望结果

期望在 readonly 模式下,能为文本容器添加 word-wrap: break-word;

💻 复现代码

import {
  PageContainer,
  ProCard,
  ProForm,
  ProFormText,
  ProFormTextArea,
} from '@ant-design/pro-components';
import React, { useState } from 'react';
const HomePage: React.FC = () => {
  const [readonly, setReadonly] = useState(false);
  const onClick = () => {
    setReadonly(!readonly);
  };
  return (
    <PageContainer>
      <button type="button" onClick={onClick}>
        readonly
      </button>
      <ProCard>
        <ProForm>
          <ProFormText name="text" readonly={readonly}></ProFormText>
          <ProFormTextArea
            name="textarea"
            readonly={readonly}
          ></ProFormTextArea>
        </ProForm>
      </ProCard>
    </PageContainer>
  );
};

export default HomePage;

© 版本信息

🚑 其他信息