mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-05 12:20:16 +01:00
🎨 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:
parent
1f70336b41
commit
0b20f85793
1 changed files with 8 additions and 2 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue