Skip to content

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

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

Daniel6270d55fa3bd
diff --git a/app/src/protyle/render/av/layout.ts b/app/src/protyle/render/av/layout.ts
index f983f1e12a..cbdfed9e22 100644
--- a/app/src/protyle/render/av/layout.ts
+++ b/app/src/protyle/render/av/layout.ts
@@ -190,12 +190,12 @@ export const bindLayoutEvent = (options: {
const blockID = options.blockElement.getAttribute("data-node-id");
const checked = toggleNameElement.checked;
transaction(options.protyle, [{
- action: "setDisplayFieldName",
+ action: "setAttrViewDisplayFieldName",
avID,
blockID,
data: checked
}], [{
- action: "setDisplayFieldName",
+ action: "setAttrViewDisplayFieldName",
avID,
blockID,
data: !checked
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index 9fee7f47fe..5b780cbba8 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -864,7 +864,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
"duplicateAttrViewKey", "setAttrViewViewDesc", "setAttrViewCoverFrom", "setAttrViewCoverFromAssetKeyID",
"setAttrViewBlockView", "setAttrViewCardSize", "setAttrViewCardAspectRatio", "hideAttrViewName", "setAttrViewShowIcon",
"setAttrViewWrapField", "setAttrViewGroup", "removeAttrViewGroup", "hideAttrViewGroup", "sortAttrViewGroup",
- "foldAttrViewGroup", "hideAttrViewAllGroups", "setAttrViewFitImage", "setDisplayFieldName"].includes(operation.action)) {
+ "foldAttrViewGroup", "hideAttrViewAllGroups", "setAttrViewFitImage", "setAttrViewDisplayFieldName"].includes(operation.action)) {
if (!isUndo) {
// 撤销 transaction 会进行推送,需使用推送来进行刷新最新数据 https://github.com/siyuan-note/siyuan/issues/13607
refreshAV(protyle, operation);
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 7b2181328c..d1b5d16c3c 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -69,7 +69,7 @@ type TOperation =
| "hideAttrViewGroup"
| "sortAttrViewGroup"
| "foldAttrViewGroup"
- | "setDisplayFieldName"
+ | "setAttrViewDisplayFieldName"
type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins"
type TCardType = "doc" | "notebook" | "all"
type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 07b36a59d2..2e76d041c1 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -790,8 +790,6 @@ func setAttrViewDisplayFieldName(operation *Operation) (err error) {
}
err = av.SaveAttributeView(attrView)
-
- ReloadAttrView(operation.AvID)
return
}
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go
index 1cc4b5afaf..57223ea61e 100644
--- a/kernel/model/transaction.go
+++ b/kernel/model/transaction.go
@@ -287,7 +287,7 @@ func performTx(tx *Transaction) (ret *TxErr) {
ret = tx.doSetAttrViewCardSize(op)
case "setAttrViewFitImage":
ret = tx.doSetAttrViewFitImage(op)
- case "setDisplayFieldName":
+ case "setAttrViewDisplayFieldName":
ret = tx.doSetAttrViewDisplayFieldName(op)
case "setAttrViewShowIcon":
ret = tx.doSetAttrViewShowIcon(op)