mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
parent
25a786d584
commit
2037f21c45
|
@ -21,7 +21,6 @@ export class AttachmentModel extends AbstractModel {
|
|||
this.fileNameExt = '';
|
||||
this.fileType = FileType.Unknown;
|
||||
this.friendlySize = '';
|
||||
this.isLinked = false;
|
||||
this.isThumbnail = false;
|
||||
this.cid = '';
|
||||
this.contentLocation = '';
|
||||
|
@ -33,7 +32,8 @@ export class AttachmentModel extends AbstractModel {
|
|||
this.framed = false;
|
||||
|
||||
this.addObservables({
|
||||
isInline: false
|
||||
isInline: false,
|
||||
isLinked: false
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ export class AttachmentCollectionModel extends AbstractCollectionModel
|
|||
* @returns {boolean}
|
||||
*/
|
||||
hasVisible() {
|
||||
return !!this.find(item => !item.isLinked);
|
||||
return !!this.filter(item => !item.isLinked()).length;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,8 +65,8 @@ export class ComposeAttachmentModel extends AbstractModel {
|
|||
item.download,
|
||||
item.fileName,
|
||||
item.estimatedSize,
|
||||
item.isInline,
|
||||
item.isLinked,
|
||||
item.isInline(),
|
||||
item.isLinked(),
|
||||
item.cid,
|
||||
item.contentLocation
|
||||
);
|
||||
|
|
|
@ -397,8 +397,10 @@ export class MessageModel extends AbstractModel {
|
|||
|
||||
// Hide valid inline attachments in message view 'attachments' section
|
||||
oAttachments.forEach(oAttachment => {
|
||||
oAttachment.isLinked = result.foundCIDs.includes(oAttachment.contentId())
|
||||
|| result.foundContentLocationUrls.includes(oAttachment.contentLocation)
|
||||
let cid = oAttachment.contentId(),
|
||||
found = result.foundCIDs.includes(cid);
|
||||
oAttachment.isInline(found);
|
||||
oAttachment.isLinked(found || result.foundContentLocationUrls.includes(oAttachment.contentLocation));
|
||||
});
|
||||
this.hasAttachments(oAttachments.hasVisible());
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ const
|
|||
attachment.fileNameExt = '';
|
||||
attachment.fileType = FileType.Unknown;
|
||||
attachment.friendlySize = '';
|
||||
attachment.isLinked = false;
|
||||
attachment.isLinked(false);
|
||||
attachment.isThumbnail = false;
|
||||
attachment.contentLocation = '';
|
||||
attachment.download = '';
|
||||
|
@ -94,11 +94,14 @@ const
|
|||
*/
|
||||
attachment.cid = cid ? cid.value : '';
|
||||
if (cid && html) {
|
||||
let cid = 'cid:' + attachment.contentId();
|
||||
attachment.isInline(html.includes(cid));
|
||||
html = html
|
||||
let cid = 'cid:' + attachment.contentId(),
|
||||
found = html.includes(cid);
|
||||
attachment.isInline(found);
|
||||
attachment.isLinked(found);
|
||||
found && (html = html
|
||||
.replace('src="' + cid + '"', 'src="' + attachment.url + '"')
|
||||
.replace("src='" + cid + "'", "src='" + attachment.url + "'");
|
||||
.replace("src='" + cid + "'", "src='" + attachment.url + "'")
|
||||
);
|
||||
} else {
|
||||
message.attachments.push(attachment);
|
||||
}
|
||||
|
@ -582,7 +585,7 @@ export class MailMessageView extends AbstractViewRight {
|
|||
|
||||
downloadAsZip() {
|
||||
const hashes = (currentMessage() ? currentMessage().attachments : [])
|
||||
.map(item => (item && !item.isLinked && item.checked() ? item.download : ''))
|
||||
.map(item => (item && !item.isLinked() && item.checked() ? item.download : ''))
|
||||
.filter(v => v);
|
||||
if (hashes.length) {
|
||||
Remote.attachmentsActions('Zip', hashes, this.downloadAsZipLoading)
|
||||
|
|
|
@ -221,7 +221,7 @@
|
|||
css: {'selection-mode' : showAttachmentControls, 'unselectedAttachmentsError': highlightUnselectedAttachments}">
|
||||
<ul class="attachmentList" data-bind="foreach: message() ? message().attachments() : []">
|
||||
<li class="attachmentItem" draggable="true"
|
||||
data-bind="visible: !isLinked, event: { 'dragstart': eventDragStart }, attr: { 'title': fileName }, css: {'checked': checked}">
|
||||
data-bind="visible: !isLinked(), event: { 'dragstart': eventDragStart }, attr: { 'title': fileName }, css: {'checked': checked}">
|
||||
<div class="attachmentIconParent" data-bind="css: { 'hasPreview': hasPreview(), 'hasPreplay': hasPreplay(), 'isImage': isImage() }">
|
||||
<i class="hidePreview iconMain" data-bind="css: iconClass()"></i>
|
||||
<div class="showPreview">
|
||||
|
|
Loading…
Reference in a new issue