mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 07:18:49 +01:00
🎨 Add asset type column to Attribute View https://github.com/siyuan-note/siyuan/issues/8895
This commit is contained in:
parent
be9d61c757
commit
0c05a06aaa
2 changed files with 142 additions and 13 deletions
|
|
@ -65,6 +65,7 @@ const (
|
|||
KeyTypeURL KeyType = "url"
|
||||
KeyTypeEmail KeyType = "email"
|
||||
KeyTypePhone KeyType = "phone"
|
||||
KeyTypeMAsset KeyType = "asset"
|
||||
)
|
||||
|
||||
// Key 描述了属性视图属性列的基础结构。
|
||||
|
|
@ -107,6 +108,7 @@ type Value struct {
|
|||
URL *ValueURL `json:"url,omitempty"`
|
||||
Email *ValueEmail `json:"email,omitempty"`
|
||||
Phone *ValuePhone `json:"phone,omitempty"`
|
||||
MAsset []*ValueAsset `json:"mAsset,omitempty"`
|
||||
}
|
||||
|
||||
func (value *Value) String() string {
|
||||
|
|
@ -131,6 +133,12 @@ func (value *Value) String() string {
|
|||
return value.Email.Content
|
||||
case KeyTypePhone:
|
||||
return value.Phone.Content
|
||||
case KeyTypeMAsset:
|
||||
var ret []string
|
||||
for _, v := range value.MAsset {
|
||||
ret = append(ret, v.Content)
|
||||
}
|
||||
return strings.Join(ret, " ")
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
|
|
@ -324,6 +332,19 @@ type ValuePhone struct {
|
|||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type AssetType string
|
||||
|
||||
const (
|
||||
AssetTypeFile = "file"
|
||||
AssetTypeImage = "image"
|
||||
)
|
||||
|
||||
type ValueAsset struct {
|
||||
Type AssetType `json:"type"`
|
||||
Name string `json:"name"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
// View 描述了视图的结构。
|
||||
type View struct {
|
||||
ID string `json:"id"` // 视图 ID
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue