✨ 提供插入块、更新块和删除块的 API https://github.com/siyuan-note/siyuan/issues/3334
This commit is contained in:
parent
dc8e413246
commit
4dbf66d441
1 changed files with 42 additions and 0 deletions
42
API.md
42
API.md
|
@ -480,6 +480,48 @@
|
|||
* `action.data`:新插入块生成的 DOM
|
||||
* `action.id`:新插入块的 ID
|
||||
|
||||
### 更新块
|
||||
|
||||
* `/api/block/updateBlock`
|
||||
* 参数
|
||||
|
||||
```json
|
||||
{
|
||||
"dataType": "markdown",
|
||||
"data": "foobarbaz",
|
||||
"id": "20211230161520-querkps"
|
||||
}
|
||||
```
|
||||
|
||||
* `dataType`:待更新数据类型,值可选择 `markdown` 或者 `dom`
|
||||
* `data`:带更新的数据
|
||||
* `id`:待更新块 ID
|
||||
* 返回值
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 0,
|
||||
"msg": "",
|
||||
"data": [
|
||||
{
|
||||
"doOperations": [
|
||||
{
|
||||
"action": "update",
|
||||
"data": "<div data-node-id=\"20211230161520-querkps\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\"><div contenteditable=\"true\" spellcheck=\"false\">foo<strong>bar</strong>baz</div><div class=\"protyle-attr\" contenteditable=\"false\"></div></div>",
|
||||
"id": "20211230161520-querkps",
|
||||
"parentID": "",
|
||||
"previousID": "",
|
||||
"retData": null
|
||||
}
|
||||
],
|
||||
"undoOperations": null
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
* `action.data`:更新块生成的 DOM
|
||||
|
||||
## 属性
|
||||
|
||||
### 设置块属性
|
||||
|
|
Loading…
Add table
Reference in a new issue