From 73a2ccc2feac403dd602ee12cd76fc1277b6a901 Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Thu, 7 Oct 2021 17:45:02 +0200
Subject: [PATCH] Remove correction compound element

This was an early draft and unused. Will be reintroduced in a proper
form later.
---
 projects/common/app.module.ts                 |  3 --
 projects/common/component-utils.ts            |  3 --
 .../correction.component.ts                   | 35 -------------------
 projects/common/unit.ts                       |  5 ---
 projects/editor/src/app/UnitFactory.ts        |  8 -----
 projects/editor/src/app/unit.service.ts       |  3 --
 6 files changed, 57 deletions(-)
 delete mode 100644 projects/common/element-components/compound-components/correction.component.ts

diff --git a/projects/common/app.module.ts b/projects/common/app.module.ts
index 5cf5531e4..6702bdc8d 100644
--- a/projects/common/app.module.ts
+++ b/projects/common/app.module.ts
@@ -31,7 +31,6 @@ import { RadioButtonGroupComponent } from './element-components/radio-button-gro
 import { ImageComponent } from './element-components/image.component';
 import { VideoComponent } from './element-components/video.component';
 import { AudioComponent } from './element-components/audio.component';
-import { CorrectionComponent } from './element-components/compound-components/correction.component';
 import { SafeResourceUrlPipe } from './element-components/pipes/safe-resource-url.pipe';
 import { InputBackgroundColorDirective } from './element-components/directives/input-background-color.directive';
 import { ErrorTransformPipe } from './element-components/pipes/error-transform.pipe';
@@ -62,7 +61,6 @@ import { ErrorTransformPipe } from './element-components/pipes/error-transform.p
     RadioButtonGroupComponent,
     CheckboxComponent,
     DropdownComponent,
-    CorrectionComponent,
     SafeResourceUrlPipe,
     InputBackgroundColorDirective,
     ErrorTransformPipe
@@ -95,7 +93,6 @@ import { ErrorTransformPipe } from './element-components/pipes/error-transform.p
     RadioButtonGroupComponent,
     CheckboxComponent,
     DropdownComponent,
-    CorrectionComponent,
     MatSnackBarModule,
     MatTooltipModule,
     MatDialogModule,
diff --git a/projects/common/component-utils.ts b/projects/common/component-utils.ts
index c257cdc6c..7ac8d280f 100644
--- a/projects/common/component-utils.ts
+++ b/projects/common/component-utils.ts
@@ -9,7 +9,6 @@ import { RadioButtonGroupComponent } from './element-components/radio-button-gro
 import { ImageComponent } from './element-components/image.component';
 import { AudioComponent } from './element-components/audio.component';
 import { VideoComponent } from './element-components/video.component';
-import { CorrectionComponent } from './element-components/compound-components/correction.component';
 
 export function getComponentFactory(
   elementType: string, componentFactoryResolver: ComponentFactoryResolver
@@ -36,8 +35,6 @@ export function getComponentFactory(
       return componentFactoryResolver.resolveComponentFactory(AudioComponent);
     case 'video':
       return componentFactoryResolver.resolveComponentFactory(VideoComponent);
-    case 'correction':
-      return componentFactoryResolver.resolveComponentFactory(CorrectionComponent);
     default:
       throw new Error('unknown element');
   }
diff --git a/projects/common/element-components/compound-components/correction.component.ts b/projects/common/element-components/compound-components/correction.component.ts
deleted file mode 100644
index 743d76323..000000000
--- a/projects/common/element-components/compound-components/correction.component.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { Component } from '@angular/core';
-import { CompoundElementCorrection } from '../../unit';
-import { FormElementComponent } from '../../form-element-component.directive';
-
-@Component({
-  selector: 'app-correction',
-  template: `
-      <div>
-          <p>
-              {{$any(elementModel).text}}
-          </p>
-          <div *ngFor="let sentence of elementModel.sentences"
-               fxLayout="column">
-              <div fxLayout="row">
-                  <div *ngFor="let word of sentence.split(' ');"
-                       fxLayout="column">
-                      <mat-form-field>
-                          <input matInput type="text"
-                                 [formControl]="elementFormControl">
-                      </mat-form-field>
-                      <div>
-                          {{word}}
-                      </div>
-                  </div>
-              </div>
-          </div>
-      </div>
-  `,
-  styles: [
-    'mat-form-field {margin: 5px}'
-  ]
-})
-export class CorrectionComponent extends FormElementComponent {
-  elementModel!: CompoundElementCorrection;
-}
diff --git a/projects/common/unit.ts b/projects/common/unit.ts
index c8ca01b85..6a81aaec5 100644
--- a/projects/common/unit.ts
+++ b/projects/common/unit.ts
@@ -66,11 +66,6 @@ export interface SurfaceUIElement extends UnitUIElement {
   backgroundColor: string;
 }
 
-export interface CompoundElementCorrection extends UnitUIElement {
-  text: string;
-  sentences : string[];
-}
-
 export interface TextElement extends SurfaceUIElement {
   text: string;
   fontColor: string;
diff --git a/projects/editor/src/app/UnitFactory.ts b/projects/editor/src/app/UnitFactory.ts
index e5df2ab2f..dbd474275 100644
--- a/projects/editor/src/app/UnitFactory.ts
+++ b/projects/editor/src/app/UnitFactory.ts
@@ -203,11 +203,3 @@ export function createVideoElement(videoSrc: string): VideoElement {
     height: 100
   };
 }
-
-export function createCorrectionElement(): CompoundElementCorrection {
-  return {
-    text: 'dummy',
-    sentences: [],
-    ...createUnitUIElement('correction')
-  };
-}
diff --git a/projects/editor/src/app/unit.service.ts b/projects/editor/src/app/unit.service.ts
index c83d97a82..edd06ecfb 100644
--- a/projects/editor/src/app/unit.service.ts
+++ b/projects/editor/src/app/unit.service.ts
@@ -182,9 +182,6 @@ export class UnitService {
       case 'video':
         newElement = UnitFactory.createVideoElement(await FileService.loadVideo());
         break;
-      case 'correction':
-        newElement = UnitFactory.createCorrectionElement();
-        break;
       default:
         throw new Error(`ElementType ${elementType} not found!`);
     }
-- 
GitLab