From 5f75f5233fb54ef78d2e1291a530bbdeafe794bd Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Fri, 24 Sep 2021 15:13:21 +0200
Subject: [PATCH] [editor] Fix selected tab after adding new page

---
 .../editor/src/app/components/unit-view/unit-view.component.ts  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 d2e7d5863..f3450f6af 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
@@ -61,7 +61,7 @@ export class UnitViewComponent implements OnInit, OnDestroy {
 
   addPage(): void {
     this.unitService.addPage();
-    this.selectedPageIndex += this.unit.pages.length - 1;
+    this.selectedPageIndex = this.unit.pages.length - 1;
     this.selectionService.setSelectedPageSection(this.unit.pages[this.selectedPageIndex].sections[0]);
   }
 
-- 
GitLab