mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 03:40:04 -06:00
🐛 The folded state of the block under the folded heading is incorrect in some cases https://github.com/siyuan-note/siyuan/issues/15717
This commit is contained in:
@@ -86,13 +86,24 @@ func GetHeadingFold(nodes []*ast.Node) (ret []*ast.Node) {
|
||||
}
|
||||
|
||||
func IsUnderFoldedHeading(node *ast.Node) bool {
|
||||
currentLevel := 7
|
||||
if ast.NodeHeading == node.Type {
|
||||
currentLevel = node.HeadingLevel
|
||||
}
|
||||
for n := node.Previous; nil != n; n = n.Previous {
|
||||
if ast.NodeHeading == n.Type && "1" == n.IALAttr("fold") {
|
||||
if ast.NodeHeading != node.Type {
|
||||
return true
|
||||
if ast.NodeHeading == n.Type {
|
||||
if n.HeadingLevel >= currentLevel {
|
||||
break
|
||||
}
|
||||
if n.HeadingLevel > node.HeadingLevel {
|
||||
return true
|
||||
currentLevel = n.HeadingLevel
|
||||
|
||||
if "1" == n.IALAttr("fold") {
|
||||
if ast.NodeHeading != node.Type {
|
||||
return true
|
||||
}
|
||||
if n.HeadingLevel > node.HeadingLevel {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user