import React, { Fragment, PureComponent } from 'react'; import { convertFromRaw, EditorState, convertToRaw } from 'draft-js'; import { Editor } from 'react-draft-wysiwyg'; import draftToHtml from 'draftjs-to-html'; import draftToMarkdown from 'draftjs-to-markdown'; import EditorStyle from 'ba-styles/TextEditor.scss'; import 'ba-styles/vendors/react-draft-wysiwyg/react-draft-wysiwyg.css'; import { Grid, Typography } from '@material-ui/core'; const content = { blocks: [{ key: '637gr', text: 'Lorem ipsum dolor sit amet 😀', type: 'unstyled', depth: 0, inlineStyleRanges: [], entityRanges: [], data: {} }], entityMap: {} }; class Wysiwyg extends PureComponent { constructor(props) { super(props); const contentBlock = convertFromRaw(content); if (contentBlock) { const editorState = EditorState.createWithContent(contentBlock); this.state = { editorState, }; } } onEditorStateChange = editorState => { this.setState({ editorState, }); }; render() { const { editorState } = this.state; return ( JSON Result :