Skip to content

Commit

Permalink
Avoid multiple event listener to be stack on the modal confirmation b…
Browse files Browse the repository at this point in the history
…utton
  • Loading branch information
Kévin Gonella committed Apr 24, 2024
1 parent ef2688e commit a98932a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,8 +682,10 @@ global.MonsieurBizRichEditorManager = class {
const modal = document.querySelector('#monsieurbiz-rich-editor-confirmation-modal');
const confirmButton = modal.querySelector('#monsieurbiz-rich-editor-confirmation-button');

confirmButton.addEventListener('click', () => {
callback();
const clonedConfirmButtom = confirmButton.cloneNode(true);
confirmButton.parentNode.replaceChild(clonedConfirmButtom, confirmButton);
clonedConfirmButtom.addEventListener('click', () => {
callback();
})

$(modal).modal('show');
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/public/css/rich-editor-css.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a98932a

Please sign in to comment.