mirror of
https://github.com/docusealco/docuseal
synced 2026-11-05 06:42:32 -05:00
review fixes
This commit is contained in:
1 parent
d071e8c429
commit
e11f4bddbe
40 files changed
+299
-192
No files matched your search
@@ -8,7 +8,7 @@ export default class extends HTMLElement {
|
||||
document.removeEventListener('turbo:submit-end', this.onSubmit)
|
||||
}
|
||||
|
||||
onSubmit = (e) => {
|
||||
onSubmit = async (e) => {
|
||||
if (!e.detail.success) return
|
||||
if (e.detail.fetchResponse?.redirected && e.detail.fetchResponse.location.href !== window.location.href) return
|
||||
if (e.detail.formSubmission?.formElement?.method === 'get') return
|
||||
@@ -16,7 +16,19 @@ export default class extends HTMLElement {
|
||||
if (e.detail.formSubmission?.formElement?.dataset?.closeOnSubmit === 'false') return
|
||||
if (e.detail.formSubmission?.formElement?.closest('native-event[data-on="submit"]')) return
|
||||
|
||||
window.webkit?.messageHandlers?.modal?.postMessage({ action: 'submitted' })
|
||||
const flash = await this.flashFrom(e.detail.fetchResponse)
|
||||
|
||||
window.webkit?.messageHandlers?.modal?.postMessage({ action: 'submitted', ...flash })
|
||||
}
|
||||
|
||||
async flashFrom (fetchResponse) {
|
||||
const html = await fetchResponse?.responseHTML
|
||||
const flash = html && new DOMParser().parseFromString(html, 'text/html').getElementById('native_flash')
|
||||
|
||||
if (flash?.dataset.alert) return { alert: flash.dataset.alert }
|
||||
if (flash?.dataset.notice) return { notice: flash.dataset.notice }
|
||||
|
||||
return {}
|
||||
}
|
||||
|
||||
onClick = () => {
|
||||
|
||||
Reference in new issue
Block a user