【发布时间】:2017-07-20 18:27:32
【问题描述】:
我正在编写一个具有一些 OneNote 功能的 Web 应用程序。但是我遇到了一些问题。为了更新页面,OneNote API 需要以如下格式发送更改数组:
[
{
'target':'#div1',
'action':'append',
'position':'before',
'content':'<img data-id="first-child" src="image-url-or-part-name" />'
},
{
'target':'#div1',
'action':'append',
'content':'<p data-id="last-child">New paragraph appended to the div</p>'
}
]
https://msdn.microsoft.com/en-us/office/office365/howto/onenote-update-page
因此,如果使用文本编辑器,例如 react-rte(npm 库),我应该如何找到我的格式更改?我是否必须自己创建一些算法并比较开始和最终内容以找出发生了什么变化?
【问题讨论】:
-
也许可以试试draftjs.org,它有非常好的跟踪变化的功能
标签: reactjs rich-text-editor onenote rte