Skip to content

Commit

Permalink
🎨 The outline item in the outline panel supports dragging to adjust t…
Browse files Browse the repository at this point in the history
…he level and position #7957
  • Loading branch information
88250 committed Mar 29, 2024
1 parent 0234549 commit 30621f6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion kernel/model/outline.go
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 30621f6

Please sign in to comment.