🐛 Abnormal heading block update time https://github.com/siyuan-note/siyuan/issues/11985
This commit is contained in:
parent
509beee56d
commit
6901bc935f
1 changed files with 9 additions and 6 deletions
|
@ -18,6 +18,9 @@ package treenode
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/88250/lute"
|
||||
"github.com/88250/lute/ast"
|
||||
|
@ -26,12 +29,9 @@ import (
|
|||
"github.com/88250/lute/parse"
|
||||
"github.com/88250/lute/render"
|
||||
"github.com/88250/vitess-sqlparser/sqlparser"
|
||||
"github.com/emirpasic/gods/sets/hashset"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/cache"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func GetEmbedBlockRef(embedNode *ast.Node) (blockRefID string) {
|
||||
|
@ -229,7 +229,6 @@ func CountBlockNodes(node *ast.Node) (ret int) {
|
|||
func ParentNodesWithHeadings(node *ast.Node) (parents []*ast.Node) {
|
||||
const maxDepth = 255
|
||||
i := 0
|
||||
headingIDs := hashset.New()
|
||||
for n := node; nil != n; n = n.Parent {
|
||||
parent := n.Parent
|
||||
if maxDepth < i {
|
||||
|
@ -246,9 +245,13 @@ func ParentNodesWithHeadings(node *ast.Node) (parents []*ast.Node) {
|
|||
// The heading block update time is refreshed after editing the blocks under the heading https://github.com/siyuan-note/siyuan/issues/11374
|
||||
parentHeadingLevel := 7
|
||||
for prev := n.Previous; nil != prev; prev = prev.Previous {
|
||||
if ast.NodeHeading == prev.Type && prev.HeadingLevel < parentHeadingLevel && !headingIDs.Contains(prev.ID) {
|
||||
if ast.NodeHeading == prev.Type {
|
||||
if prev.HeadingLevel >= parentHeadingLevel {
|
||||
break
|
||||
}
|
||||
|
||||
parents = append(parents, prev)
|
||||
headingIDs.Add(prev.ID)
|
||||
parentHeadingLevel = prev.HeadingLevel
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue