🎨 Card view supports displaying field names https://github.com/siyuan-note/siyuan/issues/15180

This commit is contained in:
Daniel 2025-08-21 11:25:15 +08:00
parent ed4cc1faf6
commit 6270d55fa3
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 5 additions and 7 deletions

View file

@ -190,12 +190,12 @@ export const bindLayoutEvent = (options: {
const blockID = options.blockElement.getAttribute("data-node-id"); const blockID = options.blockElement.getAttribute("data-node-id");
const checked = toggleNameElement.checked; const checked = toggleNameElement.checked;
transaction(options.protyle, [{ transaction(options.protyle, [{
action: "setDisplayFieldName", action: "setAttrViewDisplayFieldName",
avID, avID,
blockID, blockID,
data: checked data: checked
}], [{ }], [{
action: "setDisplayFieldName", action: "setAttrViewDisplayFieldName",
avID, avID,
blockID, blockID,
data: !checked data: !checked

View file

@ -864,7 +864,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
"duplicateAttrViewKey", "setAttrViewViewDesc", "setAttrViewCoverFrom", "setAttrViewCoverFromAssetKeyID", "duplicateAttrViewKey", "setAttrViewViewDesc", "setAttrViewCoverFrom", "setAttrViewCoverFromAssetKeyID",
"setAttrViewBlockView", "setAttrViewCardSize", "setAttrViewCardAspectRatio", "hideAttrViewName", "setAttrViewShowIcon", "setAttrViewBlockView", "setAttrViewCardSize", "setAttrViewCardAspectRatio", "hideAttrViewName", "setAttrViewShowIcon",
"setAttrViewWrapField", "setAttrViewGroup", "removeAttrViewGroup", "hideAttrViewGroup", "sortAttrViewGroup", "setAttrViewWrapField", "setAttrViewGroup", "removeAttrViewGroup", "hideAttrViewGroup", "sortAttrViewGroup",
"foldAttrViewGroup", "hideAttrViewAllGroups", "setAttrViewFitImage", "setDisplayFieldName"].includes(operation.action)) { "foldAttrViewGroup", "hideAttrViewAllGroups", "setAttrViewFitImage", "setAttrViewDisplayFieldName"].includes(operation.action)) {
if (!isUndo) { if (!isUndo) {
// 撤销 transaction 会进行推送,需使用推送来进行刷新最新数据 https://github.com/siyuan-note/siyuan/issues/13607 // 撤销 transaction 会进行推送,需使用推送来进行刷新最新数据 https://github.com/siyuan-note/siyuan/issues/13607
refreshAV(protyle, operation); refreshAV(protyle, operation);

View file

@ -69,7 +69,7 @@ type TOperation =
| "hideAttrViewGroup" | "hideAttrViewGroup"
| "sortAttrViewGroup" | "sortAttrViewGroup"
| "foldAttrViewGroup" | "foldAttrViewGroup"
| "setDisplayFieldName" | "setAttrViewDisplayFieldName"
type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins" type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins"
type TCardType = "doc" | "notebook" | "all" type TCardType = "doc" | "notebook" | "all"
type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" | type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |

View file

@ -790,8 +790,6 @@ func setAttrViewDisplayFieldName(operation *Operation) (err error) {
} }
err = av.SaveAttributeView(attrView) err = av.SaveAttributeView(attrView)
ReloadAttrView(operation.AvID)
return return
} }

View file

@ -287,7 +287,7 @@ func performTx(tx *Transaction) (ret *TxErr) {
ret = tx.doSetAttrViewCardSize(op) ret = tx.doSetAttrViewCardSize(op)
case "setAttrViewFitImage": case "setAttrViewFitImage":
ret = tx.doSetAttrViewFitImage(op) ret = tx.doSetAttrViewFitImage(op)
case "setDisplayFieldName": case "setAttrViewDisplayFieldName":
ret = tx.doSetAttrViewDisplayFieldName(op) ret = tx.doSetAttrViewDisplayFieldName(op)
case "setAttrViewShowIcon": case "setAttrViewShowIcon":
ret = tx.doSetAttrViewShowIcon(op) ret = tx.doSetAttrViewShowIcon(op)