mirror of
https://github.com/docusealco/docuseal
synced 2026-11-11 23:42:32 -05:00
adjust autosave
This commit is contained in:
1 parent
87f6878eda
commit
b99e5d1262
2 files changed
+20
-3
No files matched your search
@@ -415,9 +415,9 @@
|
|||||||
<a
|
<a
|
||||||
:href="`/templates/${template.id}/form`"
|
:href="`/templates/${template.id}/form`"
|
||||||
:data-native-actions="template.submitters.length > 1 ? 'users' : null"
|
:data-native-actions="template.submitters.length > 1 ? 'users' : null"
|
||||||
data-turbo="false"
|
data-turbo-prefetch="false"
|
||||||
class="flex items-center justify-center space-x-2"
|
class="flex items-center justify-center space-x-2"
|
||||||
@click.exact="isPreviewLoading = true"
|
@click.exact="onSaveAndPreviewClick"
|
||||||
>
|
>
|
||||||
<IconInnerShadowTop
|
<IconInnerShadowTop
|
||||||
v-if="isPreviewLoading"
|
v-if="isPreviewLoading"
|
||||||
@@ -2253,6 +2253,23 @@ export default {
|
|||||||
this.insertField(field)
|
this.insertField(field)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onSaveAndPreviewClick (event) {
|
||||||
|
this.isPreviewLoading = true
|
||||||
|
|
||||||
|
if (!this.autosave) {
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
|
const dynamicDocumentRefs = this.documentRefs.filter((ref) => ref.isDynamic)
|
||||||
|
|
||||||
|
dynamicDocumentRefs.forEach((ref) => ref.update())
|
||||||
|
|
||||||
|
this.rebuildVariablesSchema({ disable: false })
|
||||||
|
|
||||||
|
Promise.all([this.save({ force: true }), ...dynamicDocumentRefs.map((ref) => ref.saveBody())]).then(() => {
|
||||||
|
window.Turbo.visit(`/templates/${this.template.id}/form`)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
onBeforeUnload (event) {
|
onBeforeUnload (event) {
|
||||||
if (this.hasUnsavedChanges) {
|
if (this.hasUnsavedChanges) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</submit-form>
|
</submit-form>
|
||||||
</form>
|
</form>
|
||||||
<% end %>
|
<% end %>
|
||||||
<a href="<%= edit_template_path(@template) %>" class="base-button" data-turbo="false" style="flex-shrink: 0; padding: 0px 24px;">
|
<a href="<%= edit_template_path(@template) %>" class="base-button" data-turbo-prefetch="false" style="flex-shrink: 0; padding: 0px 24px;">
|
||||||
<%= t('exit_preview') %>
|
<%= t('exit_preview') %>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user