From b2384bbf76ca204343724874f7cf9cc95f279227 Mon Sep 17 00:00:00 2001 From: Dariusz Szut Date: Tue, 8 Oct 2024 10:20:02 +0200 Subject: [PATCH] IBX-9028: Fixed remove button in binary file field type --- .../public/js/scripts/fieldType/base/base-preview-field.js | 1 - src/bundle/Resources/public/js/scripts/fieldType/ezimage.js | 6 ++++++ .../Resources/public/js/scripts/fieldType/ezimageasset.js | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bundle/Resources/public/js/scripts/fieldType/base/base-preview-field.js b/src/bundle/Resources/public/js/scripts/fieldType/base/base-preview-field.js index 23f94fd7e7..71410d2865 100644 --- a/src/bundle/Resources/public/js/scripts/fieldType/base/base-preview-field.js +++ b/src/bundle/Resources/public/js/scripts/fieldType/base/base-preview-field.js @@ -212,7 +212,6 @@ this.inputField = clonedInput; this.inputField.addEventListener('change', this.handleInputChange, false); this.fieldContainer.querySelector('.ibexa-field-edit__option--remove-media').checked = true; - this.fieldContainer.querySelector('.ibexa-field-edit-preview__image-alt .ibexa-data-source__input').value = ''; this.validator.reinit(); } diff --git a/src/bundle/Resources/public/js/scripts/fieldType/ezimage.js b/src/bundle/Resources/public/js/scripts/fieldType/ezimage.js index 0d6553c09c..e8a402cad4 100644 --- a/src/bundle/Resources/public/js/scripts/fieldType/ezimage.js +++ b/src/bundle/Resources/public/js/scripts/fieldType/ezimage.js @@ -70,6 +70,12 @@ preview.querySelector('.ibexa-field-edit-preview__action--preview').href = URL.createObjectURL(files[0]); this.fieldContainer.querySelector(SELECTOR_INPUT_ALT).dispatchEvent(new CustomEvent(EVENT_CANCEL_ERROR)); } + + resetInputField() { + super.resetInputField(); + + this.fieldContainer.querySelector('.ibexa-field-edit-preview__image-alt .ibexa-data-source__input').value = ''; + } } class EzImageFieldValidator extends ibexa.BaseFileFieldValidator { diff --git a/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js b/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js index 724ea34d5e..d2afae1776 100644 --- a/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js +++ b/src/bundle/Resources/public/js/scripts/fieldType/ezimageasset.js @@ -227,6 +227,7 @@ super.resetInputField(); this.inputDestinationContentId.value = ''; + this.fieldContainer.querySelector('.ibexa-field-edit-preview__image-alt .ibexa-data-source__input').value = ''; } /**