Vanessa 2025-08-06 10:09:29 +08:00
parent 3d0068f3fb
commit 6b79e543a4

View file

@ -1555,13 +1555,19 @@ export const openMenuPanel = (options: {
const isHide = useElement.getAttribute("xlink:href") !== "#iconEye";
useElement.setAttribute("xlink:href", isHide ? "#iconEye" : "#iconEyeoff");
let oldGroupHidden;
data.view.groups.find((item) => {
let showCount = 0;
data.view.groups.forEach((item) => {
if (item.id === target.dataset.id) {
oldGroupHidden = item.groupHidden;
item.groupHidden = isHide ? 2 : 0;
return true;
}
if (item.groupHidden === 0) {
showCount++;
}
});
menuElement.querySelector('[data-type="hideGroups"]').innerHTML = `${window.siyuan.languages[showCount <= data.view.groups.length ? "hideAll" : "showAll"]}
<span class="fn__space"></span>
<svg><use xlink:href="#iconEye${showCount <= data.view.groups.length ? "off" : ""}"></use></svg>`;
transaction(options.protyle, [{
action: "hideAttrViewGroup",
avID: data.id,
@ -1580,8 +1586,7 @@ export const openMenuPanel = (options: {
break;
} else if (type === "hideGroups") {
window.siyuan.menus.menu.remove();
const useElement = target.querySelector("use");
const isShow = useElement.getAttribute("xlink:href") === "#iconEyeoff";
const isShow = target.querySelector("use").getAttribute("xlink:href") === "#iconEyeoff";
target.innerHTML = `${window.siyuan.languages[isShow ? "showAll" : "hideAll"]}
<span class="fn__space"></span>
<svg><use xlink:href="#iconEye${isShow ? "" : "off"}"></use></svg>`;