so the html is like this:
<p><span style="color: rgb(250,197,28);font-size: 96px;">Hello</span><span style="font-size: 96px;"> </span><span style="color: rgb(251,160,38);font-size: 96px;">World</span></p>
and my text editor creating with content is like this
useEffect(() => {
if (content !== "") {
console.log(content);
const contentBlock = convertFromHTML(content);
const contentState = ContentState.createFromBlockArray(
contentBlock.contentBlocks
);
const editorState = EditorState.createWithContent(contentState);
setEditorState(editorState);
}
}, []);
so the inline styles are not being generated even though they are there and have correct syntext and should be generated but is there something wrong with this code or also I am using next js 12 if that helps
Simple passing the contentBlock will work. Use as below:
const contentBlock = convertFromHTML(content);
const contentState = ContentState.createFromBlockArray(contentBlock);
const editorState = EditorState.createWithContent(contentState);