Merge branch '20220705-wangeditor' of http://10.124.128.2:8888/eshop/fe_service_ebtp_frontend into 20220712-topic-management

This commit is contained in:
jl-zhoujl2
2022-07-13 15:15:59 +08:00
3 changed files with 177 additions and 13 deletions

View File

@ -0,0 +1,41 @@
import React, { useRef, useState } from 'react';
import { Button, Typography } from 'antd';
import BraftText from '@/components/richText/wang';
import ProCard from '@ant-design/pro-card';
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
split={'vertical'}
bordered
headerBordered
>
<ProCard title="文本域" colSpan="50%">
<BraftText braftRef={braftRef} echo={''} disabled={false} height={600} onChange={(value) => setText(value)} useImage />
</ProCard>
<ProCard title="代码段" colSpan="50%" extra={
<>
{code}
<Button type="primary" onClick={() => setCode(braftRef.current.getImageId())}></Button>
</>
}>
{isEmpty(text) ? '没有' : (
<Paragraph>
<pre>
<Text copyable>
{text}
</Text>
</pre>
</Paragraph>
)}
</ProCard>
</ProCard>
);
};
export default Editor;