From 8922a37a146c558940c4cff7315aa07a4b907696 Mon Sep 17 00:00:00 2001 From: Andreas Fernandez <a.fernandez@scripting-base.de> Date: Sat, 27 Feb 2016 22:17:47 +0100 Subject: [PATCH] [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 <typo3@helke.de> Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: Benni Mack <benni@typo3.org> --- .../Resources/Public/JavaScript/Modal.js | 1 + ...-TriggerEventAfterModalWindowDismissed.rst | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Feature-73720-TriggerEventAfterModalWindowDismissed.rst 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 -- GitLab