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

[editor] Fix tab index when making page always visible

parent b2be1bac
No related branches found
No related tags found
No related merge requests found
...@@ -67,6 +67,7 @@ export class PageMenu implements OnDestroy { ...@@ -67,6 +67,7 @@ export class PageMenu implements OnDestroy {
@Input() page!: Page; @Input() page!: Page;
@Input() pageIndex!: number; @Input() pageIndex!: number;
@Output() pageOrderChanged = new EventEmitter<void>(); @Output() pageOrderChanged = new EventEmitter<void>();
@Output() alwaysVisiblePageModified = new EventEmitter();
private ngUnsubscribe = new Subject<void>(); private ngUnsubscribe = new Subject<void>();
constructor(public unitService: UnitService, constructor(public unitService: UnitService,
...@@ -85,11 +86,14 @@ export class PageMenu implements OnDestroy { ...@@ -85,11 +86,14 @@ export class PageMenu implements OnDestroy {
updateModel(page: Page, property: string, value: number | boolean, isInputValid: boolean | null = true): void { updateModel(page: Page, property: string, value: number | boolean, isInputValid: boolean | null = true): void {
if (isInputValid && value != null) { if (isInputValid && value != null) {
if (property === 'alwaysVisible' && value === true) { if (property === 'alwaysVisible') {
this.movePageToFront(page); if (value === true) {
page.alwaysVisible = true; this.movePageToFront(page);
this.selectionService.selectedPageIndex = 0; page.alwaysVisible = true;
this.selectionService.selectedPageIndex = 0;
}
this.unitService.updateSectionCounter(); this.unitService.updateSectionCounter();
this.alwaysVisiblePageModified.emit();
this.pageOrderChanged.emit(); this.pageOrderChanged.emit();
} }
page[property] = value; page[property] = value;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
</button> </button>
<mat-menu #pageMenu="matMenu"> <mat-menu #pageMenu="matMenu">
<aspect-unit-view-page-menu [page]="page" [pageIndex]="pageIndex" <aspect-unit-view-page-menu [page]="page" [pageIndex]="pageIndex"
(alwaysVisiblePageModified)="alwaysVisiblePageModified.emit()"
(pageOrderChanged)="pagesChanged.emit()"></aspect-unit-view-page-menu> (pageOrderChanged)="pagesChanged.emit()"></aspect-unit-view-page-menu>
</mat-menu> </mat-menu>
......
...@@ -40,6 +40,7 @@ export class PageViewComponent implements OnInit, OnDestroy { ...@@ -40,6 +40,7 @@ export class PageViewComponent implements OnInit, OnDestroy {
@Input() singlePageMode: boolean = false; @Input() singlePageMode: boolean = false;
@Input() isLastPage: boolean = false; @Input() isLastPage: boolean = false;
@Output() pagesChanged = new EventEmitter(); @Output() pagesChanged = new EventEmitter();
@Output() alwaysVisiblePageModified = new EventEmitter();
@ViewChildren(SectionComponent) sectionComponents!: QueryList<SectionComponent>; @ViewChildren(SectionComponent) sectionComponents!: QueryList<SectionComponent>;
private ngUnsubscribe = new Subject<void>(); private ngUnsubscribe = new Subject<void>();
......
...@@ -63,7 +63,8 @@ ...@@ -63,7 +63,8 @@
</mat-icon> </mat-icon>
</ng-template> </ng-template>
<aspect-editor-page-view *ngIf="pagesLoaded" class="fx-column-start-stretch" <aspect-editor-page-view *ngIf="pagesLoaded" class="fx-column-start-stretch"
[page]="unitService.unit.pages[0]" [pageIndex]="0"> [page]="unitService.unit.pages[0]" [pageIndex]="0"
(pagesChanged)="refreshTabs()">
</aspect-editor-page-view> </aspect-editor-page-view>
</mat-tab> </mat-tab>
<mat-tab> <mat-tab>
...@@ -76,7 +77,8 @@ ...@@ -76,7 +77,8 @@
let pageIndex = index" let pageIndex = index"
[page]="page" [page]="page"
[pageIndex]="pageIndex + (unitService.unit.pages[0].alwaysVisible ? 1 : 0)" [pageIndex]="pageIndex + (unitService.unit.pages[0].alwaysVisible ? 1 : 0)"
[isLastPage]="pageIndex == unitService.unit.pages.length - 1"> [isLastPage]="pageIndex == unitService.unit.pages.length - 1"
(alwaysVisiblePageModified)="refreshTabs()">
</aspect-editor-page-view> </aspect-editor-page-view>
</div> </div>
<button mat-fab extended class="add-page-button" [matTooltip]="'Weitere Seite anlegen'" (click)="addPage()"> <button mat-fab extended class="add-page-button" [matTooltip]="'Weitere Seite anlegen'" (click)="addPage()">
......
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