Skip to content

Commit

Permalink
Attachments in "new window" view #1166
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Jun 22, 2023
1 parent 1a499f6 commit 739a2ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions dev/Html/PreviewMessage.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
body > * {
padding: 0.5em 1em;
}

#attachments > * {
border: 1px solid rgba(125,128,128,0.5);
padding: 0.25em;
margin-right: 1em;
}
</style>
</head>
<body></body>
Expand Down
6 changes: 5 additions & 1 deletion dev/Model/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,17 @@ export class MessageModel extends AbstractModel {
+ (bccLine ? `<div>${encodeHtml(i18n('GLOBAL/BCC'))}: ${encodeHtml(bccLine)}</div>` : ''),
style = getComputedStyle(doc.querySelector('.messageView')),
prop = property => style.getPropertyValue(property);
let attachments = '';
this.attachments.forEach(attachment => {
attachments += `<a href="${attachment.linkDownload()}">${attachment.fileName}</a>`;
});
sdoc.write(PreviewHTML
.replace('<title>', '<title>'+subject)
// eslint-disable-next-line max-len
.replace('<body>', `<body style="background-color:${prop('background-color')};color:${prop('color')}"><header><h1>${subject}</h1><time>${encodeHtml(m ? m.format('LLL',0,LanguageStore.hourCycle()) : '')}</time><div>${encodeHtml(this.from)}</div>${to}</header><${mode}>${this.bodyAsHTML()}</${mode}>`)
.replace('</body>', `<div id="attachments">${attachments}</div></body>`)
);
sdoc.close();

print && setTimeout(() => win.print(), 100);
}

Expand Down

0 comments on commit 739a2ce

Please sign in to comment.