mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
This commit is contained in:
parent
3d0068f3fb
commit
6b79e543a4
1 changed files with 11 additions and 6 deletions
|
@ -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,11 +1586,10 @@ 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>`;
|
||||
<span class="fn__space"></span>
|
||||
<svg><use xlink:href="#iconEye${isShow ? "" : "off"}"></use></svg>`;
|
||||
data.view.groups.forEach((item) => {
|
||||
item.groupHidden = isShow ? 2 : 0;
|
||||
target.parentElement.parentElement.querySelector(`.b3-menu__item[data-id="${item.id}"] .b3-menu__action use`)?.setAttribute("xlink:href", `#iconEye${isShow ? "off" : ""}`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue