Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/15092

Vanessad77d29cf78ac
diff --git a/app/src/protyle/render/av/layout.ts b/app/src/protyle/render/av/layout.ts
index 5a6df885b2..afcdc236b7 100644
--- a/app/src/protyle/render/av/layout.ts
+++ b/app/src/protyle/render/av/layout.ts
@@ -114,21 +114,6 @@ export const bindLayoutEvent = (options: {
blockID,
data: checked
}]);
- if (checked) {
- options.blockElement.querySelector(".av__title").classList.remove("fn__none");
- } else {
- // hide
- options.blockElement.querySelector(".av__title").classList.add("fn__none");
- }
- if (options.data.viewType === "gallery") {
- const galleryElement = options.blockElement.querySelector(".av__gallery");
- if (checked) {
- galleryElement.classList.remove("av__gallery--top");
- } else {
- // hide
- galleryElement.classList.add("av__gallery--top");
- }
- }
});
if (options.data.viewType !== "gallery") {
return;
diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts
index 3f118bba59..b433411abc 100644
--- a/app/src/protyle/render/av/render.ts
+++ b/app/src/protyle/render/av/render.ts
@@ -485,6 +485,24 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
coverItem.className = "av__gallery-cover av__gallery-cover--" + operation.data;
});
});
+ } else if (operation.action === "hideAttrViewName") {
+ Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.avID}"]`)).forEach((item: HTMLElement) => {
+ if (!operation.data) {
+ item.querySelector(".av__title").classList.remove("fn__none");
+ } else {
+ // hide
+ item.querySelector(".av__title").classList.add("fn__none");
+ }
+ if (item.getAttribute("data-av-type") === "gallery") {
+ const galleryElement = item.querySelector(".av__gallery");
+ if (!operation.data) {
+ galleryElement.classList.remove("av__gallery--top");
+ } else {
+ // hide
+ galleryElement.classList.add("av__gallery--top");
+ }
+ }
+ });
} else {
// 修改表格名 avID 传入到 id 上了 https://github.com/siyuan-note/siyuan/issues/12724
const avID = operation.action === "setAttrViewName" ? operation.id : operation.avID;
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index b795c74734..c5eb6244ee 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -854,7 +854,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
"removeAttrViewView", "setAttrViewViewName", "setAttrViewViewIcon", "duplicateAttrViewView", "sortAttrViewView",
"updateAttrViewColRelation", "setAttrViewPageSize", "updateAttrViewColRollup", "sortAttrViewKey", "setAttrViewColDesc",
"duplicateAttrViewKey", "setAttrViewViewDesc", "setAttrViewCoverFrom", "setAttrViewCoverFromAssetKeyID",
- "setAttrViewBlockView", "setAttrViewCardSize", "setAttrViewCardAspectRatio"].includes(operation.action)) {
+ "setAttrViewBlockView", "setAttrViewCardSize", "setAttrViewCardAspectRatio", "hideAttrViewName"].includes(operation.action)) {
if (!isUndo) {
// 撤销 transaction 会进行推送,需使用推送来进行刷新最新数据 https://github.com/siyuan-note/siyuan/issues/13607
refreshAV(protyle, operation);