mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-02 14:58:49 +01:00
🎨 Card view supports displaying field names https://github.com/siyuan-note/siyuan/issues/15180
This commit is contained in:
parent
78c3479fc3
commit
692665f100
4 changed files with 36 additions and 0 deletions
|
|
@ -514,6 +514,36 @@ func setAttrViewFitImage(operation *Operation) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func (tx *Transaction) doSetAttrViewDisplayFieldName(operation *Operation) (ret *TxErr) {
|
||||
err := setAttrViewDisplayFieldName(operation)
|
||||
if err != nil {
|
||||
return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func setAttrViewDisplayFieldName(operation *Operation) (err error) {
|
||||
attrView, err := av.ParseAttributeView(operation.AvID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
view, err := getAttrViewViewByBlockID(attrView, operation.BlockID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
switch view.LayoutType {
|
||||
case av.LayoutTypeTable:
|
||||
return
|
||||
case av.LayoutTypeGallery:
|
||||
view.Gallery.DisplayFieldName = operation.Data.(bool)
|
||||
}
|
||||
|
||||
err = av.SaveAttributeView(attrView)
|
||||
return
|
||||
}
|
||||
|
||||
func (tx *Transaction) doSetAttrViewCardSize(operation *Operation) (ret *TxErr) {
|
||||
err := setAttrViewCardSize(operation)
|
||||
if err != nil {
|
||||
|
|
@ -2503,6 +2533,7 @@ func (tx *Transaction) doDuplicateAttrViewView(operation *Operation) (ret *TxErr
|
|||
view.Gallery.CoverFromAssetKeyID = masterView.Gallery.CoverFromAssetKeyID
|
||||
view.Gallery.CardSize = masterView.Gallery.CardSize
|
||||
view.Gallery.FitImage = masterView.Gallery.FitImage
|
||||
view.Gallery.DisplayFieldName = masterView.Gallery.DisplayFieldName
|
||||
view.Gallery.ShowIcon = masterView.Gallery.ShowIcon
|
||||
view.Gallery.WrapField = masterView.Gallery.WrapField
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue