From 9dfe556066d0f001257d4dc094a3cbb991a1ecae Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 9 Jun 2021 08:23:16 +0200 Subject: [PATCH] MOBILE-3320 file: Fix file opened twice when second button clicked --- src/core/components/file/core-file.html | 2 +- src/core/components/file/file.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/components/file/core-file.html b/src/core/components/file/core-file.html index e58497f65..7081fa1e1 100644 --- a/src/core/components/file/core-file.html +++ b/src/core/components/file/core-file.html @@ -12,7 +12,7 @@ [canTrustDownload]="!alwaysDownload" (action)="download()" size="small"> - diff --git a/src/core/components/file/file.ts b/src/core/components/file/file.ts index f33a1ee4c..a2b6b183d 100644 --- a/src/core/components/file/file.ts +++ b/src/core/components/file/file.ts @@ -144,10 +144,14 @@ export class CoreFileComponent implements OnInit, OnDestroy { /** * Convenience function to open a file, downloading it if needed. * + * @param ev Click event (if any). * @param isOpenButton Whether the open button was clicked. * @return Promise resolved when file is opened. */ - openFile(isOpenButton = false): Promise { + openFile(ev?: Event, isOpenButton = false): Promise { + ev?.preventDefault(); + ev?.stopPropagation(); + const options: CoreUtilsOpenFileOptions = {}; if (isOpenButton) { // Use the non-default method.