mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02: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 {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue