我正在使用react-draft- wysiwyg和draftjs-to-html制作文本编辑器..
而且我已经将动态 html 注入到编辑器中,例如,
索引.js:
export default function App() {
  const dynamicData = `<div class="heading"> This text needs to display along with the <span> html tags </span> surrounded </div>`;
  const handleInputChange = (e) => {
    console.log("event ", e.target.value);
  };
  return (
    <>
      <ContentEditor
        name="dynamicContent"
        value={dynamicData}
        onChange={(event) => handleInputChange(event)}
      />
    </>
  );
}
当前工作场景:
在这里,一切运行良好,我能够得到纯文本,例如,
This text needs to display along with the html tags surrounded 
在编辑器里面。
注意:(我的意思是说只显示文本而不显示 div、span 等 html 标签。
预期的:
我需要绑定整个 HTML,就像它在编辑器中一样,
<div class="heading"> This text needs to display along with the <span> html tags </span> surrounded </div>
工作片段:
所以我的要求是需要将编辑器中的文本显示为,
<div class="heading"> This text needs to display along with the <span> html tags </span> surrounded </div>
替代的
This text needs to display along with the html tags surrounded