From 55cfe9dcfc38ccafcec0bc9fcbd4aa0bd3b72b3b Mon Sep 17 00:00:00 2001 From: Mikel Larreategi Date: Mon, 29 May 2023 12:57:45 +0200 Subject: [PATCH] feat: make attachment type field list configurable in config (#59) --- src/components/View.jsx | 4 +++- src/index.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/View.jsx b/src/components/View.jsx index 393fcc9..7da6791 100644 --- a/src/components/View.jsx +++ b/src/components/View.jsx @@ -150,7 +150,9 @@ const View = ({ data, id, path }) => { let name = getFieldName(subblock.label, subblock.id); if (formattedFormData[name]?.value) { formattedFormData[name].field_id = subblock.field_id; - const isAttachment = subblock.field_type === 'attachment'; + const isAttachment = config.blocks.blocksConfig.form.attachment_fields.includes( + subblock.field_type, + ); const isDate = subblock.field_type === 'date'; if (isAttachment) { diff --git a/src/index.js b/src/index.js index 676ed26..8210b24 100644 --- a/src/index.js +++ b/src/index.js @@ -44,6 +44,7 @@ const applyConfig = (config) => { multiple_choice: SelectionSchemaExtender, from: FromSchemaExtender, }, + attachment_fields: ['attachment'], restricted: false, mostUsed: true, security: {