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

[editor] Improve code style

parent 445a40fe
No related branches found
No related tags found
No related merge requests found
...@@ -3,12 +3,8 @@ import { UnitService } from 'editor/src/app/services/unit-services/unit.service' ...@@ -3,12 +3,8 @@ import { UnitService } from 'editor/src/app/services/unit-services/unit.service'
import { SelectionService } from 'editor/src/app/services/selection.service'; import { SelectionService } from 'editor/src/app/services/selection.service';
import { IDService } from 'editor/src/app/services/id.service'; import { IDService } from 'editor/src/app/services/id.service';
import { import {
CompoundElement, UIElement, CompoundElement, InputElement, PlayerElement, PositionedUIElement,
InputElement, PlayerElement, UIElementProperties, UIElementType, UIElementValue
PositionedUIElement,
UIElement,
UIElementProperties,
UIElementType, UIElementValue
} from 'common/models/elements/element'; } from 'common/models/elements/element';
import { Section } from 'common/models/section'; import { Section } from 'common/models/section';
import { GeometryProperties } from 'common/models/elements/geometry/geometry'; import { GeometryProperties } from 'common/models/elements/geometry/geometry';
...@@ -18,9 +14,7 @@ import { AudioProperties } from 'common/models/elements/media-elements/audio'; ...@@ -18,9 +14,7 @@ import { AudioProperties } from 'common/models/elements/media-elements/audio';
import { VideoProperties } from 'common/models/elements/media-elements/video'; import { VideoProperties } from 'common/models/elements/media-elements/video';
import { ImageProperties } from 'common/models/elements/media-elements/image'; import { ImageProperties } from 'common/models/elements/media-elements/image';
import { import {
PlayerProperties, PlayerProperties, PositionProperties, PropertyGroupGenerators
PositionProperties,
PropertyGroupGenerators
} from 'common/models/elements/property-group-interfaces'; } from 'common/models/elements/property-group-interfaces';
import { ElementFactory } from 'common/util/element.factory'; import { ElementFactory } from 'common/util/element.factory';
import { ReferenceManager } from 'editor/src/app/services/reference-manager'; import { ReferenceManager } from 'editor/src/app/services/reference-manager';
...@@ -52,7 +46,7 @@ export class ElementService { ...@@ -52,7 +46,7 @@ export class ElementService {
try { try {
newElementProperties = await this.prepareElementProps(elementType, section.dynamicPositioning, coordinates); newElementProperties = await this.prepareElementProps(elementType, section.dynamicPositioning, coordinates);
} catch (e) { } catch (e) {
if (e == 'dialogCanceled') return {}; if (e === 'dialogCanceled') return {};
} }
const newElementID = this.idService.getAndRegisterNewID(elementType); const newElementID = this.idService.getAndRegisterNewID(elementType);
section.addElement(ElementFactory.createElement({ section.addElement(ElementFactory.createElement({
...@@ -61,7 +55,7 @@ export class ElementService { ...@@ -61,7 +55,7 @@ export class ElementService {
...newElementProperties, ...newElementProperties,
id: newElementID id: newElementID
}) as PositionedUIElement); }) as PositionedUIElement);
return {newElementID}; return { newElementID };
}, },
rollback: (deletedData: Record<string, unknown>) => { rollback: (deletedData: Record<string, unknown>) => {
this.idService.unregisterID(deletedData.newElementID as string); this.idService.unregisterID(deletedData.newElementID as string);
...@@ -76,19 +70,21 @@ export class ElementService { ...@@ -76,19 +70,21 @@ export class ElementService {
const newElementProperties: Partial<UIElementProperties> = {}; const newElementProperties: Partial<UIElementProperties> = {};
switch (elementType) { switch (elementType) {
case "geometry": case 'geometry':
(newElementProperties as GeometryProperties).appDefinition = (newElementProperties as GeometryProperties).appDefinition =
await firstValueFrom(this.dialogService.showGeogebraAppDefinitionDialog()); await firstValueFrom(this.dialogService.showGeogebraAppDefinitionDialog());
if (!(newElementProperties as GeometryProperties).appDefinition) return Promise.reject('dialogCanceled'); // dialog canceled if (!(newElementProperties as GeometryProperties).appDefinition) {
return Promise.reject('dialogCanceled');
}
break; break;
case "audio": case 'audio':
(newElementProperties as AudioProperties).src = await FileService.loadAudio(); (newElementProperties as AudioProperties).src = await FileService.loadAudio();
break; break;
case "video": case 'video':
(newElementProperties as VideoProperties).src = await FileService.loadVideo(); (newElementProperties as VideoProperties).src = await FileService.loadVideo();
break; break;
case "image": case 'image':
case "hotspot-image": case 'hotspot-image':
(newElementProperties as ImageProperties).src = await FileService.loadImage(); (newElementProperties as ImageProperties).src = await FileService.loadImage();
break; break;
case 'frame': case 'frame':
...@@ -123,13 +119,13 @@ export class ElementService { ...@@ -123,13 +119,13 @@ export class ElementService {
this.unitService.unit.pages[this.selectionService.selectedPageIndex].sections[x.sectionIndex] this.unitService.unit.pages[this.selectionService.selectedPageIndex].sections[x.sectionIndex]
.deleteElement(x.element.id); .deleteElement(x.element.id);
}); });
return {elementSections}; return { elementSections };
} }
return {}; return {};
}, },
rollback: (deletedData: Record<string, unknown>) => { rollback: (deletedData: Record<string, unknown>) => {
this.unitService.registerIDs(elements); this.unitService.registerIDs(elements);
(deletedData.elementSections as {sectionIndex: number, element: UIElement}[]).forEach(x => { (deletedData.elementSections as { sectionIndex: number, element: UIElement }[]).forEach(x => {
this.unitService.unit this.unitService.unit
.pages[this.selectionService.selectedPageIndex] .pages[this.selectionService.selectedPageIndex]
.sections[x.sectionIndex] .sections[x.sectionIndex]
...@@ -139,12 +135,12 @@ export class ElementService { ...@@ -139,12 +135,12 @@ export class ElementService {
}); });
} }
private findElementsInSections(elements: UIElement[]): {sectionIndex: number, element: UIElement}[] { private findElementsInSections(elements: UIElement[]): { sectionIndex: number, element: UIElement }[] {
const elementSections: {sectionIndex: number, element: UIElement}[] = [] const elementSections: { sectionIndex: number, element: UIElement }[] = [];
elements.forEach(element => { elements.forEach(element => {
this.unitService.unit.pages[this.selectionService.selectedPageIndex].sections.forEach((section, i) => { this.unitService.unit.pages[this.selectionService.selectedPageIndex].sections.forEach((section, i) => {
if (section.elements.map(el => el.id).includes(element.id)) { if (section.elements.map(el => el.id).includes(element.id)) {
elementSections.push({sectionIndex: i, element}); elementSections.push({ sectionIndex: i, element });
} }
}); });
}); });
...@@ -152,7 +148,7 @@ export class ElementService { ...@@ -152,7 +148,7 @@ export class ElementService {
} }
updateElementsProperty(elements: UIElement[], property: string, value: unknown): void { updateElementsProperty(elements: UIElement[], property: string, value: unknown): void {
console.log('updateElementsProperty ', elements, property, value); // console.log('updateElementsProperty ', elements, property, value);
elements.forEach(element => { elements.forEach(element => {
if (property === 'id') { if (property === 'id') {
if (this.idService.validateAndAddNewID(value as string, element.id)) { if (this.idService.validateAndAddNewID(value as string, element.id)) {
...@@ -164,7 +160,9 @@ export class ElementService { ...@@ -164,7 +160,9 @@ export class ElementService {
this.handleClozeDocumentChange(element as ClozeElement, value as ClozeDocument); this.handleClozeDocumentChange(element as ClozeElement, value as ClozeDocument);
} else { } else {
element.setProperty(property, value); element.setProperty(property, value);
if (element.type === 'geometry' && property !== 'trackedVariables') this.unitService.geometryElementPropertyUpdated.next(element.id); if (element.type === 'geometry' && property !== 'trackedVariables') {
this.unitService.geometryElementPropertyUpdated.next(element.id);
}
if (element.type === 'math-table') this.unitService.mathTableElementPropertyUpdated.next(element.id); if (element.type === 'math-table') this.unitService.mathTableElementPropertyUpdated.next(element.id);
if (element.type === 'table') this.unitService.tablePropUpdated.next(element.id); if (element.type === 'table') this.unitService.tablePropUpdated.next(element.id);
} }
...@@ -285,7 +283,7 @@ export class ElementService { ...@@ -285,7 +283,7 @@ export class ElementService {
break; break;
case 'cloze': case 'cloze':
this.dialogService.showClozeTextEditDialog( this.dialogService.showClozeTextEditDialog(
(element as ClozeElement).document!, (element as ClozeElement).document,
(element as ClozeElement).styling.fontSize (element as ClozeElement).styling.fontSize
).subscribe((result: string) => { ).subscribe((result: string) => {
if (result) { if (result) {
...@@ -358,7 +356,8 @@ export class ElementService { ...@@ -358,7 +356,8 @@ export class ElementService {
duplicateSelectedElements(): void { duplicateSelectedElements(): void {
const selectedSection = const selectedSection =
this.unitService.unit.pages[this.selectionService.selectedPageIndex].sections[this.selectionService.selectedSectionIndex]; this.unitService.unit.pages[this.selectionService.selectedPageIndex]
.sections[this.selectionService.selectedSectionIndex];
this.selectionService.getSelectedElements().forEach((element: UIElement) => { this.selectionService.getSelectedElements().forEach((element: UIElement) => {
selectedSection.elements.push(this.duplicateElement(element, true) as PositionedUIElement); selectedSection.elements.push(this.duplicateElement(element, true) as PositionedUIElement);
}); });
...@@ -423,7 +422,6 @@ export class ElementService { ...@@ -423,7 +422,6 @@ export class ElementService {
} }
updateElementsDimensionsProperty(elements: UIElement[], property: string, value: number | null): void { updateElementsDimensionsProperty(elements: UIElement[], property: string, value: number | null): void {
console.log('updateElementsDimensionsProperty', property, value);
elements.forEach(element => { elements.forEach(element => {
element.setDimensionsProperty(property, value); element.setDimensionsProperty(property, value);
}); });
......
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Page } from 'common/models/page'; import { Page } from 'common/models/page';
import { UnitService } from 'editor/src/app/services/unit-services/unit.service'; import { UnitService } from 'editor/src/app/services/unit-services/unit.service';
import { MessageService } from 'editor/src/app/services/message.service';
import { SelectionService } from 'editor/src/app/services/selection.service'; import { SelectionService } from 'editor/src/app/services/selection.service';
import { ArrayUtils } from 'common/util/array'; import { ArrayUtils } from 'common/util/array';
...@@ -10,7 +9,6 @@ import { ArrayUtils } from 'common/util/array'; ...@@ -10,7 +9,6 @@ import { ArrayUtils } from 'common/util/array';
}) })
export class PageService { export class PageService {
constructor(private unitService: UnitService, constructor(private unitService: UnitService,
private messageService: MessageService,
private selectionService: SelectionService) { } private selectionService: SelectionService) { }
addPage(): void { addPage(): void {
...@@ -18,7 +16,7 @@ export class PageService { ...@@ -18,7 +16,7 @@ export class PageService {
title: 'Seite hinzugefügt', title: 'Seite hinzugefügt',
command: () => { command: () => {
this.unitService.unit.pages.push(new Page()); this.unitService.unit.pages.push(new Page());
this.selectionService.selectedPageIndex = this.unitService.unit.pages.length - 1; // TODO selection stuff here is not good this.selectionService.selectedPageIndex = this.unitService.unit.pages.length - 1;
return {}; return {};
}, },
rollback: () => { rollback: () => {
...@@ -46,8 +44,8 @@ export class PageService { ...@@ -46,8 +44,8 @@ export class PageService {
return {}; return {};
}, },
rollback: (deletedData: Record<string, unknown>) => { rollback: (deletedData: Record<string, unknown>) => {
this.unitService.registerIDs((deletedData['deletedpage'] as Page).getAllElements()); this.unitService.registerIDs((deletedData.deletedpage as Page).getAllElements());
this.unitService.unit.pages.splice(deletedData['pageIndex'] as number, 0, deletedData['deletedpage'] as Page); this.unitService.unit.pages.splice(deletedData.pageIndex as number, 0, deletedData.deletedpage as Page);
this.unitService.updateSectionCounter(); this.unitService.updateSectionCounter();
} }
}); });
...@@ -63,9 +61,9 @@ export class PageService { ...@@ -63,9 +61,9 @@ export class PageService {
direction === 'left' ? 'up' : 'down' direction === 'left' ? 'up' : 'down'
); );
this.unitService.updateSectionCounter(); this.unitService.updateSectionCounter();
return {direction}; return { direction };
}, },
rollback: (deletedData: Record<string, unknown>) => { rollback: () => {
ArrayUtils.moveArrayItem( ArrayUtils.moveArrayItem(
this.unitService.unit.pages[pageIndex], this.unitService.unit.pages[pageIndex],
this.unitService.unit.pages, this.unitService.unit.pages,
......
...@@ -5,7 +5,6 @@ import { Page } from 'common/models/page'; ...@@ -5,7 +5,6 @@ import { Page } from 'common/models/page';
import { Section } from 'common/models/section'; import { Section } from 'common/models/section';
import { PositionedUIElement, UIElement, UIElementValue } from 'common/models/elements/element'; import { PositionedUIElement, UIElement, UIElementValue } from 'common/models/elements/element';
import { ArrayUtils } from 'common/util/array'; import { ArrayUtils } from 'common/util/array';
import { IDService } from 'editor/src/app/services/id.service';
import { VisibilityRule } from 'common/models/visibility-rule'; import { VisibilityRule } from 'common/models/visibility-rule';
import { ElementService } from 'editor/src/app/services/unit-services/element.service'; import { ElementService } from 'editor/src/app/services/unit-services/element.service';
...@@ -15,8 +14,7 @@ import { ElementService } from 'editor/src/app/services/unit-services/element.se ...@@ -15,8 +14,7 @@ import { ElementService } from 'editor/src/app/services/unit-services/element.se
export class SectionService { export class SectionService {
constructor(private unitService: UnitService, constructor(private unitService: UnitService,
private elementService: ElementService, private elementService: ElementService,
private selectionService: SelectionService, private selectionService: SelectionService) { }
private idService: IDService) { }
updateSectionProperty(section: Section, property: string, value: string | number | boolean | VisibilityRule[] | { value: number; unit: string }[]): void { updateSectionProperty(section: Section, property: string, value: string | number | boolean | VisibilityRule[] | { value: number; unit: string }[]): void {
this.unitService.updateUnitDefinition({ this.unitService.updateUnitDefinition({
...@@ -26,7 +24,7 @@ export class SectionService { ...@@ -26,7 +24,7 @@ export class SectionService {
section.setProperty(property, value); section.setProperty(property, value);
if (property === 'ignoreNumbering') this.unitService.updateSectionCounter(); if (property === 'ignoreNumbering') this.unitService.updateSectionCounter();
this.unitService.elementPropertyUpdated.next(); this.unitService.elementPropertyUpdated.next();
return {oldValue}; return { oldValue };
}, },
rollback: (deletedData: Record<string, unknown>) => { rollback: (deletedData: Record<string, unknown>) => {
section.setProperty(property, deletedData.oldValue as UIElementValue); section.setProperty(property, deletedData.oldValue as UIElementValue);
...@@ -39,14 +37,11 @@ export class SectionService { ...@@ -39,14 +37,11 @@ export class SectionService {
this.unitService.updateUnitDefinition({ this.unitService.updateUnitDefinition({
title: 'Abschnitt hinzugefügt', title: 'Abschnitt hinzugefügt',
command: () => { command: () => {
const newSection = section; if (section) this.unitService.registerIDs(section.elements);
if (section) {
this.unitService.registerIDs(section.elements);
}
page.addSection(section, sectionIndex); page.addSection(section, sectionIndex);
this.selectionService.selectedSectionIndex = this.selectionService.selectedSectionIndex =
Math.max(0, this.selectionService.selectedSectionIndex - 1); Math.max(0, this.selectionService.selectedSectionIndex - 1);
return {section, sectionIndex}; return { section, sectionIndex };
}, },
rollback: (deletedData: Record<string, unknown>) => { rollback: (deletedData: Record<string, unknown>) => {
if (deletedData.section) { if (deletedData.section) {
...@@ -73,7 +68,7 @@ export class SectionService { ...@@ -73,7 +68,7 @@ export class SectionService {
this.selectionService.selectedSectionIndex = this.selectionService.selectedSectionIndex =
Math.max(0, this.selectionService.selectedSectionIndex - 1); Math.max(0, this.selectionService.selectedSectionIndex - 1);
this.unitService.updateSectionCounter(); this.unitService.updateSectionCounter();
return {deletedSection: sectionToDelete, pageIndex, sectionIndex}; return { deletedSection: sectionToDelete, pageIndex, sectionIndex };
} }
return {}; return {};
}, },
...@@ -90,7 +85,7 @@ export class SectionService { ...@@ -90,7 +85,7 @@ export class SectionService {
duplicateSection(section: Section, sectionIndex: number): void { duplicateSection(section: Section, sectionIndex: number): void {
const page = this.unitService.getSelectedPage(); const page = this.unitService.getSelectedPage();
this.unitService.updateUnitDefinition({ this.unitService.updateUnitDefinition({
title: `Abschnitt dupliziert`, title: 'Abschnitt dupliziert',
command: () => { command: () => {
const newSection: Section = new Section({ const newSection: Section = new Section({
...section, ...section,
...@@ -101,7 +96,7 @@ export class SectionService { ...@@ -101,7 +96,7 @@ export class SectionService {
this.unitService.updateSectionCounter(); this.unitService.updateSectionCounter();
return {}; return {};
}, },
rollback: (deletedData: Record<string, unknown>) => { rollback: () => {
this.unitService.unregisterIDs(page.sections[sectionIndex + 1].getAllElements()); this.unitService.unregisterIDs(page.sections[sectionIndex + 1].getAllElements());
page.deleteSection(sectionIndex + 1); page.deleteSection(sectionIndex + 1);
this.selectionService.selectedSectionIndex -= 1; this.selectionService.selectedSectionIndex -= 1;
...@@ -113,16 +108,18 @@ export class SectionService { ...@@ -113,16 +108,18 @@ export class SectionService {
moveSection(section: Section, direction: 'up' | 'down'): void { moveSection(section: Section, direction: 'up' | 'down'): void {
const page = this.unitService.getSelectedPage(); const page = this.unitService.getSelectedPage();
this.unitService.updateUnitDefinition({ this.unitService.updateUnitDefinition({
title: `Abschnitt verschoben`, title: 'Abschnitt verschoben',
command: () => { command: () => {
ArrayUtils.moveArrayItem(section, page.sections, direction); ArrayUtils.moveArrayItem(section, page.sections, direction);
direction === 'up' ? this.selectionService.selectedSectionIndex -= 1 : this.selectionService.selectedSectionIndex += 1; direction === 'up' ? this.selectionService.selectedSectionIndex -= 1 :
this.selectionService.selectedSectionIndex += 1;
this.unitService.updateSectionCounter(); this.unitService.updateSectionCounter();
return {}; return {};
}, },
rollback: (deletedData: Record<string, unknown>) => { rollback: () => {
ArrayUtils.moveArrayItem(section, page.sections, direction === 'up' ? 'down' : 'up'); ArrayUtils.moveArrayItem(section, page.sections, direction === 'up' ? 'down' : 'up');
direction === 'up' ? this.selectionService.selectedSectionIndex += 1 : this.selectionService.selectedSectionIndex -= 1; direction === 'up' ? this.selectionService.selectedSectionIndex += 1 :
this.selectionService.selectedSectionIndex -= 1;
this.unitService.updateSectionCounter(); this.unitService.updateSectionCounter();
} }
}); });
...@@ -136,7 +133,7 @@ export class SectionService { ...@@ -136,7 +133,7 @@ export class SectionService {
/* Move element between sections */ /* Move element between sections */
transferElements(elements: UIElement[], previousSection: Section, newSection: Section): void { transferElements(elements: UIElement[], previousSection: Section, newSection: Section): void {
this.unitService.updateUnitDefinition({ this.unitService.updateUnitDefinition({
title: `Element zwischen Abschnitten verschoben`, title: 'Element zwischen Abschnitten verschoben',
command: () => { command: () => {
previousSection.elements = previousSection.elements.filter(element => !elements.includes(element)); previousSection.elements = previousSection.elements.filter(element => !elements.includes(element));
elements.forEach(element => { elements.forEach(element => {
...@@ -144,7 +141,7 @@ export class SectionService { ...@@ -144,7 +141,7 @@ export class SectionService {
}); });
return {}; return {};
}, },
rollback: (deletedData: Record<string, unknown>) => { rollback: () => {
newSection.elements = newSection.elements.filter(element => !elements.includes(element)); newSection.elements = newSection.elements.filter(element => !elements.includes(element));
elements.forEach(element => { elements.forEach(element => {
previousSection.elements.push(element as PositionedUIElement); previousSection.elements.push(element as PositionedUIElement);
......
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { FileService } from 'common/services/file.service'; import { FileService } from 'common/services/file.service';
import { MessageService } from 'editor/src/app/services/message.service'; import { MessageService } from 'editor/src/app/services/message.service';
import { Unit, UnitProperties } from 'common/models/unit'; import { Unit, UnitProperties } from 'common/models/unit';
...@@ -10,16 +10,16 @@ import { ...@@ -10,16 +10,16 @@ import {
import { DropListElement } from 'common/models/elements/input-elements/drop-list'; import { DropListElement } from 'common/models/elements/input-elements/drop-list';
import { StateVariable } from 'common/models/state-variable'; import { StateVariable } from 'common/models/state-variable';
import { VersionManager } from 'common/services/version-manager'; import { VersionManager } from 'common/services/version-manager';
import { Page } from 'common/models/page';
import { Section } from 'common/models/section';
import { SectionCounter } from 'common/util/section-counter';
import { ReferenceList, ReferenceManager } from 'editor/src/app/services/reference-manager'; import { ReferenceList, ReferenceManager } from 'editor/src/app/services/reference-manager';
import { HistoryService, UnitUpdateCommand } from 'editor/src/app/services/history.service';
import { DialogService } from '../dialog.service'; import { DialogService } from '../dialog.service';
import { VeronaAPIService } from '../verona-api.service'; import { VeronaAPIService } from '../verona-api.service';
import { SelectionService } from '../selection.service'; import { SelectionService } from '../selection.service';
import { IDService } from '../id.service'; import { IDService } from '../id.service';
import { UnitDefinitionSanitizer } from '../sanitizer'; import { UnitDefinitionSanitizer } from '../sanitizer';
import { HistoryService, UnitUpdateCommand } from 'editor/src/app/services/history.service';
import { Page } from 'common/models/page';
import { Section } from 'common/models/section';
import { SectionCounter } from 'common/util/section-counter';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
...@@ -92,7 +92,7 @@ export class UnitService { ...@@ -92,7 +92,7 @@ export class UnitService {
updateUnitDefinition(command?: UnitUpdateCommand): void { updateUnitDefinition(command?: UnitUpdateCommand): void {
if (command) { if (command) {
let deletedData = command.command(); const deletedData = command.command();
if (deletedData instanceof Promise) { if (deletedData instanceof Promise) {
deletedData.then((deletedData) => { deletedData.then((deletedData) => {
this.historyService.addCommand(command, deletedData); this.historyService.addCommand(command, deletedData);
...@@ -173,7 +173,7 @@ export class UnitService { ...@@ -173,7 +173,7 @@ export class UnitService {
let refs: ReferenceList[] = []; let refs: ReferenceList[] = [];
let dialogText: string = ''; let dialogText: string = '';
switch (deletedObjectType) { switch (deletedObjectType) {
case "page": case 'page':
refs = this.referenceManager.getPageElementsReferences( refs = this.referenceManager.getPageElementsReferences(
this.unit.pages[this.selectionService.selectedPageIndex] this.unit.pages[this.selectionService.selectedPageIndex]
); );
...@@ -183,18 +183,18 @@ export class UnitService { ...@@ -183,18 +183,18 @@ export class UnitService {
refs = refs.concat(pageNavButtonRefs); refs = refs.concat(pageNavButtonRefs);
dialogText = `Seite ${this.selectionService.selectedPageIndex + 1} löschen?`; dialogText = `Seite ${this.selectionService.selectedPageIndex + 1} löschen?`;
break; break;
case "section": case 'section':
refs = this.referenceManager.getSectionElementsReferences([object as Section]); refs = this.referenceManager.getSectionElementsReferences([object as Section]);
dialogText = `Abschnitt ${this.selectionService.selectedSectionIndex + 1} löschen?`; dialogText = `Abschnitt ${this.selectionService.selectedSectionIndex + 1} löschen?`;
break; break;
case "elements": case 'elements':
refs = this.referenceManager.getElementsReferences(object as UIElement[]); refs = this.referenceManager.getElementsReferences(object as UIElement[]);
dialogText = 'Folgende Elemente werden gelöscht:'; dialogText = 'Folgende Elemente werden gelöscht:';
} }
this.dialogService.showDeleteConfirmDialog( this.dialogService.showDeleteConfirmDialog(
dialogText, dialogText,
deletedObjectType == 'elements' ? object as UIElement[] : undefined, deletedObjectType === 'elements' ? object as UIElement[] : undefined,
refs) refs)
.subscribe((result: boolean) => { .subscribe((result: boolean) => {
if (result) { if (result) {
......
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