Skip to content

Commit

Permalink
fix: add disable element for turbo submits
Browse files Browse the repository at this point in the history
  • Loading branch information
KonnorRogers committed Oct 9, 2021
1 parent 6ce0f91 commit ecdbb45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/elementDisabler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ export function ElementDisabler (): MrujsPluginInterface {
}

function getQueries (): EventQueryInterface[] {
const { formInputClickSelector, formSubmitSelector, linkClickSelector, buttonClickSelector, inputChangeSelector } = window.mrujs.querySelectors
const { formSubmitSelector, linkClickSelector, buttonClickSelector, inputChangeSelector } = window.mrujs.querySelectors

return [
{ event: 'click', selectors: [buttonClickSelector.selector, linkClickSelector.selector, formInputClickSelector.selector] },
{ event: 'click', selectors: [buttonClickSelector.selector, linkClickSelector.selector] },
{ event: 'ajax:send', selectors: [formSubmitSelector.selector] },
{ event: 'turbo:submit-start', selectors: ['form'] },
{ event: 'change', selectors: [inputChangeSelector.selector] }
]
}
Expand Down
3 changes: 2 additions & 1 deletion src/elementEnabler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function getQueries (): EventQueryInterface[] {
formSubmitSelector.selector, inputChangeSelector.selector]
return [
{ event: AJAX_EVENTS.ajaxComplete, selectors: selectors },
{ event: AJAX_EVENTS.ajaxStopped, selectors: selectors }
{ event: AJAX_EVENTS.ajaxStopped, selectors: selectors },
{ event: 'turbo:submit-end', selectors: selectors }
]
}

Expand Down

0 comments on commit ecdbb45

Please sign in to comment.