最近在使用antd design pro 4.0设计知识库版本管理
富文本编辑器选择了 braft-editor
文档地址:https://www.yuque.com/braft-editor/be/lzwpnr
# 使用npm安装
npm install braft-editor --save
# 使用yarn安装
yarn add braft-editor
接下来看如何在react中使用:
import React, { useState } from 'react';
import { Button, notification, Card, Row, Col } from 'antd';
import BraftEditor from 'braft-editor'
import 'braft-editor/dist/index.css'
import 'braft-editor/dist/output.css'
import './style.less'
import HtmlDiff from 'htmldiff-js'
import { PageHeaderWrapper } from '@ant-design/pro-layout';
const DpEditor: React.FC<{}> = () => {
const [editorState, setContent] = useState<any>(BraftEditor.createEditorState(null));
const [oldEditorState, set