import MUIRichTextEditor from 'mui-rte'
import { convertToRaw } from 'draft-js'
const yourComponent = () => {
const [value, setValue] = setState('')
const onEditorChange = event => {
const plainText = event.getCurrentContent().getPlainText() // for plain text
const rteContent = convertToRaw(event.getCurrentContent())) // for rte content with text formating
rteContent && setValue(JSON.stringify(rteContent)) // store your rteContent to state
}
return (
<MUIRichTextEditor
label="Your label"
controls={['numberList', bulletList ]}
value={value}
onChange={onEditorChange}
/>
)
}
controls - takes an array of strings for the controls you want
eg.
"title" | "bold" | "italic" | "underline" | "link" | "numberList" |
"bulletList" | "quote" | "code" | "clear" | "save" | "media" |
"strikethrough" | "highlight"
Here I am storing the RTE content object as string but thats up to you if you like to store the object as it is.