An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve `Jump to the next/previous block of the parent block` for container blocks https://github.com/siyuan-note/siyuan/issues/15940
Danield2f8bccc370b
diff --git a/kernel/model/block.go b/kernel/model/block.goindex a977869607..45190431bd 100644--- a/kernel/model/block.go+++ b/kernel/model/block.go@@ -257,42 +257,52 @@ func GetBlockSiblingID(id string) (parent, previous, next string) {current = node}- if nil != current.Parent && current.Parent.IsBlock() {- parent = current.Parent.ID- if flb := treenode.FirstChildBlock(current.Parent); nil != flb {- parent = flb.ID- }+ if nil == current.Parent || !current.Parent.IsBlock() {+ return+ }- if ast.NodeDocument == current.Parent.Type {- parent = current.Parent.ID+ parent = current.Parent.ID+ if flb := treenode.FirstChildBlock(current.Parent); nil != flb {+ parent = flb.ID+ }- if nil != current.Previous && current.Previous.IsBlock() {- previous = current.Previous.ID- if flb := treenode.FirstChildBlock(current.Previous); nil != flb {- previous = flb.ID- }- }+ if ast.NodeDocument == current.Parent.Type {+ parent = current.Parent.ID- if nil != current.Next && current.Next.IsBlock() {- next = current.Next.ID- if flb := treenode.FirstChildBlock(current.Next); nil != flb {- next = flb.ID- }+ if nil != current.Previous && current.Previous.IsBlock() {+ previous = current.Previous.ID+ if flb := treenode.FirstChildBlock(current.Previous); nil != flb {+ previous = flb.ID}- } else {- if nil != current.Parent.Previous && current.Parent.Previous.IsBlock() {- previous = current.Parent.Previous.ID- if flb := treenode.FirstChildBlock(current.Parent.Previous); nil != flb {- previous = flb.ID- }+ }++ if nil != current.Next && current.Next.IsBlock() {+ next = current.Next.ID+ if flb := treenode.FirstChildBlock(current.Next); nil != flb {+ next = flb.ID}+ }+ return+ }- if nil != current.Parent.Next && current.Parent.Next.IsBlock() {- next = current.Parent.Next.ID- if flb := treenode.FirstChildBlock(current.Parent.Next); nil != flb {- next = flb.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+ }+ }+ 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}}return