fix(client): clear text formatting when textarea ellipsis

This commit is contained in:
chenos 2022-04-06 11:03:25 +08:00
parent f8dd5d6f79
commit beb1ea2f9e

View File

@ -34,18 +34,19 @@ ReadPretty.TextArea = (props) => {
const prefixCls = usePrefixCls('description-textarea', props); const prefixCls = usePrefixCls('description-textarea', props);
const compile = useCompile(); const compile = useCompile();
const value = compile(props.value ?? ''); const value = compile(props.value ?? '');
const { autop = true } = props; const { autop = true, ellipsis, text } = props;
let content = null; const html = (
const values = HTMLEncode(value).split('\n').join('<br/>'); <div
content = ( dangerouslySetInnerHTML={{
<EllipsisWithTooltip __html: HTMLEncode(value).split('\n').join('<br/>'),
ellipsis={props.ellipsis} }}
popoverContent={autop ? <div dangerouslySetInnerHTML={{ __html: values }} /> : value} />
> );
{props.text ?? value} const content = (
<EllipsisWithTooltip ellipsis={ellipsis} popoverContent={autop ? html : value}>
{ellipsis ? text || value : html}
</EllipsisWithTooltip> </EllipsisWithTooltip>
); );
return ( return (
<div className={cls(prefixCls, props.className)} style={props.style}> <div className={cls(prefixCls, props.className)} style={props.style}>
{props.addonBefore} {props.addonBefore}