mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Made attached images clickable — no more fiddling with the spyglass pictogram. Augmented the "Enlarge" button's function to retain it.
This commit is contained in:
@ -575,8 +575,8 @@ export function isExternalMediaAllowed() {
|
||||
return !power_user.forbid_external_media;
|
||||
}
|
||||
|
||||
async function enlargeMessageImage() {
|
||||
const mesBlock = $(this).closest('.mes');
|
||||
function expandMessageImage(event) {
|
||||
const mesBlock = $(event.currentTarget).closest('.mes');
|
||||
const mesId = mesBlock.attr('mesid');
|
||||
const message = chat[mesId];
|
||||
const imgSrc = message?.extra?.image;
|
||||
@ -620,7 +620,12 @@ async function enlargeMessageImage() {
|
||||
popup.completeCancelled();
|
||||
});
|
||||
|
||||
await popup.show();
|
||||
popup.show();
|
||||
return img;
|
||||
}
|
||||
|
||||
function expandAndZoomMessageImage(event) {
|
||||
expandMessageImage(event).click();
|
||||
}
|
||||
|
||||
async function deleteMessageImage() {
|
||||
@ -1603,7 +1608,8 @@ jQuery(function () {
|
||||
reloadCurrentChat();
|
||||
});
|
||||
|
||||
$(document).on('click', '.mes_img_enlarge', enlargeMessageImage);
|
||||
$(document).on('click', '.mes_img.img_inline', expandMessageImage);
|
||||
$(document).on('click', '.mes_img_enlarge', expandAndZoomMessageImage);
|
||||
$(document).on('click', '.mes_img_delete', deleteMessageImage);
|
||||
|
||||
$('#file_form_input').on('change', async () => {
|
||||
|
@ -4990,6 +4990,10 @@ a:hover {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.mes_img.img_inline {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mes_img {
|
||||
border-radius: 10px;
|
||||
max-width: 100%;
|
||||
|
Reference in New Issue
Block a user