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 {
@Input() page!: Page;
@Input() pageIndex!: number;
@Output() pageOrderChanged = new EventEmitter<void>();
@Output() alwaysVisiblePageModified = new EventEmitter();
private ngUnsubscribe = new Subject<void>();
constructor(public unitService: UnitService,
......@@ -85,11 +86,14 @@ export class PageMenu implements OnDestroy {
updateModel(page: Page, property: string, value: number | boolean, isInputValid: boolean | null = true): void {
if (isInputValid && value != null) {
if (property === 'alwaysVisible' && value === true) {
this.movePageToFront(page);
page.alwaysVisible = true;
this.selectionService.selectedPageIndex = 0;
if (property === 'alwaysVisible') {
if (value === true) {
this.movePageToFront(page);
page.alwaysVisible = true;
this.selectionService.selectedPageIndex = 0;
}
this.unitService.updateSectionCounter();
this.alwaysVisiblePageModified.emit();
this.pageOrderChanged.emit();
}
page[property] = value;
......
......@@ -26,6 +26,7 @@
</button>
<mat-menu #pageMenu="matMenu">
<aspect-unit-view-page-menu [page]="page" [pageIndex]="pageIndex"
(alwaysVisiblePageModified)="alwaysVisiblePageModified.emit()"
(pageOrderChanged)="pagesChanged.emit()"></aspect-unit-view-page-menu>
</mat-menu>
......
......@@ -40,6 +40,7 @@ export class PageViewComponent implements OnInit, OnDestroy {
@Input() singlePageMode: boolean = false;
@Input() isLastPage: boolean = false;
@Output() pagesChanged = new EventEmitter();
@Output() alwaysVisiblePageModified = new EventEmitter();
@ViewChildren(SectionComponent) sectionComponents!: QueryList<SectionComponent>;
private ngUnsubscribe = new Subject<void>();
......
......@@ -63,7 +63,8 @@
</mat-icon>
</ng-template>
<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>
</mat-tab>
<mat-tab>
......@@ -76,7 +77,8 @@
let pageIndex = index"
[page]="page"
[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>
</div>
<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