From 94565f7098975a5c2ae454807ef5a0e722a30631 Mon Sep 17 00:00:00 2001 From: Aleksandra Bozek Date: Wed, 6 Nov 2024 09:58:07 +0100 Subject: [PATCH] review fixes pt 3 --- .../public/js/scripts/autogenerate.identifier.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/autogenerate.identifier.js b/src/bundle/Resources/public/js/scripts/autogenerate.identifier.js index 9a9a24a067..078b9788fa 100644 --- a/src/bundle/Resources/public/js/scripts/autogenerate.identifier.js +++ b/src/bundle/Resources/public/js/scripts/autogenerate.identifier.js @@ -1,14 +1,14 @@ (function (doc, ibexa) { const sourceInputs = doc.querySelectorAll('[data-autogenerate-identifier-target-selector]'); - const initAutogenerator = (elements, shouldAutogenerateValue = false) => { + const initAutogenerator = (elements, shouldAutogenerateValue) => { elements.forEach((sourceInput) => { const { autogenerateIdentifierTargetSelector } = sourceInput.dataset; const targetInput = doc.querySelector(autogenerateIdentifierTargetSelector); const identifierAutogenerator = new ibexa.core.SlugValueInputAutogenerator({ sourceInput, targetInput, - shouldAutogenerateValue, + shouldAutogenerateValue: shouldAutogenerateValue || !targetInput.value, }); identifierAutogenerator.init(); @@ -20,9 +20,9 @@ 'ibexa-autogenerate-identifier:init', (event) => { const { fieldNode, shouldAutogenerateValue } = event.detail; - const sourceInputs = fieldNode.querySelectorAll('[data-autogenerate-identifier-target-selector]'); + const sourceFields = fieldNode.querySelectorAll('[data-autogenerate-identifier-target-selector]'); - initAutogenerator(sourceInputs, shouldAutogenerateValue); + initAutogenerator(sourceFields, shouldAutogenerateValue); }, false, );