[BUGFIX] Trigger `change` event after calculating slug 18/58218/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Fri, 7 Sep 2018 14:43:09 +0000 (16:43 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 7 Sep 2018 15:50:17 +0000 (17:50 +0200)
When the slug is calculated by using the according button, the `event` is
now triggered to let the user know that the field value has changes and
to invoke the "You have unsaved changes" modal when closing the form.

Resolves: #86190
Related: #86077
Releases: master
Change-Id: I6eb4e11252562f53e637e3a1abdd7b02a8f73a5a
Reviewed-on: https://review.typo3.org/58218
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: rolandgolla <rolandgolla@gmail.com>
Tested-by: rolandgolla <rolandgolla@gmail.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Richard Haeser <richard@maxserv.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SlugElement.js

index 274db09..a9b1d6a 100644 (file)
@@ -143,6 +143,10 @@ define(['jquery'], function ($) {
           SlugElement.$fullElement.find('.t3js-form-proposal-accepted').removeClass('hidden').find('span').text(response.proposal);
           SlugElement.$fullElement.find('.t3js-form-proposal-different').addClass('hidden');
         }
+        const isChanged = SlugElement.$hiddenField.val() !== response.proposal;
+        if (isChanged) {
+          SlugElement.$fullElement.find('input').trigger('change');
+        }
         if (mode === 'auto' || mode === 'recreate') {
           SlugElement.$readOnlyField.val(response.proposal);
           SlugElement.$hiddenField.val(response.proposal);