From 52fa35d8d227e28354dc464440244127e3111433 Mon Sep 17 00:00:00 2001 From: rhenck <richard.henck@iqb.hu-berlin.de> Date: Mon, 14 Oct 2024 16:30:42 +0200 Subject: [PATCH] [editor] Fix linting issues, unused code etc. --- projects/editor/src/app/app.component.ts | 4 +- projects/editor/src/app/app.module.ts | 49 ++++++++++--------- .../app/components/element-list.component.ts | 1 - .../ui-element-toolbox.component.ts | 9 ++-- .../element-overlay/canvas-element-overlay.ts | 8 +-- .../unit-view/page-menu.component.ts | 4 +- .../unit-view/page/section-menu.component.ts | 20 ++++---- .../dynamic-section-helper-grid.component.ts | 5 +- .../section/section-dynamic.component.ts | 10 ++-- .../section/section-static.component.ts | 2 +- .../unit-view/section/section.component.ts | 4 +- .../unit-view/unit-view.component.ts | 4 +- .../src/app/services/verona-api.service.ts | 2 - 13 files changed, 60 insertions(+), 62 deletions(-) diff --git a/projects/editor/src/app/app.component.ts b/projects/editor/src/app/app.component.ts index 99946a126..165228b3d 100644 --- a/projects/editor/src/app/app.component.ts +++ b/projects/editor/src/app/app.component.ts @@ -26,8 +26,8 @@ export class AppComponent implements OnInit { constructor(private unitService: UnitService, private translateService: TranslateService, private veronaApiService: VeronaAPIService) { - translateService.addLangs(['de']); - translateService.setDefaultLang('de'); + this.translateService.addLangs(['de']); + this.translateService.setDefaultLang('de'); } ngOnInit(): void { diff --git a/projects/editor/src/app/app.module.ts b/projects/editor/src/app/app.module.ts index 7a0c0674d..7998ca651 100644 --- a/projects/editor/src/app/app.module.ts +++ b/projects/editor/src/app/app.module.ts @@ -23,45 +23,48 @@ import { MatRadioModule } from '@angular/material/radio'; import { HotspotEditDialogComponent } from 'editor/src/app/components/dialogs/hotspot-edit-dialog.component'; import { MathEditorModule } from 'common/math-editor.module'; import { CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay'; +import { MAT_TOOLTIP_DEFAULT_OPTIONS, MatTooltipDefaultOptions } from '@angular/material/tooltip'; +import { MeasurePipe } from 'common/pipes/measure.pipe'; +import { MatSnackBarModule } from '@angular/material/snack-bar'; +import { MatBadgeModule } from '@angular/material/badge'; import { StateVariablesDialogComponent -} from 'editor/src/app/components/dialogs/state-variables-dialog/state-variables-dialog.component'; +} from './components/dialogs/state-variables-dialog/state-variables-dialog.component'; import { VisibilityRuleEditorComponent -} from 'editor/src/app/components/dialogs/visibility-rules-dialog/visibility-rule-editor.component'; +} from './components/dialogs/visibility-rules-dialog/visibility-rule-editor.component'; import { ShowStateVariablesButtonComponent -} from 'editor/src/app/components/new-ui-element-panel/show-state-variables-button.component'; +} from './components/new-ui-element-panel/show-state-variables-button.component'; import { TextFieldElementPropertiesComponent -} from 'editor/src/app/components/properties-panel/model-properties-tab/input-groups/text-field-element-properties.component'; +} from './components/properties-panel/model-properties-tab/input-groups/text-field-element-properties.component'; import { ScaleAndZoomPropertiesComponent -} from 'editor/src/app/components/properties-panel/model-properties-tab/input-groups/scale-and-zoom-properties.component'; +} from './components/properties-panel/model-properties-tab/input-groups/scale-and-zoom-properties.component'; import { StateVariableEditorComponent -} from 'editor/src/app/components/dialogs/state-variables-dialog/state-variable-editor.component'; +} from './components/dialogs/state-variables-dialog/state-variable-editor.component'; import { ActionParamStateVariableComponent } from - 'editor/src/app/components/properties-panel/model-properties-tab/input-groups/action-param-state-variable.component'; + './components/properties-panel/model-properties-tab/input-groups/action-param-state-variable.component'; import { VisibilityRulesDialogComponent -} from 'editor/src/app/components/dialogs/visibility-rules-dialog/visibility-rules-dialog.component'; -import { MatSnackBarModule } from '@angular/material/snack-bar'; -import { MatBadgeModule } from '@angular/material/badge'; +} from './components/dialogs/visibility-rules-dialog/visibility-rules-dialog.component'; + import { InputAssistancePropertiesComponent } from - 'editor/src/app/components/properties-panel/model-properties-tab/input-groups/input-assistance-properties.component'; + './components/properties-panel/model-properties-tab/input-groups/input-assistance-properties.component'; import { TooltipPropertiesDialogComponent -} from 'editor/src/app/components/dialogs/tooltip-properties-dialog.component'; +} from './components/dialogs/tooltip-properties-dialog.component'; import { ActionPropertiesComponent, GetAnchorIdsPipe, GetStateVariableIdsPipe, GetStateVariablePipe, ScrollPageIndexPipe -} from 'editor/src/app/components/properties-panel/model-properties-tab/input-groups/action-properties.component'; +} from './components/properties-panel/model-properties-tab/input-groups/action-properties.component'; import { AppComponent } from './app.component'; import { ToolbarComponent } from './components/toolbar/toolbar.component'; import { UiElementToolboxComponent } from './components/new-ui-element-panel/ui-element-toolbox.component'; import { UnitViewComponent } from './components/unit-view/unit-view.component'; -import { CanvasComponent } from 'editor/src/app/components/unit-view/page/canvas.component'; +import { CanvasComponent } from './components/unit-view/page/canvas.component'; import { EditorTranslateLoader } from './editor-translate-loader'; import { RichTextEditorComponent } from './text-editor/rich-text-editor.component'; import { DeleteConfirmationDialogComponent } from './components/dialogs/delete-confirmation-dialog.component'; @@ -105,16 +108,16 @@ import { SizeInputPanelComponent } from './components/util/size-input-panel.comp import { DeleteReferenceDialogComponent } from './components/dialogs/delete-reference-dialog.component'; import { SanitizationDialogComponent } from './components/dialogs/sanitization-dialog.component'; import { CheckboxNodeviewComponent } from './text-editor/angular-node-views/checkbox-nodeview.component'; -import { OptionListPanelComponent } from 'editor/src/app/components/properties-panel/option-list-panel.component'; +import { OptionListPanelComponent } from './components/properties-panel/option-list-panel.component'; import { EleSpecificPropsComponent -} from 'editor/src/app/components/properties-panel/model-properties-tab/input-groups/ele-specific-props.component'; -import { PageMenu } from 'editor/src/app/components/unit-view/page-menu.component'; -import { MAT_TOOLTIP_DEFAULT_OPTIONS, MatTooltipDefaultOptions } from '@angular/material/tooltip'; -import { ReferenceListComponent } from 'editor/src/app/components/reference-list.component'; -import { ElementListComponent } from 'editor/src/app/components/element-list.component'; -import { MeasurePipe } from 'common/pipes/measure.pipe'; -import { SectionComponent } from 'editor/src/app/components/unit-view/section/section.component'; +} from './components/properties-panel/model-properties-tab/input-groups/ele-specific-props.component'; +import { PageMenu } from './components/unit-view/page-menu.component'; + +import { ReferenceListComponent } from './components/reference-list.component'; +import { ElementListComponent } from './components/element-list.component'; + +import { SectionComponent } from './components/unit-view/section/section.component'; /** Custom options the configure the tooltip's default show/hide delays. */ export const myCustomTooltipDefaults: MatTooltipDefaultOptions = { @@ -219,7 +222,7 @@ export const myCustomTooltipDefaults: MatTooltipDefaultOptions = { ], providers: [ { provide: APIService, useExisting: VeronaAPIService }, - {provide: MAT_TOOLTIP_DEFAULT_OPTIONS, useValue: myCustomTooltipDefaults} + { provide: MAT_TOOLTIP_DEFAULT_OPTIONS, useValue: myCustomTooltipDefaults } ] }) diff --git a/projects/editor/src/app/components/element-list.component.ts b/projects/editor/src/app/components/element-list.component.ts index 685646ab8..c7d5defce 100644 --- a/projects/editor/src/app/components/element-list.component.ts +++ b/projects/editor/src/app/components/element-list.component.ts @@ -1,5 +1,4 @@ import { Component, Input } from '@angular/core'; -import { ReferenceList } from 'editor/src/app/services/reference-manager'; import { UIElement } from 'common/models/elements/element'; import { MatIconModule } from '@angular/material/icon'; import { MatListModule } from '@angular/material/list'; diff --git a/projects/editor/src/app/components/new-ui-element-panel/ui-element-toolbox.component.ts b/projects/editor/src/app/components/new-ui-element-panel/ui-element-toolbox.component.ts index 60f4b2089..8e2f1c644 100644 --- a/projects/editor/src/app/components/new-ui-element-panel/ui-element-toolbox.component.ts +++ b/projects/editor/src/app/components/new-ui-element-panel/ui-element-toolbox.component.ts @@ -1,8 +1,5 @@ import { Component } from '@angular/core'; import { UIElementType } from 'common/models/elements/element'; -import { UnitService } from '../../services/unit-services/unit.service'; -import { SelectionService } from '../../services/selection.service'; -import { ElementService } from 'editor/src/app/services/unit-services/element.service'; import { ClozeElement } from 'common/models/elements/compound-elements/cloze/cloze'; import { ImageElement } from 'common/models/elements/media-elements/image'; import { AudioElement } from 'common/models/elements/media-elements/audio'; @@ -23,6 +20,9 @@ import { FrameElement } from 'common/models/elements/frame/frame'; import { GeometryElement } from 'common/models/elements/geometry/geometry'; import { TriggerElement } from 'common/models/elements/trigger/trigger'; import { TextElement } from 'common/models/elements/text/text'; +import { UnitService } from 'editor/src/app/services/unit-services/unit.service'; +import { SelectionService } from 'editor/src/app/services/selection.service'; +import { ElementService } from 'editor/src/app/services/unit-services/element.service'; import { DragNDropService } from 'editor/src/app/services/drag-n-drop.service'; import { TableElement } from 'common/models/elements/compound-elements/table/table'; import { TemplateService } from 'editor/src/app/services/template.service'; @@ -45,7 +45,8 @@ export class UiElementToolboxComponent { addUIElement(elementType: UIElementType): void { this.elementService.addElementToSection( elementType, - this.unitService.unit.pages[this.selectionService.selectedPageIndex].sections[this.selectionService.selectedSectionIndex]); + this.unitService.unit + .pages[this.selectionService.selectedPageIndex].sections[this.selectionService.selectedSectionIndex]); } startDrag($event: DragEvent, elementType: string): void { diff --git a/projects/editor/src/app/components/unit-view/element-overlay/canvas-element-overlay.ts b/projects/editor/src/app/components/unit-view/element-overlay/canvas-element-overlay.ts index 056e556d2..4b99fc4bf 100644 --- a/projects/editor/src/app/components/unit-view/element-overlay/canvas-element-overlay.ts +++ b/projects/editor/src/app/components/unit-view/element-overlay/canvas-element-overlay.ts @@ -12,12 +12,12 @@ import { PositionedUIElement } from 'common/models/elements/element'; import { GeometryComponent } from 'common/components/geometry/geometry.component'; import { FormElementComponent } from 'common/directives/form-element-component.directive'; import { MathTableComponent } from 'common/components/input-elements/math-table.component'; -import { UnitService } from '../../../services/unit-services/unit.service'; -import { SelectionService } from '../../../services/selection.service'; -import { ElementService } from 'editor/src/app/services/unit-services/element.service'; -import { DragNDropService } from 'editor/src/app/services/drag-n-drop.service'; import { TableComponent } from 'common/components/compound-elements/table/table.component'; import { TableChildOverlay } from 'common/components/compound-elements/table/table-child-overlay.component'; +import { ElementService } from 'editor/src/app/services/unit-services/element.service'; +import { DragNDropService } from 'editor/src/app/services/drag-n-drop.service'; +import { UnitService } from '../../../services/unit-services/unit.service'; +import { SelectionService } from '../../../services/selection.service'; @Directive() export abstract class CanvasElementOverlay implements OnInit, OnDestroy { diff --git a/projects/editor/src/app/components/unit-view/page-menu.component.ts b/projects/editor/src/app/components/unit-view/page-menu.component.ts index 17b14327f..e8ab8ce37 100644 --- a/projects/editor/src/app/components/unit-view/page-menu.component.ts +++ b/projects/editor/src/app/components/unit-view/page-menu.component.ts @@ -1,4 +1,6 @@ -import { Component, EventEmitter, Input, OnDestroy, Output } from '@angular/core'; +import { + Component, EventEmitter, Input, OnDestroy, Output +} from '@angular/core'; import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatDividerModule } from '@angular/material/divider'; import { MatFormFieldModule } from '@angular/material/form-field'; diff --git a/projects/editor/src/app/components/unit-view/page/section-menu.component.ts b/projects/editor/src/app/components/unit-view/page/section-menu.component.ts index 707260df1..84d532366 100644 --- a/projects/editor/src/app/components/unit-view/page/section-menu.component.ts +++ b/projects/editor/src/app/components/unit-view/page/section-menu.component.ts @@ -4,16 +4,6 @@ import { import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { Clipboard } from '@angular/cdk/clipboard'; -import { MessageService } from 'editor/src/app/services/message.service'; -import { CompoundElement, Measurement, UIElement } from 'common/models/elements/element'; -import { Section } from 'common/models/section'; -import { DropListElement } from 'common/models/elements/input-elements/drop-list'; -import { IDService } from 'editor/src/app/services/id.service'; -import { VisibilityRule } from 'common/models/visibility-rule'; -import { UnitService } from '../../../services/unit-services/unit.service'; -import { DialogService } from '../../../services/dialog.service'; -import { SelectionService } from '../../../services/selection.service'; -import { SectionService } from 'editor/src/app/services/unit-services/section.service'; import { MatMenuModule } from '@angular/material/menu'; import { MatIconModule } from '@angular/material/icon'; import { MatTooltipModule } from '@angular/material/tooltip'; @@ -24,7 +14,17 @@ import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatFormFieldModule } from '@angular/material/form-field'; import { NgForOf, NgIf } from '@angular/common'; import { MatInputModule } from '@angular/material/input'; +import { Section } from 'common/models/section'; +import { CompoundElement, UIElement } from 'common/models/elements/element'; +import { VisibilityRule } from 'common/models/visibility-rule'; +import { MessageService } from 'editor/src/app/services/message.service'; +import { DropListElement } from 'common/models/elements/input-elements/drop-list'; +import { IDService } from 'editor/src/app/services/id.service'; +import { SectionService } from 'editor/src/app/services/unit-services/section.service'; import { SizeInputPanelComponent } from 'editor/src/app/components/util/size-input-panel.component'; +import { UnitService } from '../../../services/unit-services/unit.service'; +import { DialogService } from '../../../services/dialog.service'; +import { SelectionService } from '../../../services/selection.service'; @Component({ selector: 'aspect-section-menu', diff --git a/projects/editor/src/app/components/unit-view/section/dynamic-section-helper-grid.component.ts b/projects/editor/src/app/components/unit-view/section/dynamic-section-helper-grid.component.ts index ab2ec800f..3b213b1f5 100644 --- a/projects/editor/src/app/components/unit-view/section/dynamic-section-helper-grid.component.ts +++ b/projects/editor/src/app/components/unit-view/section/dynamic-section-helper-grid.component.ts @@ -2,11 +2,11 @@ import { CdkDragDrop, CdkDropList } from '@angular/cdk/drag-drop'; import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; +import { NgForOf } from '@angular/common'; import { UIElement, UIElementType } from 'common/models/elements/element'; import { Section } from 'common/models/section'; -import { UnitService } from '../../../services/unit-services/unit.service'; +import { UnitService } from 'editor/src/app/services/unit-services/unit.service'; import { ElementService } from 'editor/src/app/services/unit-services/element.service'; -import { NgForOf } from '@angular/common'; @Component({ selector: '[app-dynamic-section-helper-grid]', @@ -109,7 +109,6 @@ export class DynamicSectionHelperGridComponent implements OnInit, OnChanges { } drop(event: CdkDragDrop<{ pageIndex: number, sectionIndex: number; gridCoordinates: number[]; }>): void { - console.log('HelperGrid: drop', event); const dragItemData: { dragType: string; element: UIElement; } = event.item.data; // Move element to other section - handled by parent (page-canvas). diff --git a/projects/editor/src/app/components/unit-view/section/section-dynamic.component.ts b/projects/editor/src/app/components/unit-view/section/section-dynamic.component.ts index 301d2c45f..252cb97d6 100644 --- a/projects/editor/src/app/components/unit-view/section/section-dynamic.component.ts +++ b/projects/editor/src/app/components/unit-view/section/section-dynamic.component.ts @@ -1,13 +1,12 @@ import { Component, Input, Output, EventEmitter, - ViewChildren, QueryList, ViewChild, OnInit + ViewChildren, QueryList, ViewChild } from '@angular/core'; +import { NgClass, NgForOf, NgIf } from '@angular/common'; +import { MeasurePipe } from 'common/pipes/measure.pipe'; import { Section } from 'common/models/section'; import { DragNDropService } from 'editor/src/app/services/drag-n-drop.service'; import { CanvasElementOverlay } from 'editor/src/app/components/unit-view/element-overlay/canvas-element-overlay'; -import { DynamicSectionHelperGridComponent } from './dynamic-section-helper-grid.component'; -import { NgClass, NgForOf, NgIf } from '@angular/common'; -import { MeasurePipe } from 'common/pipes/measure.pipe'; import { DynamicCanvasOverlayComponent } from 'editor/src/app/components/unit-view/element-overlay/dynamic-canvas-overlay.component'; @@ -15,6 +14,7 @@ import { CdkDropList } from '@angular/cdk/drag-drop'; import { ElementGridChangeListenerDirective } from 'editor/src/app/components/unit-view/section/element-grid-change-listener.directive'; +import { DynamicSectionHelperGridComponent } from './dynamic-section-helper-grid.component'; @Component({ selector: 'aspect-section-dynamic', @@ -96,12 +96,12 @@ export class SectionDynamicComponent { @Input() pageIndex!: number; @Input() dropListList!: string[]; @Input() isSelected!: boolean; + @Output() elementSelected = new EventEmitter(); @Output() transferElement = new EventEmitter<{ sourcePageIndex: number, sourceSectionIndex: number, targetPageIndex: number, targetSectionIndex: number }>(); - @Output() elementSelected = new EventEmitter(); @ViewChild(DynamicSectionHelperGridComponent) helperGrid!: DynamicSectionHelperGridComponent; @ViewChildren('elementComponent') childElementComponents!: QueryList<CanvasElementOverlay>; diff --git a/projects/editor/src/app/components/unit-view/section/section-static.component.ts b/projects/editor/src/app/components/unit-view/section/section-static.component.ts index 69e348e13..474f15fb8 100644 --- a/projects/editor/src/app/components/unit-view/section/section-static.component.ts +++ b/projects/editor/src/app/components/unit-view/section/section-static.component.ts @@ -3,7 +3,7 @@ import { } from '@angular/core'; import { Section } from 'common/models/section'; import { UIElementType } from 'common/models/elements/element'; -import { UnitService } from '../../../services/unit-services/unit.service'; +import { UnitService } from 'editor/src/app/services/unit-services/unit.service'; import { CanvasElementOverlay } from 'editor/src/app/components/unit-view/element-overlay/canvas-element-overlay'; import { ElementService } from 'editor/src/app/services/unit-services/element.service'; import { diff --git a/projects/editor/src/app/components/unit-view/section/section.component.ts b/projects/editor/src/app/components/unit-view/section/section.component.ts index a5a4ffd5b..15f9cda09 100644 --- a/projects/editor/src/app/components/unit-view/section/section.component.ts +++ b/projects/editor/src/app/components/unit-view/section/section.component.ts @@ -1,5 +1,5 @@ import { - Component, EventEmitter, Input, OnInit, Output, QueryList, ViewChildren + Component, EventEmitter, Input, Output, QueryList, ViewChildren } from '@angular/core'; import { SectionMenuComponent } from 'editor/src/app/components/unit-view/page/section-menu.component'; import { SelectionService } from 'editor/src/app/services/selection.service'; @@ -65,7 +65,6 @@ import { SectionCounter } from 'common/util/section-counter'; $event.targetSectionIndex)" (click)="selectionService.selectedSectionIndex = sectionIndex; sectionSelected.emit(sectionIndex)"> -<!-- (click)="selectionService.updateSelection(sectionIndex)">--> </aspect-section-dynamic> </div> `, @@ -131,7 +130,6 @@ export class SectionComponent { } elementDropped(event: CdkDragDrop<{ pageIndex: number, sectionIndex: number; gridCoordinates?: number[]; }>): void { - console.log('SectionComponent: elementDropped'); const selectedElements = this.selectionService.getSelectedElements() as PositionedUIElement[]; if (event.previousContainer !== event.container) { 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 55ed887ec..a229fa821 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,7 +1,6 @@ import { Component } from '@angular/core'; import { MatCheckboxChange } from '@angular/material/checkbox'; import { PageChangeService } from 'common/services/page-change.service'; -import { HistoryService } from 'editor/src/app/services/history.service'; import { PageService } from 'editor/src/app/services/unit-services/page.service'; import { UnitService } from '../../services/unit-services/unit.service'; import { SelectionService } from '../../services/selection.service'; @@ -18,8 +17,7 @@ export class UnitViewComponent { constructor(public selectionService: SelectionService, public unitService: UnitService, public pageService: PageService, - public pageChangeService: PageChangeService, - public historyService: HistoryService) { } + public pageChangeService: PageChangeService) { } selectPage(newIndex: number): void { this.selectionService.selectPage(newIndex); diff --git a/projects/editor/src/app/services/verona-api.service.ts b/projects/editor/src/app/services/verona-api.service.ts index 52da09c86..6041abf2b 100644 --- a/projects/editor/src/app/services/verona-api.service.ts +++ b/projects/editor/src/app/services/verona-api.service.ts @@ -35,8 +35,6 @@ export class VeronaAPIService { const isStandalone = window === window.parent; if (!isStandalone) { window.parent.postMessage(message, '*'); - } else { - // console.log(`player: ${message.type}`); } } -- GitLab