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

170
Views
Render React-Component inside ContentEditable

I use a ContentEditable from react-contenteditable, inside of it I would like to render a button, which opens a menu on click, like this one. It already works, when I render the button normally as a component (not inside the Contendeditable).

Unfortunately, react-contenteditable only allows me to set the html as shown in this example.

I have already tried to use ReactDomServer.renderToStaticMarkup and ReactDomServer.renderToString, but the button is firing the defined onClick function when I click it.

Here is the code I tried: (addSummaryStatementButton is the corresponding button and ContentEditable the corresponding contend-editable.

render = () => {
        const addSummaryStatementButton =
            <AddSummaryStatementButton addSummaryStatement={() => console.log('add summary statement')}/>;
        const staticMarkup = ReactDomServer.renderToStaticMarkup(addSummaryStatementButton);
        const stringMarkup = ReactDomServer.renderToString(addSummaryStatementButton);

        let summary = this.props.summary;
        summary = summary + '<br />' + staticMarkup + '<br />' + stringMarkup;

        return <div className='summary-area'>
            <div className='summary'>
                <ContentEditable
                    html={summary}
                    disabled={false} // use true to disable edition
                    onChange={this.handleChange} // handle innerHTML change
                    spellCheck={false}
                    onBlur={this.props.analyzeSummary}
                />
            </div>
        </div>;

    };

I am very happy for any Ideas!

about 4 years ago · Juan Pablo Isaza
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!