Vanessa 2025-06-25 11:14:23 +08:00
parent 8ef941001e
commit 3c00382811
2 changed files with 10 additions and 6 deletions

View file

@ -104,8 +104,8 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex,
});
galleryHTML += `</div>
<div class="av__gallery-actions">
<span class="protyle-icon protyle-icon--first" data-type="av-gallery-edit"><svg><use xlink:href="#iconEdit"></use></svg></span>
<span class="protyle-icon protyle-icon--last" data-type="av-gallery-more"><svg><use xlink:href="#iconMore"></use></svg></span>
<span class="protyle-icon protyle-icon--first b3-tooltips b3-tooltips__n" aria-label="${window.siyuan.languages.displayEmptyFields}" data-type="av-gallery-edit"><svg><use xlink:href="#iconEdit"></use></svg></span>
<span class="protyle-icon protyle-icon--last b3-tooltips b3-tooltips__n" aria-label="${window.siyuan.languages.more}" data-type="av-gallery-more"><svg><use xlink:href="#iconMore"></use></svg></span>
</div>
</div>`;
});

View file

@ -57,7 +57,7 @@ export const setGalleryCover = (options: {
targetNameElement.textContent = window.siyuan.languages.contentImage;
}
});
let addedSeparator = false
let addedSeparator = false;
options.view.fields.forEach(item => {
if (item.type === "mAsset") {
if (!addedSeparator) {
@ -302,9 +302,13 @@ export const openGalleryItemMenu = (options: {
});
};
export const editGalleryItem = (taget: Element) => {
const itemElement = hasClosestByClassName(taget, "av__gallery-item");
export const editGalleryItem = (target: Element) => {
const itemElement = hasClosestByClassName(target, "av__gallery-item");
if (itemElement) {
itemElement.querySelector(".av__gallery-fields")?.classList.toggle("av__gallery-fields--edit");
const fieldsElement = itemElement.querySelector(".av__gallery-fields");
if (fieldsElement) {
target.setAttribute("aria-label", window.siyuan.languages[fieldsElement.classList.contains("av__gallery-fields--edit") ? "displayEmptyFields" : "hideEmptyFields"]);
fieldsElement.classList.toggle("av__gallery-fields--edit");
}
}
};