🎨 Improve search jump focus block and then exit focus positioning https://github.com/siyuan-note/siyuan/issues/13577

This commit is contained in:
Daniel 2024-12-25 20:19:44 +08:00
parent c24c0d6af7
commit 9e2bab6718
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 40 additions and 0 deletions

View file

@ -257,6 +257,29 @@ func GetBlockSiblingID(id string) (parent, previous, next string) {
return
}
func GetUnfoldedParentID(id string) (parentID string) {
tree, err := LoadTreeByBlockID(id)
if err != nil {
return
}
node := treenode.GetNodeInTree(tree, id)
if nil == node {
return
}
if !node.IsBlock() {
return
}
for parent := treenode.HeadingParent(node); nil != parent && ast.NodeDocument != parent.Type; parent = treenode.HeadingParent(parent) {
if "1" != parent.IALAttr("fold") {
return parent.ID
}
}
return
}
func IsBlockFolded(id string) (isFolded, isRoot bool) {
tree, _ := LoadTreeByBlockID(id)
if nil == tree {