1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 10:13:31 +00:00

[PM-254] Set PDF Attachments in Web to download, add success toast (#10757)

* add success toast to pdf attachment download in web

* update desktop attachments for toastService

* removed trailing comma

---------

Co-authored-by: gbubemismith <gsmithwalter@gmail.com>
Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
This commit is contained in:
Jason Ng
2024-09-11 15:27:53 -04:00
committed by GitHub
parent 2cfbfcbdfe
commit 89751f46d6
10 changed files with 33 additions and 10 deletions

View File

@@ -12,14 +12,12 @@ export class WebFileDownloadService implements FileDownloadService {
download(request: FileDownloadRequest): void {
const builder = new FileDownloadBuilder(request);
const a = window.document.createElement("a");
if (builder.downloadMethod === "save") {
a.download = request.fileName;
} else if (!this.platformUtilsService.isSafari()) {
if (!this.platformUtilsService.isSafari()) {
a.rel = "noreferrer";
a.target = "_blank";
}
a.href = URL.createObjectURL(builder.blob);
a.style.position = "fixed";
a.download = request.fileName;
window.document.body.appendChild(a);
a.click();
window.document.body.removeChild(a);