| | |
| | | const grid = element.querySelector('.item-grid'); |
| | | if (grid) { |
| | | grid.dataset.groupId = groupId; |
| | | this.createSortableForGrid(fieldId, grid, groupId); |
| | | this.createSortable(fieldId, grid, groupId); |
| | | } |
| | | |
| | | let storedData = this.stores.groups.data.has(groupId) |
| | |
| | | chosenClass: 'chosen', |
| | | dragClass: 'dragging', |
| | | |
| | | onStart: () => this.syncSortableSelection(fieldId), |
| | | onStart: (evt) => { |
| | | // Get the dragged item's ID |
| | | const draggedItem = evt.item; |
| | | const uploadId = draggedItem?.dataset.uploadId; |
| | | |
| | | // Get the selected items Set for this field |
| | | const selectedItems = this.selected.get(fieldId); |
| | | |
| | | // If the dragged item isn't selected, select it |
| | | if (uploadId && (!selectedItems || !selectedItems.has(uploadId))) { |
| | | const handler = this.selectionHandlers.get(fieldId); |
| | | if (handler) { |
| | | handler.select(uploadId); |
| | | } |
| | | } |
| | | |
| | | // Sync all selections to Sortable |
| | | this.syncSortableSelection(fieldId); |
| | | }, |
| | | onEnd: (evt) => this.sortableDrop(evt, fieldId), |
| | | }); |
| | | |
| | |
| | | }) |
| | | ]); |
| | | |
| | | if (this.restoreModal) { |
| | | this.cleanupRestore(); |
| | | } |
| | | |
| | | this.a11y.announce('Cache cleared for this page'); |
| | | } |
| | | |