mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-26 18:26:09 +01:00
🎨 Improve av https://github.com/siyuan-note/siyuan/issues/14511
This commit is contained in:
parent
aaf1d9896a
commit
de8eb72393
6 changed files with 35 additions and 36 deletions
|
|
@ -120,15 +120,11 @@ func upgradeSpec1(av *AttributeView) {
|
|||
for _, v := range kv.Values {
|
||||
if 0 == v.Block.Created {
|
||||
logging.LogWarnf("block [%s] created time is empty", v.BlockID)
|
||||
if "" == v.Block.ID {
|
||||
v.Block.ID = v.BlockID
|
||||
if "" == v.Block.ID {
|
||||
v.Block.ID = ast.NewNodeID()
|
||||
v.BlockID = v.Block.ID
|
||||
}
|
||||
if "" == v.BlockID {
|
||||
v.BlockID = ast.NewNodeID()
|
||||
}
|
||||
|
||||
createdStr := v.Block.ID[:len("20060102150405")]
|
||||
createdStr := v.BlockID[:len("20060102150405")]
|
||||
created, parseErr := time.ParseInLocation("20060102150405", createdStr, time.Local)
|
||||
if nil == parseErr {
|
||||
v.Block.Created = created.UnixMilli()
|
||||
|
|
|
|||
|
|
@ -865,21 +865,21 @@ func (filter *ViewFilter) GetAffectValue(key *Key, addingBlockID string) (ret *V
|
|||
case KeyTypeBlock:
|
||||
switch filter.Operator {
|
||||
case FilterOperatorIsEqual:
|
||||
ret.Block = &ValueBlock{ID: addingBlockID, Content: filter.Value.Block.Content, Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
ret.Block = &ValueBlock{Content: filter.Value.Block.Content, Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
case FilterOperatorIsNotEqual:
|
||||
ret.Block = &ValueBlock{ID: addingBlockID, Content: "", Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
ret.Block = &ValueBlock{Content: "", Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
case FilterOperatorContains:
|
||||
ret.Block = &ValueBlock{ID: addingBlockID, Content: filter.Value.Block.Content, Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
ret.Block = &ValueBlock{Content: filter.Value.Block.Content, Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
case FilterOperatorDoesNotContain:
|
||||
ret.Block = &ValueBlock{ID: addingBlockID, Content: "", Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
ret.Block = &ValueBlock{Content: "", Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
case FilterOperatorStartsWith:
|
||||
ret.Block = &ValueBlock{ID: addingBlockID, Content: filter.Value.Block.Content, Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
ret.Block = &ValueBlock{Content: filter.Value.Block.Content, Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
case FilterOperatorEndsWith:
|
||||
ret.Block = &ValueBlock{ID: addingBlockID, Content: filter.Value.Block.Content, Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
ret.Block = &ValueBlock{Content: filter.Value.Block.Content, Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
case FilterOperatorIsEmpty:
|
||||
ret.Block = &ValueBlock{ID: addingBlockID, Content: "", Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
ret.Block = &ValueBlock{Content: "", Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
case FilterOperatorIsNotEmpty:
|
||||
ret.Block = &ValueBlock{ID: addingBlockID, Content: "", Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
ret.Block = &ValueBlock{Content: "", Created: ret.CreatedAt, Updated: ret.UpdatedAt}
|
||||
}
|
||||
case KeyTypeText:
|
||||
switch filter.Operator {
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ func (value *Value) GetValByType(typ KeyType) (ret interface{}) {
|
|||
}
|
||||
|
||||
type ValueBlock struct {
|
||||
ID string `json:"id"`
|
||||
ID string `json:"id"` // 绑定的块 ID,非绑定块时为空
|
||||
Icon string `json:"icon"`
|
||||
Content string `json:"content"`
|
||||
Created int64 `json:"created"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue