react-contenteditable
react-contenteditable copied to clipboard
how to set custom style in html
const text = useRef('<p style={{color:'red'}}>123</p>'); const handleChange = evt => { text.current = evt.target.value; }; const handleBlur = () => { console.log(text.current); }; return <ContentEditable html={text.current} onBlur={handleBlur} onChange={handleChange} />
when I try to set custom style for html content, the 'style={{color:'red'}}' don't work, is that a bug ? what should I do?
Hi,
you must write HTML tag because render with dangerouslySetInnerHTML.
const text = <p style='color:red'>123</p>