我有一个用例,我必须将 HTML 模板呈现到编辑器上。我也在探索 Draftjs。我已经完成了基本设置,并为简单的文本渲染了 Draftjs 编辑器。
但是如果我将一个 HTML 字符串传递给同一个编辑器组件,我会得到以下异常。
DraftEditorContents-core.react.js:80 Uncaught TypeError: nextEditorState.getDirectionMap is not a function
at DraftEditorContents.shouldComponentUpdate (DraftEditorContents-core.react.js:80)
at checkShouldComponentUpdate (react-dom.development.js:11345)
at updateClassInstance (react-dom.development.js:11754)
at updateClassComponent (react-dom.development.js:13153)
at beginWork (react-dom.development.js:13824)
at performUnitOfWork (react-dom.development.js:15863)
at workLoop (react-dom.development.js:15902)
at HTMLUnknownElement.callCallback (react-dom.development.js:100)
at Object.invokeGuardedCallbackDev (react-dom.development.js:138)
at invokeGuardedCallback (react-dom.development.js:187)
知道我需要做什么才能让这个工作在草稿上吗?如果 draftjs 不适合这个,那么你建议任何其他库作为替代方案?