Add early return for movingDivs click handler

53dc8702c35976170d0dbef03a0caa0ce4d6fdf1

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

1 files changed, +4 -2Showing whitespace changes
public/scripts/extensions/gallery/index.js+4 -2
@@ -26,9 +26,11 @@ let paginationVisiblePages = 10;
26let paginationMaxLinesPerPage = 2;26let paginationMaxLinesPerPage = 2;
27let galleryMaxRows = 3;27let galleryMaxRows = 3;
2828
29// Remove all draggables associated with the gallery
29$('#movingDivs').on('click', '.dragClose', function () {30$('#movingDivs').on('click', '.dragClose', function () {
30 const relatedId = $(this).data('related-id'); // Get the ID of the related draggable31 const relatedId = $(this).data('related-id');
31 $(`#movingDivs > .draggable[id="${relatedId}"]`).remove(); // Remove the associated draggable32 if (!relatedId) return;
33 $(`#movingDivs > .draggable[id="${relatedId}"]`).remove();
32});34});
3335
34const CUSTOM_GALLERY_REMOVED_EVENT = 'galleryRemoved';36const CUSTOM_GALLERY_REMOVED_EVENT = 'galleryRemoved';