From a45cd24a3fc30fecc369c483f0fa1809ffeebeff Mon Sep 17 00:00:00 2001
From: jojohoch <joachim.hoch@iqb.hu-berlin.de>
Date: Mon, 24 Jan 2022 17:39:25 +0100
Subject: [PATCH] =?UTF-8?q?[editor]=20Add=20=C3=ADds=20of=20drop=20values?=
 =?UTF-8?q?=20when=20duplicating=20cloze=20elements?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 projects/editor/src/app/services/unit.service.ts | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/projects/editor/src/app/services/unit.service.ts b/projects/editor/src/app/services/unit.service.ts
index abecaa6e7..ee7cf5a85 100644
--- a/projects/editor/src/app/services/unit.service.ts
+++ b/projects/editor/src/app/services/unit.service.ts
@@ -221,6 +221,11 @@ export class UnitService {
       if (newElement.type === 'cloze') {
         (newElement as ClozeElement).getChildElements().forEach((childElement: InputElement) => {
           childElement.id = this.idService.getNewID(childElement.type);
+          if ((childElement as UIElement).value instanceof Object) { // replace value Ids with fresh ones (dropList)
+            (childElement as UIElement).value.forEach((valueObject: { id: string }) => {
+              valueObject.id = this.idService.getNewID('value');
+            });
+          }
         });
       }
       section.elements.push(newElement as PositionedElement);
-- 
GitLab