mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 18:10:12 +01:00
🎨 Improve the behavior of Jump to parent block in lists https://github.com/siyuan-note/siyuan/issues/16516
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
269b4072d5
commit
172615b0e3
1 changed files with 18 additions and 6 deletions
|
|
@ -230,14 +230,26 @@ func GetBlockSiblingID(id string) (parent, previous, next string) {
|
|||
return
|
||||
}
|
||||
|
||||
if ast.NodeListItem != parentBlock.Type {
|
||||
if parentBlock = treenode.ParentBlock(parentBlock); nil != parentBlock {
|
||||
parent = parentBlock.ID
|
||||
parentCount := 0
|
||||
for ; nil != parentBlock; parentBlock = treenode.ParentBlock(parentBlock) {
|
||||
if ast.NodeDocument == parentBlock.Type {
|
||||
break
|
||||
}
|
||||
|
||||
if ast.NodeList == parentBlock.Type || ast.NodeBlockquote == parentBlock.Type || ast.NodeSuperBlock == parentBlock.Type || ast.NodeCallout == parentBlock.Type {
|
||||
parentCount++
|
||||
continue
|
||||
}
|
||||
|
||||
if ast.NodeListItem == parentBlock.Type {
|
||||
if 1 > parentCount {
|
||||
parentBlock = treenode.ParentBlock(parentBlock)
|
||||
}
|
||||
parentBlock = treenode.ParentBlock(parentBlock)
|
||||
}
|
||||
break
|
||||
}
|
||||
parent = treenode.FirstLeafBlock(parentBlock).ID
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parentBlock = treenode.ParentBlock(current)
|
||||
for ; nil != parentBlock; parentBlock = treenode.ParentBlock(parentBlock) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue