diff --git a/projects/editor/src/app/components/unit-view/unit-view.component.ts b/projects/editor/src/app/components/unit-view/unit-view.component.ts index 683e21434db50ee7a317bfe5aef26cb632ef60c9..d9087fd597adff7e15464ef6464f237bce39ad69 100644 --- a/projects/editor/src/app/components/unit-view/unit-view.component.ts +++ b/projects/editor/src/app/components/unit-view/unit-view.component.ts @@ -1,5 +1,5 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; -import { Observable, Subject } from 'rxjs'; +import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { UnitService } from '../../unit.service'; import { DialogService } from '../../dialog.service'; @@ -68,12 +68,14 @@ export class UnitViewComponent implements OnInit, OnDestroy { } deletePage(page: UnitPage): void { - this.showConfirmDialog().pipe(takeUntil(this.ngUnsubscribe)).subscribe((result: boolean) => { - if (result) { - this.unitService.deletePage(page); - this.selectedPageIndex -= 1; - } - }); + this.dialogService.showConfirmDialog('Seite löschen?') + .pipe(takeUntil(this.ngUnsubscribe)) + .subscribe((result: boolean) => { + if (result) { + this.unitService.deletePage(page); + this.selectedPageIndex -= 1; + } + }); } updateModel(page: UnitPage, property: string, value: number | boolean, isInputValid: boolean | null = true): void { @@ -87,10 +89,6 @@ export class UnitViewComponent implements OnInit, OnDestroy { } } - showConfirmDialog(): Observable<boolean> { - return this.dialogService.showConfirmDialog(); - } - ngOnDestroy(): void { this.ngUnsubscribe.next(); this.ngUnsubscribe.complete(); diff --git a/projects/editor/src/app/unit.service.ts b/projects/editor/src/app/unit.service.ts index e7551a4b61321d104a8fed56c9e446642507cfeb..3507e80547971a5499d0528594e49a43b2ab9926 100644 --- a/projects/editor/src/app/unit.service.ts +++ b/projects/editor/src/app/unit.service.ts @@ -328,6 +328,7 @@ export class UnitService { } } + /* Silently ignores nonsense reorders! */ private static moveArrayItem(item: unknown, array: unknown[], direction: 'up' | 'down'): void { const oldIndex = array.indexOf(item);