From b5e7a901408a5a707ea59da17849f74a0048ea43 Mon Sep 17 00:00:00 2001 From: jojohoch <joachim.hoch@iqb.hu-berlin.de> Date: Tue, 13 Jul 2021 18:48:53 +0200 Subject: [PATCH] [player editor] Rename `CanvasElementComponent` to `FormElementComponent` --- .../page-view/canvas/canvas-drag-overlay.component.ts | 10 ++++------ .../src/app/components/element-overlay.component.ts | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/projects/editor/src/app/components/unit-view/page-view/canvas/canvas-drag-overlay.component.ts b/projects/editor/src/app/components/unit-view/page-view/canvas/canvas-drag-overlay.component.ts index f827ea0f6..1f6f8156d 100644 --- a/projects/editor/src/app/components/unit-view/page-view/canvas/canvas-drag-overlay.component.ts +++ b/projects/editor/src/app/components/unit-view/page-view/canvas/canvas-drag-overlay.component.ts @@ -1,11 +1,8 @@ import { - Component, OnInit, Input, Output, - EventEmitter, - ComponentFactoryResolver, - ViewChild, ViewContainerRef + Component, OnInit, Input, Output, EventEmitter, ComponentFactoryResolver, ViewChild, ViewContainerRef } from '@angular/core'; import { UnitUIElement } from '../../../../../../../common/unit'; -import { CanvasElementComponent } from '../../../../../../../common/canvas-element-component.directive'; +import { FormElementComponent } from '../../../../../../../common/canvas-element-component.directive'; import * as ComponentUtils from '../../../../../../../common/component-utils'; @Component({ @@ -34,8 +31,9 @@ export class CanvasDragOverlayComponent implements OnInit { @Output() elementSelected = new EventEmitter<{ componentElement: CanvasDragOverlayComponent, multiSelect: boolean }>(); + @ViewChild('elementContainer', { read: ViewContainerRef, static: true }) private elementContainer!: ViewContainerRef; - private childComponent!: CanvasElementComponent; + private childComponent!: FormElementComponent; _selected = false; style: Record<string, string> = {}; diff --git a/projects/player/src/app/components/element-overlay.component.ts b/projects/player/src/app/components/element-overlay.component.ts index 453df03a5..6698086ba 100644 --- a/projects/player/src/app/components/element-overlay.component.ts +++ b/projects/player/src/app/components/element-overlay.component.ts @@ -3,7 +3,7 @@ import { } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { UnitUIElement } from '../../../../common/unit'; -import { CanvasElementComponent } from '../../../../common/canvas-element-component.directive'; +import { FormElementComponent } from '../../../../common/canvas-element-component.directive'; import * as ComponentUtils from '../../../../common/component-utils'; @Component({ @@ -24,9 +24,9 @@ export class ElementOverlayComponent implements OnInit { constructor(private componentFactoryResolver: ComponentFactoryResolver) { } ngOnInit(): void { - const componentFactory: ComponentFactory<CanvasElementComponent> = + const componentFactory: ComponentFactory<FormElementComponent> = ComponentUtils.getComponentFactory(this.element.type, this.componentFactoryResolver); - const childComponent: CanvasElementComponent = + const childComponent: FormElementComponent = this.elementContainer.createComponent(componentFactory).instance; childComponent.elementModel = this.element; childComponent.parentForm = this.parentForm; -- GitLab