From f488212c3de960714ae1f4464cdddc033b759565 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Thu, 6 Oct 2022 23:43:24 +0200 Subject: [PATCH] Don't thumbnail message inline images and show filename in title attribute --- dev/Common/Html.js | 1 + dev/Model/Attachment.js | 12 +++++++++--- dev/Styles/User/MessageView.less | 5 +++++ .../v/0.0.0/app/libraries/MailSo/Mail/Attachment.php | 2 +- .../app/templates/Views/User/MailMessageView.html | 4 ++-- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/dev/Common/Html.js b/dev/Common/Html.js index 3841e631e..07a2e9d0a 100644 --- a/dev/Common/Html.js +++ b/dev/Common/Html.js @@ -308,6 +308,7 @@ export const attachment = findAttachmentByCid(value); if (attachment?.download) { oElement.src = attachment.linkPreview(); + oElement.title += ' ('+attachment.fileName+')'; attachment.isInline(true); attachment.isLinked(true); } diff --git a/dev/Model/Attachment.js b/dev/Model/Attachment.js index d7e8ae2f3..2b0d73b86 100644 --- a/dev/Model/Attachment.js +++ b/dev/Model/Attachment.js @@ -133,12 +133,18 @@ export class AttachmentModel extends AbstractModel { return this.url || serverRequestRaw('View', this.download); } + /** + * @returns {boolean} + */ + hasThumbnail() { + return this.isThumbnail && !this.isLinked(); + } + /** * @returns {string} */ - linkThumbnailPreviewStyle() { -// return (this.isThumbnail && !this.isLinked()) - return this.isThumbnail + thumbnailStyle() { + return this.hasThumbnail() ? 'background:url(' + serverRequestRaw('ViewThumbnail', this.download) + ')' : ''; } diff --git a/dev/Styles/User/MessageView.less b/dev/Styles/User/MessageView.less index 4494c33c8..cc4db40d6 100644 --- a/dev/Styles/User/MessageView.less +++ b/dev/Styles/User/MessageView.less @@ -318,6 +318,11 @@ html.rl-no-preview-pane { .attachmentList { margin: 0; +/* + min-height: 4em; + max-height: 15vh; + overflow: auto; +*/ } &:not(.selection-mode) { diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Attachment.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Attachment.php index a84938d1b..be7a7bafc 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Attachment.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Attachment.php @@ -92,7 +92,7 @@ class Attachment implements \JsonSerializable return \str_replace('/', $sIdx.'.', $sMimeType); } - return ($this->oBodyStructure->IsInline() ? 'part' : 'inline' ) . $sIdx; + return ($this->oBodyStructure->IsInline() ? 'inline' : 'part' ) . $sIdx; } public function MimeType() : string diff --git a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html index 28533a2c8..d98604868 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html @@ -236,8 +236,8 @@