mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🎨 Improve list item deletion https://github.com/siyuan-note/siyuan/issues/13617
This commit is contained in:
parent
81b0a9385b
commit
b493aaee2e
1 changed files with 11 additions and 3 deletions
|
@ -792,9 +792,17 @@ func (tx *Transaction) doDelete(operation *Operation) (ret *TxErr) {
|
|||
|
||||
node.Unlink()
|
||||
if nil != parent && ast.NodeListItem == parent.Type && nil == parent.FirstChild {
|
||||
// 保持空列表项
|
||||
node.FirstChild = nil
|
||||
parent.AppendChild(node)
|
||||
needAppendEmptyListItem := true
|
||||
for _, op := range tx.DoOperations {
|
||||
if "insert" == op.Action && op.ParentID == parent.ID {
|
||||
needAppendEmptyListItem = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if needAppendEmptyListItem {
|
||||
parent.AppendChild(treenode.NewParagraph(ast.NewNodeID()))
|
||||
}
|
||||
}
|
||||
treenode.RemoveBlockTree(node.ID)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue