Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:technologist: Improve kernel API `/api/block/updateBlock` and `/api/block/batchUpdateBlock` https://github.com/siyuan-note/siyuan/issues/15301

Danielc088ac533db7
diff --git a/kernel/api/block_op.go b/kernel/api/block_op.go
index c88bdb50ec..69bfae5b89 100644
--- a/kernel/api/block_op.go
+++ b/kernel/api/block_op.go
@@ -587,7 +587,9 @@ func updateBlock(c *gin.Context) {
var ops []*model.Operation
for n := oldTree.Root.FirstChild; nil != n; n = n.Next {
toRemoves = append(toRemoves, n)
- ops = append(ops, &model.Operation{Action: "delete", ID: n.ID})
+ ops = append(ops, &model.Operation{Action: "delete", ID: n.ID, Data: map[string]interface{}{
+ "createEmptyParagraph": false, // 清空文档后前端不要创建空段落
+ }})
}
for _, n := range toRemoves {
n.Unlink()
@@ -707,7 +709,9 @@ func batchUpdateBlock(c *gin.Context) {
for n := oldTree.Root.FirstChild; nil != n; n = n.Next {
toRemoves = append(toRemoves, n)
- ops = append(ops, &model.Operation{Action: "delete", ID: n.ID})
+ ops = append(ops, &model.Operation{Action: "delete", ID: n.ID, Data: map[string]interface{}{
+ "createEmptyParagraph": false, // 清空文档后前端不要创建空段落
+ }})
}
for _, n := range toRemoves {
n.Unlink()