Skip to content

Commit

Permalink
fix: clicking filename does not open file twice (#2097)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSlimvReal authored Nov 27, 2023
1 parent 9666c2e commit 6ddc8bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/app/features/file/edit-file/edit-file.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@
[formControl]="formControl"
i18n-placeholder="placeholder for file-input"
placeholder="No file selected"
(click)="formClicked(true)"
i18n-matTooltip="Tooltip show file"
matTooltip="Show file"
[matTooltipDisabled]="!formControl.value"
[matTooltipDisabled]="!(initialValue && formControl.value === initialValue)"
/>
<button
*ngIf="formControl.value && formControl.enabled"
type="button"
mat-icon-button
matIconSuffix
(click)="delete()"
(click)="delete(); $event.stopPropagation()"
i18n-mattooltip="Tooltip remove file"
matTooltip="Remove file"
>
Expand All @@ -38,7 +37,7 @@
type="button"
mat-icon-button
matIconSuffix
(click)="fileUpload.click()"
(click)="fileUpload.click(); $event.stopPropagation()"
i18n-matTooltip="Tooltip upload file button"
matTooltip="Upload file"
>
Expand Down
6 changes: 3 additions & 3 deletions src/app/features/file/edit-file/edit-file.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class EditFileComponent extends EditComponent<string> implements OnInit {
@ViewChild("fileUpload") fileUploadInput: ElementRef<HTMLInputElement>;
private selectedFile: File;
private removeClicked = false;
private initialValue: string;
initialValue: string;

constructor(
protected fileService: FileService,
Expand Down Expand Up @@ -104,10 +104,10 @@ export class EditFileComponent extends EditComponent<string> implements OnInit {
return this.entityMapper.save(this.entity);
}

formClicked(isInputElement?: boolean) {
formClicked() {
if (this.initialValue && this.formControl.value === this.initialValue) {
this.showFile();
} else if (isInputElement) {
} else {
this.fileUploadInput.nativeElement.click();
}
}
Expand Down

0 comments on commit 6ddc8bd

Please sign in to comment.