Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Database gallery view https://github.com/siyuan-note/siyuan/issues/10414

Daniel1426d17c5b01
diff --git a/kernel/av/layout_gallery.go b/kernel/av/layout_gallery.go
index 09c255922c..86761c5491 100644
--- a/kernel/av/layout_gallery.go
+++ b/kernel/av/layout_gallery.go
@@ -81,6 +81,13 @@ type ViewGalleryCardField struct {
type Gallery struct {
*BaseInstance
+ CoverFrom CoverFrom `json:"coverFrom"` // 封面来源
+ CoverFromAssetKeyID string `json:"coverFromAssetKeyId,omitempty"` // 资源字段 ID,CoverFrom 为 CoverFromAssetField 时有效
+ CardSize CardSize `json:"cardSize"` // 卡片大小
+ FitImage bool `json:"fitImage"` // 是否适应封面图片大小
+ ShowIcon bool `json:"showIcon"` // 是否显示字段图标
+ WrapField bool `json:"wrapField"` // 是否换行字段内容
+
Fields []*GalleryField `json:"fields"` // 画廊字段
Cards []*GalleryCard `json:"cards"` // 画廊卡片
CardCount int `json:"cardCount"` // 画廊总卡片数
diff --git a/kernel/sql/av_gallery.go b/kernel/sql/av_gallery.go
index e9df968150..d15e3e27fb 100644
--- a/kernel/sql/av_gallery.go
+++ b/kernel/sql/av_gallery.go
@@ -26,8 +26,14 @@ func RenderAttributeViewGallery(attrView *av.AttributeView, view *av.View, query
Filters: view.Gallery.Filters,
Sorts: view.Gallery.Sorts,
},
- Fields: []*av.GalleryField{},
- Cards: []*av.GalleryCard{},
+ CoverFrom: view.Gallery.CoverFrom,
+ CoverFromAssetKeyID: view.Gallery.CoverFromAssetKeyID,
+ CardSize: view.Gallery.CardSize,
+ FitImage: view.Gallery.FitImage,
+ ShowIcon: view.Gallery.ShowIcon,
+ WrapField: view.Gallery.WrapField,
+ Fields: []*av.GalleryField{},
+ Cards: []*av.GalleryCard{},
}
// 组装字段