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/10964

Vanessa8cb40edce36f
diff --git a/app/src/protyle/render/av/groups.ts b/app/src/protyle/render/av/groups.ts
index 2a22ed68fa..5c40c07124 100644
--- a/app/src/protyle/render/av/groups.ts
+++ b/app/src/protyle/render/av/groups.ts
@@ -169,7 +169,7 @@ export const getGroupsHTML = (columns: IAVColumn[], view: IAVView) => {
groupHTML += `<button class="b3-menu__item" draggable="${disabledDrag ? "false" : "true"}">
${disabledDrag ? "" : '<svg class="b3-menu__icon fn__grab"><use xlink:href="#iconDrag"></use></svg>'}
<div class="b3-menu__label fn__flex">${item.name || ""}</div>
- <svg class="b3-menu__action"><use xlink:href="#iconEye${item.groupHidden ? "off" : ""}"></use></svg>
+ <svg class="b3-menu__action" data-type="hideGroup" data-id="${item.id}"><use xlink:href="#iconEye${item.groupHidden ? "off" : ""}"></use></svg>
</button>`;
});
}
diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts
index 3d1c125b7c..a160cd003b 100644
--- a/app/src/protyle/render/av/openMenuPanel.ts
+++ b/app/src/protyle/render/av/openMenuPanel.ts
@@ -1500,6 +1500,33 @@ export const openMenuPanel = (options: {
event.preventDefault();
event.stopPropagation();
break;
+ } else if (type === "hideGroup") {
+ window.siyuan.menus.menu.remove();
+ const useElement = target.firstElementChild;
+ const isHide = useElement.getAttribute("xlink:href") !== "#iconEye";
+ useElement.setAttribute("xlink:href", "#iconEyeoff");
+ transaction(options.protyle, [{
+ action: "hideAttrViewGroup",
+ avID: data.id,
+ blockID,
+ id: target.dataset.id,
+ data: isHide,
+ }], [{
+ action: "hideAttrViewGroup",
+ avID: data.id,
+ blockID,
+ id: target.dataset.id,
+ data: !isHide
+ }]);
+ data.view.groups.find((item) => {
+ if (item.id === target.dataset.id) {
+ item.groupHidden = isHide;
+ return true;
+ }
+ });
+ event.preventDefault();
+ event.stopPropagation();
+ break;
} else if (type === "removeGroups") {
window.siyuan.menus.menu.remove();
transaction(options.protyle, [{
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index 7b3b9a3c56..2e3ee6c80f 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -860,7 +860,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
"updateAttrViewColRelation", "setAttrViewPageSize", "updateAttrViewColRollup", "sortAttrViewKey", "setAttrViewColDesc",
"duplicateAttrViewKey", "setAttrViewViewDesc", "setAttrViewCoverFrom", "setAttrViewCoverFromAssetKeyID",
"setAttrViewBlockView", "setAttrViewCardSize", "setAttrViewCardAspectRatio", "hideAttrViewName", "setAttrViewShowIcon",
- "setAttrViewWrapField", "setAttrViewGroup", "removeAttrViewGroup"].includes(operation.action)) {
+ "setAttrViewWrapField", "setAttrViewGroup", "removeAttrViewGroup", "hideAttrViewGroup"].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 5830eb511d..db39c4bc28 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -66,6 +66,7 @@ type TOperation =
| "setAttrViewGroup"
| "removeAttrViewGroup"
| "syncAttrViewTableColWidth"
+ | "hideAttrViewGroup"
type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins"
type TCardType = "doc" | "notebook" | "all"
type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |