React TypeScript Text Editor code example

Example: React Draft Wysiwyg typescript

import Draft, { htmlToDraft, draftToHtml, EmptyState, rawToDraft, draftToRaw , draftStateToHTML} from 'react-wysiwyg-typescript' state = {    editorState: htmlToDraft('Your html contents') // or use an EmptyState} <Draft    editorState={this.state.editorState}    onEditorStateChange={(editorState) => { this.setState({ editorState }) }}/> // save html to server const html = draftToHtml(content) // convert raw to draft const toDraft = rawToDraft(content) // convert draft to raw const toRaw = draftToRaw(content) // convert rawToDraft file to HTML const toHTML = draftStateToHTML(content)