From c088ac533db76d4b22dfd745bb165380dd0409e6 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 16 Jul 2025 10:08:19 +0800 Subject: [PATCH] :technologist: Improve kernel API `/api/block/updateBlock` and `/api/block/batchUpdateBlock` https://github.com/siyuan-note/siyuan/issues/15301 --- kernel/api/block_op.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/api/block_op.go b/kernel/api/block_op.go index c88bdb50e..69bfae5b8 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()