mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-23 00:36:10 +01:00
🎨 Improve av api https://github.com/siyuan-note/siyuan/issues/16715
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
f5167ae895
commit
3c00f5a3d1
2 changed files with 13 additions and 2 deletions
|
|
@ -1203,10 +1203,15 @@ func (tx *Transaction) doInsert0(operation *Operation, tree *parse.Tree) (ret *T
|
|||
remains = append(remains, remain)
|
||||
}
|
||||
}
|
||||
if "" == insertedNode.ID {
|
||||
if !ast.IsNodeIDPattern(insertedNode.ID) {
|
||||
insertedNode.ID = ast.NewNodeID()
|
||||
insertedNode.SetIALAttr("id", insertedNode.ID)
|
||||
}
|
||||
if ast.NodeAttributeView == insertedNode.Type {
|
||||
if !ast.IsNodeIDPattern(insertedNode.AttributeViewID) {
|
||||
insertedNode.AttributeViewID = ast.NewNodeID()
|
||||
}
|
||||
}
|
||||
|
||||
var node *ast.Node
|
||||
nextID := operation.NextID
|
||||
|
|
@ -1783,8 +1788,9 @@ func createdUpdated(node *ast.Node) {
|
|||
|
||||
created := util.TimeFromID(node.ID)
|
||||
updated := node.IALAttr("updated")
|
||||
if "" == updated {
|
||||
if !util.IsTimeStr(updated) {
|
||||
updated = created
|
||||
node.SetIALAttr("updated", updated)
|
||||
}
|
||||
if updated < created {
|
||||
updated = created
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@ import (
|
|||
"github.com/88250/go-humanize"
|
||||
)
|
||||
|
||||
func IsTimeStr(str string) bool {
|
||||
_, err := time.Parse("20060102150405", str)
|
||||
return nil == err
|
||||
}
|
||||
|
||||
func GetTodayStart() (ret time.Time) {
|
||||
ret = time.Now()
|
||||
ret = time.Date(ret.Year(), ret.Month(), ret.Day(), 0, 0, 0, 0, time.Local)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue