From: Andreas Fernandez Date: Sat, 27 Feb 2016 21:17:47 +0000 (+0100) Subject: [FEATURE] Trigger event after modals dismiss X-Git-Tag: TYPO3_8-0-0~77 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/8922a37a146c558940c4cff7315aa07a4b907696 [FEATURE] Trigger event after modals dismiss A new event ``modal-destroyed`` is triggered after modals dismissed. Change-Id: Id05bf17889889bf1bacbd6a6ad3023923899671d Resolves: #73720 Releases: master Reviewed-on: https://review.typo3.org/46933 Reviewed-by: Jan Helke Reviewed-by: Benni Mack Tested-by: Benni Mack --- diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Modal.js b/typo3/sysext/backend/Resources/Public/JavaScript/Modal.js index eed1538e8d92..cb2150e496ef 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Modal.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/Modal.js @@ -228,6 +228,7 @@ define(['jquery', Modal.instances.splice(lastIndex, 1); Modal.currentModal = Modal.instances[lastIndex-1]; } + currentModal.trigger('modal-destroyed'); $(this).remove(); // Keep class modal-open on body tag as long as open modals exist if (Modal.instances.length > 0) { diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-73720-TriggerEventAfterModalWindowDismissed.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-73720-TriggerEventAfterModalWindowDismissed.rst new file mode 100644 index 000000000000..3fb1a481430d --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-73720-TriggerEventAfterModalWindowDismissed.rst @@ -0,0 +1,24 @@ +============================================================ +Feature: #73720 - Trigger event after modal window dismissed +============================================================ + +Description +=========== + +A new event ``modal-destroyed`` has been added that will be triggered after a modal window closed. + + +Impact +====== + +Bind to the event ``modal-destroyed`` to achieve custom actions after the modal dismissed. + +Example code: + +.. code-block:: javascript + + var $modal = Modal.confirm(); // stub code + $modal.on('modal-destroyed', function() { + // Reset the selection + $someCombobox.val(''); + }); \ No newline at end of file