diff --git a/app/javascript/application.js b/app/javascript/application.js
index 2e818759f..d95cc4676 100644
--- a/app/javascript/application.js
+++ b/app/javascript/application.js
@@ -268,6 +268,7 @@ safeRegisterElement('template-builder', class extends HTMLElement {
onSheetSubmit = (e) => {
this.applySubmission(e.detail.form, e.detail.action, e.detail.body, {})
+ this.component.syncNative()
}
onSync = (e) => {
diff --git a/app/javascript/elements/native_event.js b/app/javascript/elements/native_event.js
index 7c0c59669..8faba14d2 100644
--- a/app/javascript/elements/native_event.js
+++ b/app/javascript/elements/native_event.js
@@ -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
diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue
index 32bdb4a6b..5c295acd8 100644
--- a/app/javascript/template_builder/builder.vue
+++ b/app/javascript/template_builder/builder.vue
@@ -119,7 +119,6 @@
:with-signature-id="withSignatureId"
:with-prefillable="withPrefillable"
:only-defined-fields="onlyDefinedFields"
- :with-sticky-submitters="!!nativeView"
:editable="editable"
:scroll-on-edit="false"
@add-field="addField"
@@ -792,7 +791,7 @@
- {{ t('draw_field').replace('{field}', fieldNames[drawField.type]) }}
+ {{ t('draw_field').replace('{field}', fieldNames[drawField.type]) }}
{
- this.isShowAddFieldsPill = !entry.isIntersecting
- })
+ this.isShowAddFieldsPill = !entry.isIntersecting && entry.boundingClientRect.top > 0
+ }, { rootMargin: '0px 100%' })
this.fieldTypesObserver.observe(this.$refs.addFieldsMarker)
}