From e9914625c59ba9b185f129e7b65fcc115ae36392 Mon Sep 17 00:00:00 2001 From: Gary Passero Date: Mon, 13 Mar 2023 23:12:18 -0400 Subject: [PATCH] Add configuration item to allow application to specify custom method to show the confirm modal --- src/lib/ConfirmationController.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/ConfirmationController.js b/src/lib/ConfirmationController.js index f886cb6..e7d438c 100644 --- a/src/lib/ConfirmationController.js +++ b/src/lib/ConfirmationController.js @@ -6,6 +6,7 @@ export default class ConfirmationController { acceptSelector: '#confirm-accept', denySelector: '.confirm-cancel', animationDuration: 300, + showConfirmCallback: null, contentSlots: { title: { contentAttribute: 'turbo-confirm', @@ -64,6 +65,10 @@ export default class ConfirmationController { #showConfirm(element) { this.#fillSlots(element) this.dialogTarget.classList.add(this.#config.activeClass) + if (this.#config.showConfirmCallback) { + this.#config.showConfirmCallback(this.dialogTarget) + } + this.#setupListeners() }