🎨 Add two shortcuts for block navigation https://github.com/siyuan-note/siyuan/issues/11193

This commit is contained in:
Daniel 2024-04-30 22:34:04 +08:00
parent 7615da1561
commit ef3b7c50e6
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -129,6 +129,25 @@ func GetBlockSiblingID(id string) (parent, previous, next string) {
return
}
var parentList *ast.Node
for p := node.Parent; nil != p; p = p.Parent {
if ast.NodeList == p.Type {
parentList = p
break
}
}
if nil != parentList {
parent = parentList.ID
if node.Previous != nil {
previous = node.Previous.ID
}
if node.Next != nil {
next = node.Next.ID
}
return
}
if nil != node.Parent && node.Parent.IsBlock() {
parent = node.Parent.ID
}