From 4e7b49b2c692184e7864bc73acd66f148fee3345 Mon Sep 17 00:00:00 2001 From: Nitin Gupta Date: Wed, 17 Apr 2024 12:54:07 +0530 Subject: [PATCH] annotate repeatable panel --- blocks/form/components/repeat.js | 2 ++ scripts/form-editor-support.js | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/blocks/form/components/repeat.js b/blocks/form/components/repeat.js index 51edaef..cfd3496 100644 --- a/blocks/form/components/repeat.js +++ b/blocks/form/components/repeat.js @@ -111,5 +111,7 @@ export default function transferRepeatableDOM(form) { } div.append(addButton); div.className = 'repeat-wrapper'; + div.parentElement.classList.add('repeatable'); + div.parentElement.dataset.id = el.dataset.id; }); } diff --git a/scripts/form-editor-support.js b/scripts/form-editor-support.js index 3b71a5d..0db934b 100644 --- a/scripts/form-editor-support.js +++ b/scripts/form-editor-support.js @@ -50,7 +50,12 @@ function annotateItems(items, formDefinition, formFieldMap) { if (fieldWrapper.classList.contains("panel-wrapper")) { fieldWrapper.setAttribute('data-aue-type', 'container'); fieldWrapper.setAttribute('data-aue-behavior', 'component'); - annotateItems(fieldWrapper.childNodes, formDefinition, formFieldMap); + if (fieldWrapper.classList.contains("repeatable")) { + let repeatableFieldWrapper = fieldWrapper.querySelector("[data-repeatable='true']"); + annotateItems(repeatableFieldWrapper.childNodes, formDefinition, formFieldMap); + } else { + annotateItems(fieldWrapper.childNodes, formDefinition, formFieldMap); + } } } });