Merge pull request #3793 from Erquint/staging

Clickable image attachments — no more fiddling with the spyglass button.
This commit is contained in:
Cohee
2025-04-01 22:26:52 +03:00
committed by GitHub
2 changed files with 11 additions and 4 deletions

View File

@ -575,8 +575,8 @@ export function isExternalMediaAllowed() {
return !power_user.forbid_external_media; return !power_user.forbid_external_media;
} }
async function enlargeMessageImage() { function expandMessageImage(event) {
const mesBlock = $(this).closest('.mes'); const mesBlock = $(event.currentTarget).closest('.mes');
const mesId = mesBlock.attr('mesid'); const mesId = mesBlock.attr('mesid');
const message = chat[mesId]; const message = chat[mesId];
const imgSrc = message?.extra?.image; const imgSrc = message?.extra?.image;
@ -620,7 +620,12 @@ async function enlargeMessageImage() {
popup.completeCancelled(); popup.completeCancelled();
}); });
await popup.show(); popup.show();
return img;
}
function expandAndZoomMessageImage(event) {
expandMessageImage(event).click();
} }
async function deleteMessageImage() { async function deleteMessageImage() {
@ -1603,7 +1608,8 @@ jQuery(function () {
reloadCurrentChat(); reloadCurrentChat();
}); });
$(document).on('click', '.mes_img_enlarge', enlargeMessageImage); $(document).on('click', '.mes_img', expandMessageImage);
$(document).on('click', '.mes_img_enlarge', expandAndZoomMessageImage);
$(document).on('click', '.mes_img_delete', deleteMessageImage); $(document).on('click', '.mes_img_delete', deleteMessageImage);
$('#file_form_input').on('change', async () => { $('#file_form_input').on('change', async () => {

View File

@ -4995,6 +4995,7 @@ a:hover {
max-width: 100%; max-width: 100%;
max-height: 40vh; max-height: 40vh;
image-rendering: -webkit-optimize-contrast; image-rendering: -webkit-optimize-contrast;
cursor: pointer;
} }
.mes_img_swipes, .mes_img_swipes,