mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-09 02:08:50 +01:00
This commit is contained in:
parent
f3427dcf5f
commit
8cb40edce3
4 changed files with 30 additions and 2 deletions
|
|
@ -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>`;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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, [{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
|
@ -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" |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue