#89 added downloading of decrypted attachments

This commit is contained in:
the-djmaze 2022-02-10 16:35:55 +01:00
parent 4a1c3beb78
commit 25a786d584
5 changed files with 36 additions and 30 deletions

View file

@ -1,11 +1,12 @@
import { ComposeType/*, FolderType*/ } from 'Common/EnumsUser';
import { EmailModel } from 'Model/Email';
import { isArray } from 'Common/Utils';
import { createElement } from 'Common/Globals';
import { doc, createElement } from 'Common/Globals';
import { FolderUserStore } from 'Stores/User/Folder';
import { SettingsUserStore } from 'Stores/User/Settings';
import * as Local from 'Storage/Client';
import { plainToHtml } from 'Common/Html';
import { ThemeStore } from 'Stores/Theme';
export const
@ -20,6 +21,24 @@ sortFolders = folders => {
}
},
/**
* @param {string} link
* @returns {boolean}
*/
download = (link, name = "") => {
if (ThemeStore.isMobile()) {
open(link, '_self');
focus();
} else {
const oLink = createElement('a');
oLink.href = link;
oLink.target = '_blank';
oLink.download = name;
doc.body.appendChild(oLink).click();
oLink.remove();
}
},
/**
* @param {Array=} aDisabled
* @param {Array=} aHeaderLines