7.13 富文本改造

This commit is contained in:
jl-zhoujl2
2022-07-13 10:04:01 +08:00
parent 26b7130352
commit 8276d04729
2 changed files with 57 additions and 16 deletions

View File

@ -7,6 +7,7 @@ import { isEmpty } from '@/utils/CommonUtils';
const Editor: React.FC<{}> = () => {
const braftRef = useRef<any>(null);
const [text, setText] = useState();
const [code, setCode] = useState();
const { Text, Paragraph } = Typography;
return (
<ProCard
@ -15,9 +16,14 @@ const Editor: React.FC<{}> = () => {
headerBordered
>
<ProCard title="文本域" colSpan="50%">
<BraftText braftRef={braftRef} echo={''} disabled={false} height={600} onChange={(value) => setText(value)} />
<BraftText braftRef={braftRef} echo={''} disabled={false} height={600} onChange={(value) => setText(value)} useImage />
</ProCard>
<ProCard title="代码段" colSpan="50%">
<ProCard title="代码段" colSpan="50%" extra={
<>
{code}
<Button type="primary" onClick={() => setCode(braftRef.current.getImageId())}></Button>
</>
}>
{isEmpty(text) ? '没有' : (
<Paragraph>
<pre>