From 5934555ec6d98057d054fe57b2201b6ebd80f469 Mon Sep 17 00:00:00 2001 From: Matthew O'Neil Date: Thu, 3 Jul 2025 22:15:16 -0700 Subject: [PATCH] Update gallery expandos Each item in a gallery now refers to the item itself, not the entire gallery. Clicking e.g. an image will open the image in a new window instead of opening the gallery. --- lib/modules/showImages.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/modules/showImages.js b/lib/modules/showImages.js index f181928794..d49e3ad05c 100644 --- a/lib/modules/showImages.js +++ b/lib/modules/showImages.js @@ -1137,7 +1137,7 @@ function generateMedia(options: ExpandoMedia, context: {| href: string |}): Medi if (options.caption) options.caption = DOMPurify.sanitize(options.caption); switch (options.type) { - case 'GALLERY': return new Gallery(options, context); + case 'GALLERY': return new Gallery(options); case 'IMAGE': return new Image(options, context); case 'TEXT': return new Text(options); case 'IFRAME': return new Iframe(options); @@ -1399,7 +1399,7 @@ class Gallery extends Media { rememberResizeWidth: boolean; lastResizedWidth: number; - constructor(options: GalleryMedia, context) { + constructor(options: GalleryMedia) { super(); this.element = galleryTemplate({ @@ -1418,7 +1418,8 @@ class Gallery extends Media { this.ctrlConcurrentIncrease = this.element.querySelector('.res-gallery-increase-concurrent'); this.pieces = options.src.map(src => ({ - generateMedia: () => generateMedia(src, context), + // Use the piece's source, not the gallery's URL, as the context + generateMedia: () => generateMedia(src, { href: src.src }), media: null, wrapper: string.html``, }));