An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: 提供插入块、更新块和删除块的 API https://github.com/siyuan-note/siyuan/issues/3334
Liang Ding4dbf66d4416f
diff --git a/API.md b/API.mdindex 5d22ce9da4..2bf257dcd9 100644--- a/API.md+++ b/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+## 属性### 设置块属性