补充好友和图片预览说明注释
This commit is contained in:
@@ -36,6 +36,7 @@ export function openChatImageLightbox(imageUrl, imageName = "聊天图片") {
|
||||
* @returns {void}
|
||||
*/
|
||||
export function closeChatImageLightbox(event = null) {
|
||||
// 遮罩点击才能关闭;点击预览图本身时保持打开,避免误关。
|
||||
if (event && event.target !== event.currentTarget) {
|
||||
return;
|
||||
}
|
||||
@@ -73,12 +74,14 @@ export function initChatImageLightboxEvents() {
|
||||
|
||||
const imagePreview = event.target.closest("[data-chat-image-lightbox-image]");
|
||||
if (imagePreview) {
|
||||
// 图片节点自己不触发关闭,关闭按钮和遮罩由其他分支处理。
|
||||
return;
|
||||
}
|
||||
|
||||
const opener = event.target.closest("[data-chat-image-lightbox-open]");
|
||||
if (opener) {
|
||||
event.preventDefault();
|
||||
// data-full 优先使用原图地址,href 作为旧链接结构的兼容兜底。
|
||||
openChatImageLightbox(opener.dataset.full || opener.href, opener.dataset.alt || "聊天图片");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user