参考网站:https://braft.margox.cn
GitHub:https://github.com/margox/braft-editor
# Install using yarn
yarn add braft-editor
# Install using npm
npm install braft-editor --save
代码引入:
import 'braft-editor/dist/index.css'
import React from 'react'
import BraftEditor from 'braft-editor'
export default class PageDemo extends React.Component {
state = {
editorState: BraftEditor.createEditorState(null)
}
render () {
return (
<BraftEditor value={this.state.editorState} onChange={this.handleChange}/>
)
}
handleChange = (editorState) => {
this.setState({ editorState })
}
}
网友评论