mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +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
20b8566ed8
commit
25ca3be126
1 changed files with 10 additions and 20 deletions
|
|
@ -249,28 +249,18 @@ func GetBlockSiblingID(id string) (parent, previous, next string) {
|
|||
}
|
||||
break
|
||||
}
|
||||
parent = treenode.FirstLeafBlock(parentBlock).ID
|
||||
|
||||
parentBlock = treenode.ParentBlock(current)
|
||||
for ; nil != parentBlock; parentBlock = treenode.ParentBlock(parentBlock) {
|
||||
if nil != parentBlock.Previous && parentBlock.Previous.IsBlock() {
|
||||
previous = parentBlock.Previous.ID
|
||||
if flb := treenode.FirstChildBlock(parentBlock.Previous); nil != flb {
|
||||
previous = flb.ID
|
||||
}
|
||||
break
|
||||
}
|
||||
if ast.NodeDocument == parentBlock.Type {
|
||||
parentBlock = treenode.FirstLeafBlock(parentBlock)
|
||||
parent = parentBlock.ID
|
||||
} else {
|
||||
parent = parentBlock.ID
|
||||
}
|
||||
|
||||
parentBlock = treenode.ParentBlock(current)
|
||||
for ; nil != parentBlock; parentBlock = treenode.ParentBlock(parentBlock) {
|
||||
if nil != parentBlock.Next && parentBlock.Next.IsBlock() {
|
||||
next = parentBlock.Next.ID
|
||||
if flb := treenode.FirstChildBlock(parentBlock.Next); nil != flb {
|
||||
next = flb.ID
|
||||
}
|
||||
break
|
||||
}
|
||||
if nil != parentBlock.Previous {
|
||||
previous = parentBlock.Previous.ID
|
||||
}
|
||||
if nil != parentBlock.Next {
|
||||
next = parentBlock.Next.ID
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue