Open TrofinSorin opened 5 months ago
I'm saving the HTML to my database and when entering the modal that contains this WYSIWYG.
I need to add back to the WYSIWYG this HTML: <h1>1</h1>\n<h1> 2</h1>\n<h1>3</h1>\n
<h1>1</h1>\n<h1> 2</h1>\n<h1>3</h1>\n
Which will look something like this:
1 2 3
This is what I'm using to set the editor state to populate the WYSIWYG.
const [editorState, setEditorState] = useState(EditorState.createEmpty()); const blocksFromHTML = convertFromHTML(messageFromBackend); const contentState = ContentState.createFromBlockArray( blocksFromHTML.contentBlocks, blocksFromHTML.entityMap ); // Update the editorState with the new content setEditorState(EditorState.createWithContent(contentState));
This is the HTML:
<Editor editorState={editorState} wrapperClassName="demo-wrapper" editorClassName="demo-editor" onEditorStateChange={onEditorStateChange} />
I need the nbsp to show inside wysiwyg when setting the state with what i've saved from WYSIWYG initiality
I'm saving the HTML to my database and when entering the modal that contains this WYSIWYG.
I need to add back to the WYSIWYG this HTML:
<h1>1</h1>\n<h1> 2</h1>\n<h1>3</h1>\n
Which will look something like this:
This is what I'm using to set the editor state to populate the WYSIWYG.
This is the HTML:
I need the nbsp to show inside wysiwyg when setting the state with what i've saved from WYSIWYG initiality