🎨 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:50:03 +08:00
parent 1f70336b41
commit 0b20f85793
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -84,6 +84,9 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
child := headingChildren[i]
if ast.NodeHeading == child.Type {
child.HeadingLevel -= diffLevel
if 6 < child.HeadingLevel {
child.HeadingLevel = 6
}
}
targetNode.InsertAfter(child)
}
@ -111,7 +114,7 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
}
}
diffLevel := heading.HeadingLevel - parentHeading.HeadingLevel
diffLevel := 1
heading.HeadingLevel = parentHeading.HeadingLevel + 1
if 6 < heading.HeadingLevel {
heading.HeadingLevel = 6
@ -120,7 +123,10 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
for i := len(headingChildren) - 1; i >= 0; i-- {
child := headingChildren[i]
if ast.NodeHeading == child.Type {
child.HeadingLevel -= diffLevel
child.HeadingLevel += diffLevel
if 6 < child.HeadingLevel {
child.HeadingLevel = 6
}
}
targetNode.InsertAfter(child)
}