From 43f114c92f7be3308eb13706f917dcc34508ebf3 Mon Sep 17 00:00:00 2001 From: rhenck <richard.henck@iqb.hu-berlin.de> Date: Wed, 30 Mar 2022 12:05:56 +0200 Subject: [PATCH] [editor] Keep selection on moved section --- projects/editor/src/app/services/unit.service.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/editor/src/app/services/unit.service.ts b/projects/editor/src/app/services/unit.service.ts index 3a95f551f..54610371d 100644 --- a/projects/editor/src/app/services/unit.service.ts +++ b/projects/editor/src/app/services/unit.service.ts @@ -96,6 +96,11 @@ export class UnitService { moveSection(section: Section, page: Page, direction: 'up' | 'down'): void { ArrayUtils.moveArrayItem(section, page.sections, direction); + if (direction === 'up' && this.selectionService.selectedPageSectionIndex > 0) { + this.selectionService.selectedPageSectionIndex -= 1; + } else if (direction === 'down') { + this.selectionService.selectedPageSectionIndex += 1; + } this.veronaApiService.sendVoeDefinitionChangedNotification(this.unit); } -- GitLab