This commit is contained in:
the-djmaze 2023-12-11 23:46:45 +01:00
parent 638755bef3
commit 2916583d0b
6 changed files with 28 additions and 26 deletions

View file

@ -2,19 +2,16 @@ import ko from 'ko';
import { addObservablesTo, addComputablesTo } from 'External/ko';
import { ScopeFolderList, ScopeMessageList, ScopeMessageView } from 'Common/Enums';
import { ComposeType, FolderType, MessageSetAction } from 'Common/EnumsUser';
import { doc,
leftPanelDisabled, toggleLeftPanel,
Settings, SettingsCapa,
addEventsListeners, stopEvent,
addShortcut, registerShortcut, formFieldFocused
} from 'Common/Globals';
import { arrayLength } from 'Common/Utils';
import { computedPaginatorHelper, showMessageComposer, populateMessageBody, downloadZip, moveAction } from 'Common/UtilsUser';
import { FileInfo } from 'Common/File';
import { FileInfo, RFC822 } from 'Common/File';
import { isFullscreen, toggleFullscreen } from 'Common/Fullscreen';
import { mailBox } from 'Common/Links';
@ -610,7 +607,7 @@ export class MailMessageList extends AbstractViewRight {
const dropZone = dom.querySelector('.listDragOver'),
validFiles = oEvent => {
for (const item of oEvent.dataTransfer.items) {
if ('file' === item.kind && 'message/rfc822' === item.type) {
if ('file' === item.kind && RFC822 === item.type) {
return true;
}
}

View file

@ -10,7 +10,7 @@ import {
FolderType,
MessageSetAction
} from 'Common/EnumsUser';
import { RFC822 } from 'Common/File';
import {
elementById,
keyScopeReal,
@ -292,7 +292,19 @@ export class MailMessageView extends AbstractViewRight {
return;
}
if (eqs(event, '.attachmentsPlace .showPreview')) {
el = eqs(event, '.attachmentsPlace .showPreview');
if (el) {
const attachment = ko.dataFor(el), url = attachment?.linkDownload();
// if (url && FileType.Eml === attachment.fileType) {
if (url && RFC822 == attachment.mimeType) {
stopEvent(event);
fetchRaw(url).then(text => {
const oMessage = new MessageModel();
MimeToMessage(text, oMessage);
// cleanHTML
oMessage.popupMessage();
});
}
return;
}
@ -326,14 +338,6 @@ export class MailMessageView extends AbstractViewRight {
fetchRaw(url).then(text =>
showScreenPopup(OpenPgpImportPopupView, [text])
);
} else if ('message/rfc822' == attachment.mimeType) {
// TODO
fetchRaw(url).then(text => {
const oMessage = new MessageModel();
MimeToMessage(text, oMessage);
// cleanHTML
oMessage.popupMessage();
});
} else {
download(url, attachment.fileName);
}