importReactfrom'react'importCodeEditorfrom'rmce'// add jsx language supportimport'prismjs/components/prism-jsx'// editor themeimport'rmce/index.css'functionMyFancyEditor() {
let [code, setCode] =React.useState('<div>test</div>')
return <CodeEditorclassName='rmce'language='jsx'onChange={setCode}value={code}
/>
}
Props
classProps{// Current value of the editor i.e. the code to displaychildren: string=''value: string=this.children// Callback which is called when the value of the editor changesonChange(): void// Specifies the syntax language for prismjslanguage: string | null=''// Specifies the ability to editreadOnly: boolean=false// Callback which will receive code to highlighthighlight(code: string): string{returnlanguage? Prism.highlight(code,Prism.languages[language]) : code}