prg*_*rmr 4 javascript contenteditable reactjs
我试图在无状态反应组件中实现一个可信的div.
我一直收到以下警告:
warning.js:36 Warning: A component is `contentEditable` and contains `children` managed by React. It is now your responsibility to guarantee that none of those nodes are unexpectedly modified or duplicated. This is probably not intentional.
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
另外如何在更改时读取div的内容?
添加suppressContentEditableWarning="true"到contenteditable div.
参考:https://github.com/facebook/draft-js/issues/81
与任何 React 应用程序一样,修改 DOM 的浏览器插件和扩展可能会导致草稿编辑器崩溃。
例如,语法检查器可以修改 contentEditable 元素中的 DOM,添加下划线和背景等样式。由于如果浏览器不符合其期望,React 无法协调 DOM,因此编辑器状态可能无法与 DOM 保持同步。
https://github.com/facebook/draft-js/issues/53
一个已知错误。至于读取 div 中的内容,为元素分配一个 id 并..
oDoc = document.getElementById("divelement");
sDefTxt = oDoc.innerHTML;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3588 次 |
| 最近记录: |