From b30e1551238876ae69c93aa7a29bc2cfd07fbed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 7 Oct 2024 16:41:11 +0200 Subject: [PATCH] Remove focusout submits the field https://community.openproject.org/work_packages/58286 --- .../work-package-comment-field-handler.ts | 7 +------ .../fields/edit/editing-portal/edit-field-handler.ts | 5 ----- .../edit/field-handler/hal-resource-edit-field-handler.ts | 8 -------- .../fields/edit/field-types/float-edit-field.component.ts | 1 - .../edit/field-types/text-edit-field.component.html | 1 - .../widgets/custom-text/custom-text-edit-field.service.ts | 4 ---- 6 files changed, 1 insertion(+), 25 deletions(-) diff --git a/frontend/src/app/features/work-packages/components/work-package-comment/work-package-comment-field-handler.ts b/frontend/src/app/features/work-packages/components/work-package-comment/work-package-comment-field-handler.ts index cb15ffcec994..c5ec779f6549 100644 --- a/frontend/src/app/features/work-packages/components/work-package-comment/work-package-comment-field-handler.ts +++ b/frontend/src/app/features/work-packages/components/work-package-comment/work-package-comment-field-handler.ts @@ -1,7 +1,5 @@ import { EditFieldHandler } from 'core-app/shared/components/fields/edit/editing-portal/edit-field-handler'; -import { - ElementRef, Injector, OnInit, Directive, -} from '@angular/core'; +import { Directive, ElementRef, Injector, OnInit } from '@angular/core'; import { IFieldSchema } from 'core-app/shared/components/fields/field.base'; import { Subject } from 'rxjs'; import { WorkPackageChangeset } from 'core-app/features/work-packages/components/wp-edit/work-package-changeset'; @@ -86,9 +84,6 @@ export abstract class WorkPackageCommentFieldHandler extends EditFieldHandler im trigger && trigger.focus(); } - onFocusOut():void { - } - handleUserKeydown(event:JQuery.TriggeredEvent, onlyCancel?:boolean):void { } diff --git a/frontend/src/app/shared/components/fields/edit/editing-portal/edit-field-handler.ts b/frontend/src/app/shared/components/fields/edit/editing-portal/edit-field-handler.ts index 6d9c12f33725..2a78b1d51a4d 100644 --- a/frontend/src/app/shared/components/fields/edit/editing-portal/edit-field-handler.ts +++ b/frontend/src/app/shared/components/fields/edit/editing-portal/edit-field-handler.ts @@ -144,11 +144,6 @@ export abstract class EditFieldHandler extends UntilDestroyedMixin { */ public abstract isChanged():boolean; - /** - * Handle focus loss - */ - public abstract onFocusOut():void; - public abstract setErrors(newErrors:string[]):void; public previewContext(resource:HalResource):string|undefined { diff --git a/frontend/src/app/shared/components/fields/edit/field-handler/hal-resource-edit-field-handler.ts b/frontend/src/app/shared/components/fields/edit/field-handler/hal-resource-edit-field-handler.ts index 3065cda507ab..bb901b20c404 100644 --- a/frontend/src/app/shared/components/fields/edit/field-handler/hal-resource-edit-field-handler.ts +++ b/frontend/src/app/shared/components/fields/edit/field-handler/hal-resource-edit-field-handler.ts @@ -107,14 +107,6 @@ export class HalResourceEditFieldHandler extends EditFieldHandler { } } - public async onFocusOut() { - // In case of inline create or erroneous forms: do not save on focus loss - // const specialField = this.resource.shouldCloseOnFocusOut(this.fieldName); - if (this.resource.subject && this.withErrors && this.withErrors.length === 0) { - await this.handleUserSubmit(); - } - } - public setErrors(newErrors:string[]) { this.errors = newErrors; this.element.classList.toggle('-error', this.isErrorenous); diff --git a/frontend/src/app/shared/components/fields/edit/field-types/float-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/float-edit-field.component.ts index efe7407e871c..24d8ec4b5f3a 100644 --- a/frontend/src/app/shared/components/fields/edit/field-types/float-edit-field.component.ts +++ b/frontend/src/app/shared/components/fields/edit/field-types/float-edit-field.component.ts @@ -38,7 +38,6 @@ import { EditFieldComponent } from 'core-app/shared/components/fields/edit/edit- [disabled]="inFlight" [(ngModel)]="value" (keydown)="handler.handleUserKeydown($event)" - (focusout)="handler.onFocusOut()" [attr.lang]="locale" [id]="handler.htmlId" /> `, diff --git a/frontend/src/app/shared/components/fields/edit/field-types/text-edit-field.component.html b/frontend/src/app/shared/components/fields/edit/field-types/text-edit-field.component.html index ef7408857103..44652e6efe0e 100644 --- a/frontend/src/app/shared/components/fields/edit/field-types/text-edit-field.component.html +++ b/frontend/src/app/shared/components/fields/edit/field-types/text-edit-field.component.html @@ -7,6 +7,5 @@ [disabled]="inFlight" [(ngModel)]="value" (keydown)="handler.handleUserKeydown($event)" - (focusout)="handler.onFocusOut()" [id]="handler.htmlId" /> diff --git a/frontend/src/app/shared/components/grids/widgets/custom-text/custom-text-edit-field.service.ts b/frontend/src/app/shared/components/grids/widgets/custom-text/custom-text-edit-field.service.ts index f723e0b4c996..b4ba148a0632 100644 --- a/frontend/src/app/shared/components/grids/widgets/custom-text/custom-text-edit-field.service.ts +++ b/frontend/src/app/shared/components/grids/widgets/custom-text/custom-text-edit-field.service.ts @@ -27,10 +27,6 @@ export class CustomTextEditFieldService extends EditFieldHandler { super(); } - onFocusOut():void { - // interface - } - public initialize(value:GridWidgetResource) { this.initializeChangeset(value); this.valueChanged$ = new BehaviorSubject(value.options.text as string);