Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
react draft wysiwyg not displaying styles in next js

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Simple passing the contentBlock will work. Use as below:

const contentBlock = convertFromHTML(content);    
const contentState = ContentState.createFromBlockArray(contentBlock);
const editorState = EditorState.createWithContent(contentState);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!