mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01: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:
parent
0a079a39ca
commit
1c57d0b696
1 changed files with 16 additions and 5 deletions
|
|
@ -86,8 +86,18 @@ func GetHeadingFold(nodes []*ast.Node) (ret []*ast.Node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsUnderFoldedHeading(node *ast.Node) bool {
|
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 {
|
for n := node.Previous; nil != n; n = n.Previous {
|
||||||
if ast.NodeHeading == n.Type && "1" == n.IALAttr("fold") {
|
if ast.NodeHeading == n.Type {
|
||||||
|
if n.HeadingLevel >= currentLevel {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
currentLevel = n.HeadingLevel
|
||||||
|
|
||||||
|
if "1" == n.IALAttr("fold") {
|
||||||
if ast.NodeHeading != node.Type {
|
if ast.NodeHeading != node.Type {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -96,6 +106,7 @@ func IsUnderFoldedHeading(node *ast.Node) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue