mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 14:42:32 -05:00
add native-modal element
This commit is contained in:
1 parent
d36f40cafd
commit
198a599a2b
5 files changed
+25
-6
No files matched your search
@@ -0,0 +1,17 @@
|
||||
export default class extends HTMLElement {
|
||||
connectedCallback () {
|
||||
document.addEventListener('turbo:submit-end', this.onSubmit)
|
||||
}
|
||||
|
||||
disconnectedCallback () {
|
||||
document.removeEventListener('turbo:submit-end', this.onSubmit)
|
||||
}
|
||||
|
||||
onSubmit = (e) => {
|
||||
if (!e.detail.success || e.detail.fetchResponse?.redirected) return
|
||||
if (this.dataset.closeAfterSubmit === 'false') return
|
||||
if (e.detail.formSubmission?.formElement?.dataset?.closeOnSubmit === 'false') return
|
||||
|
||||
window.webkit?.messageHandlers?.modal?.postMessage({ action: 'submitted' })
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user