Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

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

Danielef3b7c50e6e0
diff --git a/kernel/model/block.go b/kernel/model/block.go
index 1c37742803..49efec1a58 100644
--- a/kernel/model/block.go
+++ b/kernel/model/block.go
@@ -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
}