[BUGFIX] SplitButtons: Abort click event if requested 33/54033/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Thu, 7 Sep 2017 18:13:17 +0000 (20:13 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Fri, 8 Sep 2017 16:09:53 +0000 (18:09 +0200)
If any callback is registered by `SplitButtons.addPreSubmitCallback()` and
requests to stop the event by `stopPropagation()`, the event must be
aborted and not only possibly stacked events.
Additionally, the `preventExec` flag gets reset.

Resolves: #82355
Related: #77942
Releases: master, 8.7, 7.6
Change-Id: Ib8478ef4c51915365c804c1c408b3fc16a13da0b
Reviewed-on: https://review.typo3.org/54033
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/backend/Resources/Public/JavaScript/SplitButtons.js

index 7c11585..888a23b 100644 (file)
@@ -54,6 +54,11 @@ define(['jquery', 'TYPO3/CMS/Backend/Icons'], function($, Icons) {
                                // Run any preSubmit callbacks
                                for (var i = 0; i < SplitButtons.preSubmitCallbacks.length; ++i) {
                                        SplitButtons.preSubmitCallbacks[i](e);
+
+                                       if (e.isPropagationStopped()) {
+                                               preventExec = false;
+                                               return false;
+                                       }
                                }
                                $form.append($elem);
                                // Disable submit buttons