diff --git a/client/src/app/shared/components/extension-field/extension-field.component.html b/client/src/app/shared/components/extension-field/extension-field.component.html index ac471e24c..9c3597751 100644 --- a/client/src/app/shared/components/extension-field/extension-field.component.html +++ b/client/src/app/shared/components/extension-field/extension-field.component.html @@ -2,17 +2,22 @@

{{ title }}

- - + - + (iconAction)="changeEditMode()" + > + {{ chipValue || '–' }} @@ -22,15 +27,14 @@
-
+
{ if (navEvent instanceof NavigationEnd) { this.editMode = false; - this.extensionFieldForm.reset(); + + if (this.extensionFieldForm) { + this.extensionFieldForm.reset(); + } } }); this.initInput(); - this.extensionFieldForm = this.fb.group({ - list: this.searchList ? [[]] : undefined - }); + if (this.searchList) { + this.extensionFieldForm = this.fb.group({ + list: [[]] + }); - this.extensionFieldForm.get('list').valueChanges.subscribe((value: number) => { - if (this.listSubmitOnChange) { - this.listChange.emit(value); - } - if (this.appendValueToInput && this.inputControl.length) { - this.inputControl = this.inputControl.concat( - `[${this.listValuePrefix}${value}${this.listValueSuffix}]` - ); - } - }); + this.searchValueSubscription = this.extensionFieldForm + .get('list') + .valueChanges.subscribe((value: number) => { + if (!!value) { + if (this.listSubmitOnChange) { + this.listChange.emit(value); + } + if (this.appendValueToInput) { + if (!this.inputControl) { + this.inputControl = ''; + } + this.inputControl += `[${this.listValuePrefix}${value}${this.listValueSuffix}]`; + } + this.extensionFieldForm.reset(); + } + }); + } } /** - * On destroy unsubscribe from the nav subscription + * After view inits, allow to automatically open the edit view + */ + public ngAfterViewInit(): void { + this.allowAutoEdit = true; + } + + /** + * On destroy unsubscribe from the subscriptions */ public ngOnDestroy(): void { this.navigationSubscription.unsubscribe(); + if (this.searchValueSubscription) { + this.searchValueSubscription.unsubscribe(); + } + } + + /** + * Hitting enter on the input field should save the content + */ + public keyDownFunction(event: any): void { + if (event.key === 'Enter') { + this.changeEditMode(true); + } } /** diff --git a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html index c77e7787b..fcac8bf9f 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html +++ b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html @@ -1,3 +1,4 @@ +
Show entire motion text - - @@ -781,7 +792,10 @@
- +
diff --git a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts index ac2c772ad..51fa41a39 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts +++ b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts @@ -745,6 +745,20 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit, } } + /** + * Using Meta, Alt + the arrow keys will navigate between the motions + * + * @param event has the key code + */ + public onKeyNavigation(event: KeyboardEvent): void { + if (event.key === 'ArrowLeft' && event.altKey && event.metaKey) { + this.navigateToMotion(this.previousMotion); + } + if (event.key === 'ArrowRight' && event.altKey && event.metaKey) { + this.navigateToMotion(this.nextMotion); + } + } + /** * Before updating or creating, the motions needs to be prepared for paragraph based amendments. * A motion of type T is created, prepared and deserialized from the given motionValues