🎨 Improve block update time filling https://github.com/siyuan-note/siyuan/issues/12182
This commit is contained in:
parent
3cbb6138ed
commit
27c19ba396
1 changed files with 20 additions and 1 deletions
|
@ -1253,13 +1253,32 @@ func refreshUpdated(node *ast.Node) {
|
|||
}
|
||||
|
||||
func createdUpdated(node *ast.Node) {
|
||||
// 补全子节点的更新时间 Improve block update time filling https://github.com/siyuan-note/siyuan/issues/12182
|
||||
ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering || !n.IsBlock() || ast.NodeKramdownBlockIAL == n.Type {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
updated := n.IALAttr("updated")
|
||||
if "" == updated && ast.IsNodeIDPattern(n.ID) {
|
||||
created := util.TimeFromID(n.ID)
|
||||
updated = created
|
||||
if updated < created {
|
||||
updated = created
|
||||
}
|
||||
|
||||
n.SetIALAttr("updated", updated)
|
||||
}
|
||||
return ast.WalkContinue
|
||||
})
|
||||
|
||||
created := util.TimeFromID(node.ID)
|
||||
updated := node.IALAttr("updated")
|
||||
if "" == updated {
|
||||
updated = created
|
||||
}
|
||||
if updated < created {
|
||||
updated = created // 复制粘贴块后创建时间小于更新时间 https://github.com/siyuan-note/siyuan/issues/3624
|
||||
updated = created
|
||||
}
|
||||
parents := treenode.ParentNodesWithHeadings(node)
|
||||
for _, parent := range parents { // 更新所有父节点的更新时间字段
|
||||
|
|
Loading…
Add table
Reference in a new issue