| 26 | let paginationMaxLinesPerPage = 2; | 26 | let paginationMaxLinesPerPage = 2; |
| 27 | let galleryMaxRows = 3; | 27 | let galleryMaxRows = 3; |
| 28 | | 28 | |
| | 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 draggable | 31 | const relatedId = $(this).data('related-id'); |
| 31 | $(`#movingDivs > .draggable[id="${relatedId}"]`).remove(); // Remove the associated draggable | 32 | if (!relatedId) return; |
| | 33 | $(`#movingDivs > .draggable[id="${relatedId}"]`).remove(); |
| 32 | }); | 34 | }); |
| 33 | | 35 | |
| 34 | const CUSTOM_GALLERY_REMOVED_EVENT = 'galleryRemoved'; | 36 | const CUSTOM_GALLERY_REMOVED_EVENT = 'galleryRemoved'; |