mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 Improve Jump to the next/previous block of the parent block for container blocks https://github.com/siyuan-note/siyuan/issues/15940
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
e38635c1f1
commit
d2f8bccc37
1 changed files with 40 additions and 30 deletions
|
|
@ -257,42 +257,52 @@ func GetBlockSiblingID(id string) (parent, previous, next string) {
|
||||||
current = node
|
current = node
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil != current.Parent && current.Parent.IsBlock() {
|
if nil == current.Parent || !current.Parent.IsBlock() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
parent = current.Parent.ID
|
||||||
|
if flb := treenode.FirstChildBlock(current.Parent); nil != flb {
|
||||||
|
parent = flb.ID
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
if nil != current.Next && current.Next.IsBlock() {
|
||||||
parent = current.Parent.ID
|
next = current.Next.ID
|
||||||
|
if flb := treenode.FirstChildBlock(current.Next); nil != flb {
|
||||||
|
next = flb.ID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if nil != current.Previous && current.Previous.IsBlock() {
|
parentBlock := treenode.ParentBlock(current)
|
||||||
previous = current.Previous.ID
|
for ; nil != parentBlock; parentBlock = treenode.ParentBlock(parentBlock) {
|
||||||
if flb := treenode.FirstChildBlock(current.Previous); nil != flb {
|
if nil != parentBlock.Previous && parentBlock.Previous.IsBlock() {
|
||||||
previous = flb.ID
|
previous = parentBlock.Previous.ID
|
||||||
}
|
if flb := treenode.FirstChildBlock(parentBlock.Previous); nil != flb {
|
||||||
|
previous = flb.ID
|
||||||
}
|
}
|
||||||
|
break
|
||||||
if nil != current.Next && current.Next.IsBlock() {
|
}
|
||||||
next = current.Next.ID
|
}
|
||||||
if flb := treenode.FirstChildBlock(current.Next); nil != flb {
|
parentBlock = treenode.ParentBlock(current)
|
||||||
next = flb.ID
|
for ; nil != parentBlock; parentBlock = treenode.ParentBlock(parentBlock) {
|
||||||
}
|
if nil != parentBlock.Next && parentBlock.Next.IsBlock() {
|
||||||
}
|
next = parentBlock.Next.ID
|
||||||
} else {
|
if flb := treenode.FirstChildBlock(parentBlock.Next); nil != flb {
|
||||||
if nil != current.Parent.Previous && current.Parent.Previous.IsBlock() {
|
next = flb.ID
|
||||||
previous = current.Parent.Previous.ID
|
|
||||||
if flb := treenode.FirstChildBlock(current.Parent.Previous); nil != flb {
|
|
||||||
previous = flb.ID
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue