🎨 The outline item in the outline panel supports dragging to adjust the level and position https://github.com/siyuan-note/siyuan/issues/7957

This commit is contained in:
Daniel 2024-03-27 22:26:47 +08:00
parent 611f6e2da0
commit f2f112cebe
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017

View File

@ -64,13 +64,17 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
previousHeadingChildren := treenode.HeadingChildren(previousHeading) previousHeadingChildren := treenode.HeadingChildren(previousHeading)
if 0 < len(previousHeadingChildren) { if 0 < len(previousHeadingChildren) {
for _, child := range previousHeadingChildren { for _, child := range previousHeadingChildren {
targetNode = child
if child.ID == headingID { if child.ID == headingID {
break break
} }
targetNode = child
} }
} }
if targetNode == heading.Previous {
return
}
diffLevel := heading.HeadingLevel - previousHeading.HeadingLevel diffLevel := heading.HeadingLevel - previousHeading.HeadingLevel
heading.HeadingLevel = previousHeading.HeadingLevel heading.HeadingLevel = previousHeading.HeadingLevel
@ -92,10 +96,16 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
parentHeadingChildren := treenode.HeadingChildren(parentHeading) parentHeadingChildren := treenode.HeadingChildren(parentHeading)
if 0 < len(parentHeadingChildren) { if 0 < len(parentHeadingChildren) {
for _, child := range parentHeadingChildren { for _, child := range parentHeadingChildren {
targetNode = child
if child.ID == headingID { if child.ID == headingID {
break break
} }
targetNode = child
}
}
if targetNode == heading.Previous {
if parentHeading.HeadingLevel < heading.HeadingLevel {
return
} }
} }