I have react based app with mui components and in this particular case I'm stuck on RTE. The flow is:
'<h1>Hello, {{name}}!</h1><p>this is test</p>'
'<h1>Hello {{name}}</h1><p>Updated Content</p>'
The problem is i can't figure out how to get the content of the RTE like string with all the tags inside of it, it always turns up with some strange response and i can't parse it or stringify it properly...
const sample = '<h1>Hello, {{name}}!</h1><p>this is test</p>';
const contentHTML = convertFromHTML(sample);
const state = ContentState.createFromBlockArray(
contentHTML.contentBlocks,
contentHTML.entityMap,
);
const content = JSON.stringify(convertToRaw(state));
<MUIRichTextEditor
label=""
defaultValue={content}
//onSave={}
// or
//onChange={}
/>
try using draft-js-export-html it has worked for me
import { stateToHTML } from 'draft-js-export-html';
return (
<YourComp
onChange={ value => stateToHTML(value.getCurrentContent()) }
/>
)