From 57ad4b6e71ac0f9d325a31aab00166e167db7440 Mon Sep 17 00:00:00 2001
From: jojohoch <joachim.hoch@iqb.hu-berlin.de>
Date: Fri, 19 Nov 2021 15:27:30 +0100
Subject: [PATCH] [player] Change the registration with the UnitStateService

Since CompoundElementComponent now inherits from ElementComponent,
a case distinction can no longer be made implicitly via the property
domElement.
---
 .../element-container.component.ts                 | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/projects/player/src/app/components/element-container/element-container.component.ts b/projects/player/src/app/components/element-container/element-container.component.ts
index 98fcfcf3d..416ab31ae 100644
--- a/projects/player/src/app/components/element-container/element-container.component.ts
+++ b/projects/player/src/app/components/element-container/element-container.component.ts
@@ -113,7 +113,7 @@ export class ElementContainerComponent implements OnInit {
   }
 
   private registerAtUnitStateService(elementComponent: any): void {
-    if (elementComponent.domElement) {
+    if (!(elementComponent instanceof CompoundElementComponent)) {
       this.unitStateService.registerElement(
         this.initUnitStateValue(elementComponent.elementModel),
         elementComponent.domElement,
@@ -128,13 +128,11 @@ export class ElementContainerComponent implements OnInit {
         .pipe(takeUntil(this.ngUnsubscribe))
         .subscribe((children: QueryList<ElementComponent>) => {
           children.forEach(child => {
-            if (child.domElement) {
-              this.unitStateService.registerElement(
-                this.initUnitStateValue(child.elementModel),
-                child.domElement,
-                this.pageIndex
-              );
-            }
+            this.unitStateService.registerElement(
+              this.initUnitStateValue(child.elementModel),
+              child.domElement,
+              this.pageIndex
+            );
           });
         });
     }
-- 
GitLab