mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Resolve #1332
This commit is contained in:
parent
638755bef3
commit
2916583d0b
6 changed files with 28 additions and 26 deletions
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
import { arrayLength } from 'Common/Utils';
|
import { arrayLength } from 'Common/Utils';
|
||||||
|
|
||||||
|
export const RFC822 = 'message/rfc822';
|
||||||
|
|
||||||
const
|
const
|
||||||
cache = {},
|
cache = {},
|
||||||
app = 'application/',
|
app = 'application/',
|
||||||
|
|
@ -12,8 +14,8 @@ const
|
||||||
lowerCase = text => text.toLowerCase().trim(),
|
lowerCase = text => text.toLowerCase().trim(),
|
||||||
|
|
||||||
exts = {
|
exts = {
|
||||||
eml: 'message/rfc822',
|
eml: RFC822,
|
||||||
mime: 'message/rfc822',
|
mime: RFC822,
|
||||||
vcard: 'text/vcard',
|
vcard: 'text/vcard',
|
||||||
vcf: 'text/vcard',
|
vcf: 'text/vcard',
|
||||||
htm: 'text/html',
|
htm: 'text/html',
|
||||||
|
|
@ -188,7 +190,7 @@ export const FileInfo = {
|
||||||
case ['php', 'js', 'css', 'xml', 'html'].includes(ext) || 'text/html' == mimeType:
|
case ['php', 'js', 'css', 'xml', 'html'].includes(ext) || 'text/html' == mimeType:
|
||||||
result = FileType.Code;
|
result = FileType.Code;
|
||||||
break;
|
break;
|
||||||
case 'eml' == ext || ['message/delivery-status', 'message/rfc822'].includes(mimeType):
|
case 'eml' == ext || ['message/delivery-status', RFC822].includes(mimeType):
|
||||||
result = FileType.Eml;
|
result = FileType.Eml;
|
||||||
break;
|
break;
|
||||||
case 'ics' == ext || mimeType == 'text/calendar':
|
case 'ics' == ext || mimeType == 'text/calendar':
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
|
import { RFC822 } from 'Common/File';
|
||||||
|
import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache';
|
||||||
import { isArray, arrayLength } from 'Common/Utils';
|
import { isArray, arrayLength } from 'Common/Utils';
|
||||||
import {
|
|
||||||
getFolderInboxName,
|
|
||||||
getFolderFromCacheList
|
|
||||||
} from 'Common/Cache';
|
|
||||||
import { SettingsUserStore } from 'Stores/User/Settings';
|
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||||
import { FolderUserStore } from 'Stores/User/Folder';
|
import { FolderUserStore } from 'Stores/User/Folder';
|
||||||
import { MessagelistUserStore } from 'Stores/User/Messagelist';
|
import { MessagelistUserStore } from 'Stores/User/Messagelist';
|
||||||
|
|
@ -194,7 +192,7 @@ folderInformationMultiply = (boot = false) => {
|
||||||
dropFilesInFolder = (sFolderFullName, files) => {
|
dropFilesInFolder = (sFolderFullName, files) => {
|
||||||
let count = files.length;
|
let count = files.length;
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if ('message/rfc822' === file.type) {
|
if (RFC822 === file.type) {
|
||||||
let data = new FormData;
|
let data = new FormData;
|
||||||
data.append('folder', sFolderFullName);
|
data.append('folder', sFolderFullName);
|
||||||
data.append('appendFile', file);
|
data.append('appendFile', file);
|
||||||
|
|
|
||||||
3
dev/External/User/ko.js
vendored
3
dev/External/User/ko.js
vendored
|
|
@ -1,5 +1,6 @@
|
||||||
import 'External/ko';
|
import 'External/ko';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
import { RFC822 } from 'Common/File';
|
||||||
import { HtmlEditor } from 'Common/Html';
|
import { HtmlEditor } from 'Common/Html';
|
||||||
import { timeToNode } from 'Common/Translator';
|
import { timeToNode } from 'Common/Translator';
|
||||||
import { doc, elementById, addEventsListeners, dropdowns, leftPanelDisabled } from 'Common/Globals';
|
import { doc, elementById, addEventsListeners, dropdowns, leftPanelDisabled } from 'Common/Globals';
|
||||||
|
|
@ -43,7 +44,7 @@ const rlContentType = 'snappymail/action',
|
||||||
let files = false;
|
let files = false;
|
||||||
// if (e.dataTransfer.types.includes('Files'))
|
// if (e.dataTransfer.types.includes('Files'))
|
||||||
for (const item of e.dataTransfer.items) {
|
for (const item of e.dataTransfer.items) {
|
||||||
files |= 'file' === item.kind && 'message/rfc822' === item.type;
|
files |= 'file' === item.kind && RFC822 === item.type;
|
||||||
}
|
}
|
||||||
if (files || dragMessages()) {
|
if (files || dragMessages()) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import { addObservablesTo, addComputablesTo } from 'External/ko';
|
||||||
import { FolderUserStore, isAllowedKeyword } from 'Stores/User/Folder';
|
import { FolderUserStore, isAllowedKeyword } from 'Stores/User/Folder';
|
||||||
import { SettingsUserStore } from 'Stores/User/Settings';
|
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||||
|
|
||||||
import { FileInfo } from 'Common/File';
|
import { FileInfo, RFC822 } from 'Common/File';
|
||||||
import { AttachmentCollectionModel } from 'Model/AttachmentCollection';
|
import { AttachmentCollectionModel } from 'Model/AttachmentCollection';
|
||||||
import { EmailCollectionModel } from 'Model/EmailCollection';
|
import { EmailCollectionModel } from 'Model/EmailCollection';
|
||||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||||
|
|
@ -186,7 +186,7 @@ export class MessageModel extends AbstractModel {
|
||||||
return b64EncodeJSONSafe({
|
return b64EncodeJSONSafe({
|
||||||
folder: this.folder,
|
folder: this.folder,
|
||||||
uid: this.uid,
|
uid: this.uid,
|
||||||
mimeType: 'message/rfc822',
|
mimeType: RFC822,
|
||||||
fileName: (this.subject() || 'message-' + this.hash) + '.eml',
|
fileName: (this.subject() || 'message-' + this.hash) + '.eml',
|
||||||
accountHash: SettingsGet('accountHash')
|
accountHash: SettingsGet('accountHash')
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,16 @@ import ko from 'ko';
|
||||||
import { addObservablesTo, addComputablesTo } from 'External/ko';
|
import { addObservablesTo, addComputablesTo } from 'External/ko';
|
||||||
|
|
||||||
import { ScopeFolderList, ScopeMessageList, ScopeMessageView } from 'Common/Enums';
|
import { ScopeFolderList, ScopeMessageList, ScopeMessageView } from 'Common/Enums';
|
||||||
|
|
||||||
import { ComposeType, FolderType, MessageSetAction } from 'Common/EnumsUser';
|
import { ComposeType, FolderType, MessageSetAction } from 'Common/EnumsUser';
|
||||||
|
|
||||||
import { doc,
|
import { doc,
|
||||||
leftPanelDisabled, toggleLeftPanel,
|
leftPanelDisabled, toggleLeftPanel,
|
||||||
Settings, SettingsCapa,
|
Settings, SettingsCapa,
|
||||||
addEventsListeners, stopEvent,
|
addEventsListeners, stopEvent,
|
||||||
addShortcut, registerShortcut, formFieldFocused
|
addShortcut, registerShortcut, formFieldFocused
|
||||||
} from 'Common/Globals';
|
} from 'Common/Globals';
|
||||||
|
|
||||||
import { arrayLength } from 'Common/Utils';
|
import { arrayLength } from 'Common/Utils';
|
||||||
import { computedPaginatorHelper, showMessageComposer, populateMessageBody, downloadZip, moveAction } from 'Common/UtilsUser';
|
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 { isFullscreen, toggleFullscreen } from 'Common/Fullscreen';
|
||||||
|
|
||||||
import { mailBox } from 'Common/Links';
|
import { mailBox } from 'Common/Links';
|
||||||
|
|
@ -610,7 +607,7 @@ export class MailMessageList extends AbstractViewRight {
|
||||||
const dropZone = dom.querySelector('.listDragOver'),
|
const dropZone = dom.querySelector('.listDragOver'),
|
||||||
validFiles = oEvent => {
|
validFiles = oEvent => {
|
||||||
for (const item of oEvent.dataTransfer.items) {
|
for (const item of oEvent.dataTransfer.items) {
|
||||||
if ('file' === item.kind && 'message/rfc822' === item.type) {
|
if ('file' === item.kind && RFC822 === item.type) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import {
|
||||||
FolderType,
|
FolderType,
|
||||||
MessageSetAction
|
MessageSetAction
|
||||||
} from 'Common/EnumsUser';
|
} from 'Common/EnumsUser';
|
||||||
|
import { RFC822 } from 'Common/File';
|
||||||
import {
|
import {
|
||||||
elementById,
|
elementById,
|
||||||
keyScopeReal,
|
keyScopeReal,
|
||||||
|
|
@ -292,7 +292,19 @@ export class MailMessageView extends AbstractViewRight {
|
||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -326,14 +338,6 @@ export class MailMessageView extends AbstractViewRight {
|
||||||
fetchRaw(url).then(text =>
|
fetchRaw(url).then(text =>
|
||||||
showScreenPopup(OpenPgpImportPopupView, [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 {
|
} else {
|
||||||
download(url, attachment.fileName);
|
download(url, attachment.fileName);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue