Vanessa 2025-11-21 21:30:21 +08:00
parent c8033c44b0
commit 41277a9434

View file

@ -39,6 +39,7 @@ import {editGalleryItem, openGalleryItemMenu} from "./gallery/util";
import {clearSelect} from "../../util/clearSelect"; import {clearSelect} from "../../util/clearSelect";
import {removeCompressURL} from "../../../util/image"; import {removeCompressURL} from "../../../util/image";
let foldTimeout: number;
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => { export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
if (isOnlyMeta(event)) { if (isOnlyMeta(event)) {
return false; return false;
@ -228,9 +229,16 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
event.stopPropagation(); event.stopPropagation();
return true; return true;
} else if (type === "av-group-fold") { } else if (type === "av-group-fold") {
if (target.getAttribute("data-folding") !== "true") { const isOpen = target.firstElementChild.classList.contains("av__group-arrow--open");
target.setAttribute("data-folding", "true"); if (isOpen) {
const isOpen = target.firstElementChild.classList.contains("av__group-arrow--open"); target.firstElementChild.classList.remove("av__group-arrow--open");
target.parentElement.nextElementSibling.classList.add("fn__none");
} else {
target.firstElementChild.classList.add("av__group-arrow--open");
target.parentElement.nextElementSibling.classList.remove("fn__none");
}
clearTimeout(foldTimeout);
foldTimeout = window.setTimeout(() => {
transaction(protyle, [{ transaction(protyle, [{
action: "foldAttrViewGroup", action: "foldAttrViewGroup",
avID: blockElement.dataset.avId, avID: blockElement.dataset.avId,
@ -244,14 +252,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
id: target.dataset.id, id: target.dataset.id,
data: !isOpen data: !isOpen
}]); }]);
if (isOpen) { }, Constants.TIMEOUT_TRANSITION);
target.firstElementChild.classList.remove("av__group-arrow--open");
target.parentElement.nextElementSibling.classList.add("fn__none");
} else {
target.firstElementChild.classList.add("av__group-arrow--open");
target.parentElement.nextElementSibling.classList.remove("fn__none");
}
}
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
return true; return true;