| | |
| | | if (!item) return; |
| | | |
| | | const uploadId = item.dataset.uploadId; |
| | | const attachmentId = item.dataset.id; |
| | | |
| | | if (!uploadId && !attachmentId) return; |
| | | if (!confirm('Remove this item?')) return; |
| | | await this.removeUpload(uploadId); |
| | | |
| | | if (uploadId) { |
| | | // New upload managed by stores |
| | | await this.removeUpload(uploadId); |
| | | } else { |
| | | // Existing server-rendered attachment |
| | | const fieldId = this.getFieldIdFromElement(button); |
| | | item.remove(); |
| | | if (fieldId) { |
| | | this.maybeLockUploads(fieldId); |
| | | this.notify('attachment-removed', { attachmentId, fieldId }); |
| | | } |
| | | } |
| | | |
| | | this.a11y.announce('Item removed'); |
| | | } |
| | | |