mirror of
https://github.com/docusealco/docuseal
synced 2026-11-05 14:42:33 -05:00
adjust builder
This commit is contained in:
1 parent
d59776e8f5
commit
a960ea268a
4 files changed
+18
-5
No files matched your search
@@ -2,6 +2,7 @@ export default class extends HTMLElement {
|
||||
connectedCallback () {
|
||||
if (this.dataset.on === 'submit') {
|
||||
document.addEventListener('turbo:submit-end', this.onSubmitEnd)
|
||||
this.addEventListener('turbo:before-fetch-response', this.onBeforeFetchResponse)
|
||||
} else {
|
||||
this.addEventListener('click', this.dispatch)
|
||||
}
|
||||
@@ -9,9 +10,18 @@ export default class extends HTMLElement {
|
||||
|
||||
disconnectedCallback () {
|
||||
document.removeEventListener('turbo:submit-end', this.onSubmitEnd)
|
||||
this.removeEventListener('turbo:before-fetch-response', this.onBeforeFetchResponse)
|
||||
this.removeEventListener('click', this.dispatch)
|
||||
}
|
||||
|
||||
onBeforeFetchResponse = (e) => {
|
||||
const response = e.detail.fetchResponse
|
||||
|
||||
if (window.webkit?.messageHandlers?.modal && response.succeeded && !response.redirected && !response.isHTML) {
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
|
||||
onSubmitEnd = async (e) => {
|
||||
const form = e.detail.formSubmission?.formElement
|
||||
|
||||
|
||||
Reference in new issue
Block a user