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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ast.NodeListItem != parentBlock.Type {
|
parentCount := 0
|
||||||
if parentBlock = treenode.ParentBlock(parentBlock); nil != parentBlock {
|
for ; nil != parentBlock; parentBlock = treenode.ParentBlock(parentBlock) {
|
||||||
parent = parentBlock.ID
|
if ast.NodeDocument == parentBlock.Type {
|
||||||
if ast.NodeDocument == parentBlock.Type {
|
break
|
||||||
parent = treenode.FirstLeafBlock(parentBlock).ID
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
parentBlock = treenode.ParentBlock(current)
|
||||||
for ; nil != parentBlock; parentBlock = treenode.ParentBlock(parentBlock) {
|
for ; nil != parentBlock; parentBlock = treenode.ParentBlock(parentBlock) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue