From d3be88723fb7759d71d69c43acc6191b5b5104ae Mon Sep 17 00:00:00 2001
From: jojohoch <joachim.hoch@iqb.hu-berlin.de>
Date: Mon, 23 May 2022 15:18:15 +0200
Subject: [PATCH] Fix `findUIElements` method

- Now only UIElements are found
- HTML parts of the text editor are ignored
---
 projects/common/util/unit-utils.ts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/projects/common/util/unit-utils.ts b/projects/common/util/unit-utils.ts
index 4c0230104..b242c9c2e 100644
--- a/projects/common/util/unit-utils.ts
+++ b/projects/common/util/unit-utils.ts
@@ -1,10 +1,10 @@
-import { UIElement } from 'common/models/elements/element';
+import { UIElement, UIElementType } from 'common/models/elements/element';
 
 export abstract class UnitUtils {
-  static findUIElements(value: any | unknown[], type?: string): UIElement[] {
+  static findUIElements(value: any | unknown[], type?: UIElementType): UIElement[] {
     const elements: UIElement[] = [];
     if (value && typeof value === 'object') {
-      if (type ? value.type === type : value.type) {
+      if (type ? value.type === type : value instanceof UIElement) {
         elements.push(value);
       }
       if (Array.isArray(value)) {
-- 
GitLab