mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-21 04:52:40 +00:00
Cleanup the zone combine stuff
This commit is contained in:
7 files changed
+99
-74
No files matched your search
@@ -43,6 +43,15 @@ export function isOcrBuiltinTarget(value: unknown): value is OcrBuiltinTarget {
|
||||
)
|
||||
}
|
||||
|
||||
/** The field a zone writes to, keyed by OcrTemplate.combine_formats. */
|
||||
export function getZoneFieldKey(zone: OcrTemplateZone): string | null {
|
||||
const target = zone.target || DEFAULT_OCR_ZONE_TARGET
|
||||
if (target !== OCR_ZONE_TARGET.CustomField) return target
|
||||
return zone.custom_field === null || zone.custom_field === undefined
|
||||
? null
|
||||
: String(zone.custom_field)
|
||||
}
|
||||
|
||||
/** Custom field types zone OCR can write to. See models.py OCR_SUPPORTED_FIELD_TYPES. */
|
||||
export const OCR_SUPPORTED_FIELD_TYPES: CustomFieldDataType[] = [
|
||||
CustomFieldDataType.String,
|
||||
|
||||
Reference in new issue
Block a user