Skip to content
Snippets Groups Projects
Commit dd06d50d authored by rhenck's avatar rhenck
Browse files

[editor] Refactoring: Remove unused code move template code to extra file

parent 4d0a284d
No related branches found
No related tags found
No related merge requests found
<app-canvas-section-toolbar
(sectionEditMode)="sectionEditMode = $event">
</app-canvas-section-toolbar>
<app-canvas-toolbar [disabled]="selectedComponentElements.length < 2" (alignElements)="alignElements($event)">
</app-canvas-toolbar>
<div class="canvasFrame" fxLayout="row" [style.padding.px]="page.margin"
[style.background-color]="page.backgroundColor">
<div *ngIf="sectionEditMode" cdkDropList (cdkDropListDropped)="dropSection($event)">
<div #section_component app-canvas-section class="section"
*ngFor="let section of page.sections; let i = index"
[section]="section"
cdkDrag [childrenDraggable]="!sectionEditMode"
[ngStyle]="{border: '1px solid', 'width.px': page.width, 'height.px': section.height}">
</div>
</div>
<div *ngIf="!sectionEditMode" cdkDropListGroup class="section-list">
<div #section_component app-canvas-section class="section"
*ngFor="let section of page.sections; let i = index"
[section]="section" [childrenDraggable]="!sectionEditMode"
(elementSelected)="elementSelected($event)" (click)="selectSection(i)"
cdkDropList cdkDropListSortingDisabled
(cdkDropListDropped)="elementDropped($event)" [cdkDropListData]="section"
[ngStyle]="{
border: i === selectedSectionIndex ? '1px solid': '1px dotted',
'width.px': section.width,
'height.px': section.height,
'background-color': section.backgroundColor}">
</div>
</div>
</div>
......@@ -12,40 +12,7 @@ import { CanvasDragOverlayComponent } from './canvas-drag-overlay.component';
@Component({
selector: 'app-page-canvas',
template: `
<app-canvas-section-toolbar
(sectionEditMode)="sectionEditMode = $event">
</app-canvas-section-toolbar>
<app-canvas-toolbar [disabled]="selectedComponentElements.length < 2" (alignElements)="alignElements($event)">
</app-canvas-toolbar>
<div class="canvasFrame" fxLayout="row" [style.padding.px]="page.margin"
[style.background-color]="page.backgroundColor">
<div *ngIf="sectionEditMode" cdkDropList (cdkDropListDropped)="dropSection($event)">
<div #section_component app-canvas-section class="section"
*ngFor="let section of page.sections; let i = index"
[section]="section"
cdkDrag [childrenDraggable]="!sectionEditMode"
[ngStyle]="{border: '1px solid', 'width.px': page.width, 'height.px': section.height}">
</div>
</div>
<div *ngIf="!sectionEditMode" cdkDropListGroup class="section-list">
<div #section_component app-canvas-section class="section"
*ngFor="let section of page.sections; let i = index"
[section]="section" [childrenDraggable]="!sectionEditMode"
(elementSelected)="elementSelected($event)" (click)="selectSection(i)"
cdkDropList cdkDropListSortingDisabled
(cdkDropListDropped)="elementDropped($event)" [cdkDropListData]="section"
[ngStyle]="{
border: i === selectedSectionIndex ? '1px solid': '1px dotted',
'width.px': section.width,
'height.px': section.height,
'background-color': section.backgroundColor}">
</div>
</div>
</div>
`,
templateUrl: './page-canvas.component.html',
styles: [
'.canvasFrame {background-color: lightgrey; height: 69vh; overflow: auto; width: 100%}',
'.section {position: relative;}'
......
......@@ -3,7 +3,6 @@ import {
} from '@angular/core';
import { Observable, Subscription } from 'rxjs';
import { UnitPage } from '../../../../../../common/unit';
import { UnitService } from '../../../unit.service';
@Component({
selector: 'app-page-view',
......@@ -18,8 +17,6 @@ export class PageViewComponent implements OnInit, OnDestroy {
private pageSubscription!: Subscription;
page!: UnitPage;
constructor(public unitService: UnitService) { }
ngOnInit(): void {
this.pageSubscription = this.pageObservable.subscribe((page: UnitPage) => {
this.page = page;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment