mirror of
https://github.com/docusealco/docuseal
synced 2026-11-09 15:42:32 -05:00
detect fields autosave false
This commit is contained in:
1 parent
033ce3a169
commit
436d947f6a
2 files changed
+16
-7
No files matched your search
@@ -10,8 +10,14 @@ class TemplatesDetectFieldsController < ApplicationController
|
|||||||
|
|
||||||
sse = SSE.new(response.stream)
|
sse = SSE.new(response.stream)
|
||||||
|
|
||||||
documents = @template.schema_documents.preload(:blob)
|
documents =
|
||||||
documents = documents.where(uuid: params[:attachment_uuid]) if params[:attachment_uuid].present?
|
if params[:attachment_uuid].present?
|
||||||
|
@template.documents.where(uuid: params[:attachment_uuid])
|
||||||
|
else
|
||||||
|
@template.schema_documents
|
||||||
|
end
|
||||||
|
|
||||||
|
documents = documents.preload(:blob)
|
||||||
|
|
||||||
page_number = params[:page].presence&.to_i
|
page_number = params[:page].presence&.to_i
|
||||||
|
|
||||||
|
|||||||
@@ -555,8 +555,10 @@ export default {
|
|||||||
return this.template.schema.some((item) => item.dynamic)
|
return this.template.schema.some((item) => item.dynamic)
|
||||||
},
|
},
|
||||||
numberOfPages () {
|
numberOfPages () {
|
||||||
return this.template.documents.reduce((acc, doc) => {
|
return this.template.schema.reduce((acc, item) => {
|
||||||
return acc + doc.metadata?.pdf?.number_of_pages || doc.preview_images.length
|
const doc = this.template.documents.find((d) => d.uuid === item.attachment_uuid)
|
||||||
|
|
||||||
|
return acc + (doc?.metadata?.pdf?.number_of_pages || doc?.preview_images?.length || 0)
|
||||||
}, 0)
|
}, 0)
|
||||||
},
|
},
|
||||||
isShowFieldSearch () {
|
isShowFieldSearch () {
|
||||||
@@ -774,9 +776,10 @@ export default {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
...(this.withDetectExistingFields
|
body: JSON.stringify({
|
||||||
? { body: JSON.stringify({ fields: this.buildExistingFields() }) }
|
attachment_uuid: this.template.schema.map((item) => item.attachment_uuid),
|
||||||
: {})
|
...(this.withDetectExistingFields ? { fields: this.buildExistingFields() } : {})
|
||||||
|
})
|
||||||
}).then(async (response) => {
|
}).then(async (response) => {
|
||||||
const reader = response.body.getReader()
|
const reader = response.body.getReader()
|
||||||
const decoder = new TextDecoder('utf-8')
|
const decoder = new TextDecoder('utf-8')
|
||||||
|
|||||||
Reference in new issue
Block a user