🎨 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-29 22:18:05 +08:00
parent 0234549a93
commit 30621f6ecf
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -54,8 +54,9 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
})
headingChildren := treenode.HeadingChildren(heading)
var tmp []*ast.Node
// 过滤掉超级块结束节点
var tmp []*ast.Node
for _, child := range headingChildren {
if ast.NodeSuperBlockCloseMarker == child.Type {
continue
@ -103,6 +104,17 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
targetNode := parentHeading
parentHeadingChildren := treenode.HeadingChildren(parentHeading)
// 找到下方第一个非标题节点
tmp = nil
for _, child := range parentHeadingChildren {
if ast.NodeHeading == child.Type {
break
}
tmp = append(tmp, child)
}
parentHeadingChildren = tmp
if 0 < len(parentHeadingChildren) {
for _, child := range parentHeadingChildren {
if child.ID == headingID {