fix: markdown component (#469)

This commit is contained in:
金昶 2022-06-05 09:01:27 +08:00 committed by GitHub
parent d6d14459ed
commit 7760cd0891
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -44,11 +44,10 @@ ReadPretty.TextArea = (props) => {
/>
);
console.log('value', value);
const content = (
<EllipsisWithTooltip ellipsis={ellipsis} popoverContent={autop ? html : value}>
{ellipsis ? text || value : html}
</EllipsisWithTooltip>
);
const content = ellipsis ?
(<EllipsisWithTooltip ellipsis={ellipsis} popoverContent={autop ? html : value}>
{text}
</EllipsisWithTooltip>) : value || html;
return (
<div className={cls(prefixCls, props.className)} style={props.style}>
{props.addonBefore}

View File

@ -20,8 +20,8 @@ export const Markdown: any = connect(
}),
mapReadPretty((props) => {
let text = convertToText(props.value);
let value = <div className={'nb-markdown'} dangerouslySetInnerHTML={{ __html: markdown(text) }} />;
return <InputReadPretty.TextArea {...props} text={text} value={value} />;
let value = <div className={'nb-markdown'} dangerouslySetInnerHTML={{ __html: markdown(props.value) }} />;
return <InputReadPretty.TextArea {...props} autop={false} text={text} value={value} />;
}),
);