Merge pull request #2908 from SillyTavern/gallery-improvements Improve gallery layout

57fdaeba81a3b06b12b64559bf17964b3c91c2df

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
2 files changed, +8 -13Showing whitespace changes
public/scripts/extensions/gallery/index.js+8 -6
@@ -26,9 +26,11 @@ let paginationVisiblePages = 10;
2626let paginationMaxLinesPerPage = 2;
2727let galleryMaxRows = 3;
2828
29-$('body').on('click', '.dragClose', function () {
29+// Remove all draggables associated with the gallery
30- const relatedId = $(this).data('related-id'); // Get the ID of the related draggable
30+$('#movingDivs').on('click', '.dragClose', function () {
31- $(`body > .draggable[id="${relatedId}"]`).remove(); // Remove the associated draggable
31+ const relatedId = $(this).data('related-id');
32+ if (!relatedId) return;
33+ $(`#movingDivs > .draggable[id="${relatedId}"]`).remove();
3234});
3335
3436const CUSTOM_GALLERY_REMOVED_EVENT = 'galleryRemoved';
@@ -290,7 +292,7 @@ function makeMovable(id = 'gallery') {
290292
291293 $('#dragGallery').css('display', 'block');
292294
293295 $('body#movingDivs').append(newElement);
294296
295297 loadMovingUIState();
296298 $(`.draggable[forChar="${id}"]`).css('display', 'block');
@@ -362,8 +364,8 @@ function makeDragImg(id, url) {
362364 }
363365 }
364366
365367 // Step 3: Attach it to the bodymovingDivs container
366368 document.bodygetElementById('movingDivs').appendChild(newElement);
367369
368370 // Step 4: Call dragElement and loadMovingUIState
369371 const appendedElement = document.getElementById(uniqueId);
public/style.css+0 -7
@@ -5386,13 +5386,6 @@ body:not(.movingUI) .drawer-content.maximized {
53865386
53875387/* Jank mobile support for gallery and future draggables */
53885388@media screen and (max-width: 1000px) {
5389- #gallery {
5390- display: block;
5391- width: 100vw;
5392- height: 100vh;
5393- z-index: 9999;
5394- }
5395-
53965389 .draggable {
53975390 display: block;
53985391 width: 100vw;