mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-27 03:48:48 +01:00
🧑💻 Improve kernel API /api/block/updateBlock and /api/block/batchUpdateBlock https://github.com/siyuan-note/siyuan/issues/15301
This commit is contained in:
parent
0d3df5d449
commit
c088ac533d
1 changed files with 6 additions and 2 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue