[BUGFIX] Change the order of the AJAX Request for image cropping 80/56380/3
authorGiuseppe Cavallaro <giuseppe.cavallaro@brain-appeal.com>
Tue, 20 Mar 2018 12:41:57 +0000 (13:41 +0100)
committerFrank Naegler <frank.naegler@typo3.org>
Thu, 29 Mar 2018 13:35:02 +0000 (15:35 +0200)
It ensures that the request will not be overwritten by the spinning icon
on fast servers.

Before the changes, the image cropping tool triggered a Console Error
"Uncaught TypeError: Cannot read property 'cropArea' of undefined at
ImageManipulation.init (ImageManipulation.js)."

Resolves: #84499
Releases: master, 8.7
Change-Id: Ic2208ba43d0976a1ba9674d68e5d861e89619d1a
Reviewed-on: https://review.typo3.org/56380
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/backend/Resources/Public/JavaScript/Modal.js

index 100fc95..cdc7661 100644 (file)
@@ -295,15 +295,15 @@ define(['jquery',
 
     // Add content
     if (type === 'ajax') {
-      $.get(content, function(response) {
-        Modal.currentModal.find(ajaxTarget ? ajaxTarget : Modal.identifiers.body).empty().append(response);
-        if (ajaxCallback) {
-          ajaxCallback();
-        }
-        Modal.currentModal.trigger('modal-loaded');
-      }, 'html');
       Icons.getIcon('spinner-circle', Icons.sizes.default, null, null, Icons.markupIdentifiers.inline).done(function(icon) {
         currentModal.find(Modal.identifiers.body).html('<div class="modal-loading">' + icon + '</div>');
+        $.get(content, function(response) {
+          Modal.currentModal.find(ajaxTarget ? ajaxTarget : Modal.identifiers.body).empty().append(response);
+          if (ajaxCallback) {
+            ajaxCallback();
+          }
+          Modal.currentModal.trigger('modal-loaded');
+        }, 'html');
       });
     } else if (type === 'iframe') {
       currentModal.find(Modal.identifiers.body).append(