mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Improve fold heading editing https://github.com/siyuan-note/siyuan/issues/14349 Point 01
This commit is contained in:
parent
9e7426a6f4
commit
de55ea9315
2 changed files with 26 additions and 0 deletions
|
|
@ -1222,6 +1222,12 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
|
|||
node.InsertAfter(remain)
|
||||
}
|
||||
node.InsertAfter(insertedNode)
|
||||
|
||||
if treenode.IsUnderFoldedHeading(insertedNode) {
|
||||
// 保持在标题下的折叠状态
|
||||
insertedNode.SetIALAttr("fold", "1")
|
||||
insertedNode.SetIALAttr("heading-fold", "1")
|
||||
}
|
||||
} else {
|
||||
node = treenode.GetNodeInTree(tree, operation.ParentID)
|
||||
if nil == node {
|
||||
|
|
@ -1459,6 +1465,12 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) {
|
|||
oldNode.InsertAfter(updatedNode)
|
||||
oldNode.Unlink()
|
||||
|
||||
if treenode.IsUnderFoldedHeading(updatedNode) {
|
||||
// 保持在标题下的折叠状态
|
||||
updatedNode.SetIALAttr("fold", "1")
|
||||
updatedNode.SetIALAttr("heading-fold", "1")
|
||||
}
|
||||
|
||||
createdUpdated(updatedNode)
|
||||
|
||||
tx.nodes[updatedNode.ID] = updatedNode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue