mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🎨 插入块接口加入 nextID 参数 https://github.com/siyuan-note/siyuan/issues/6199
This commit is contained in:
parent
d15c7c5e4c
commit
2a4f533574
3 changed files with 33 additions and 5 deletions
|
|
@ -195,11 +195,18 @@ func CountBlockNodes(node *ast.Node) (ret int) {
|
|||
}
|
||||
|
||||
func ParentNodes(node *ast.Node) (parents []*ast.Node) {
|
||||
const maxDepth = 256
|
||||
i := 0
|
||||
for n := node.Parent; nil != n; n = n.Parent {
|
||||
i++
|
||||
parents = append(parents, n)
|
||||
if ast.NodeDocument == n.Type {
|
||||
return
|
||||
}
|
||||
if maxDepth < i {
|
||||
logging.LogWarnf("parent nodes of node [%s] is too deep", node.ID)
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue