mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +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,13 +86,24 @@ 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 ast.NodeHeading != node.Type {
|
if n.HeadingLevel >= currentLevel {
|
||||||
return true
|
break
|
||||||
}
|
}
|
||||||
if n.HeadingLevel > node.HeadingLevel {
|
currentLevel = n.HeadingLevel
|
||||||
return true
|
|
||||||
|
if "1" == n.IALAttr("fold") {
|
||||||
|
if ast.NodeHeading != node.Type {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if n.HeadingLevel > node.HeadingLevel {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue