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