1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-07-11 01:10:20 +02:00

Merge branch 'release/v1.6.21'

This commit is contained in:
Ralph Slooten
2023-06-15 22:25:48 +12:00
2 changed files with 23 additions and 12 deletions

View File

@ -2,6 +2,12 @@
Notable changes to Mailpit will be documented in this file. Notable changes to Mailpit will be documented in this file.
## [v1.6.21]
### UI
- More accurate clickable hyperlink logic in plain text messages
## [v1.6.20] ## [v1.6.20]
### Feature ### Feature

View File

@ -167,21 +167,26 @@ export default {
// Convert plain text to HTML including anchor links // Convert plain text to HTML including anchor links
textToHTML: function (s) { textToHTML: function (s) {
// escape to HTML
let html = s let html = s
// full links with http(s)
let re = /(\b(https?|ftp):\/\/[\-\w@:%_\+.~#?,&\/\/=;]+)\b/gim
html = html.replace(re, '˱˱˱a href=ˠˠˠ$&ˠˠˠ target=_blank rel=noopener˲˲˲$&˱˱˱/a˲˲˲')
// plain www links without https?:// prefix
let re2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim
html = html.replace(re2, '$1˱˱˱a href=ˠˠˠhttp://$2ˠˠˠ target=ˠˠˠ_blankˠˠˠ rel=ˠˠˠnoopenerˠˠˠ˲˲˲$2˱˱˱/a˲˲˲')
// escape to HTML & convert <>" back
html = html
.replace(/&/g, "&amp;") .replace(/&/g, "&amp;")
.replace(/</g, "&lt;") .replace(/</g, "&lt;")
.replace(/>/g, "&gt;") .replace(/>/g, "&gt;")
.replace(/"/g, "&quot;") .replace(/"/g, "&quot;")
.replace(/'/g, "&#039;") .replace(/'/g, "&#039;")
.replace(/˱˱˱/g, '<')
// full links with http(s) .replace(/˲˲˲/g, '>')
let re = /(\b(https?|ftp):\/\/[\-\w@:%_\+.~#?,&\/\/=;]+)\b/gim .replace(/ˠˠˠ/g, '"')
html = html.replace(re, '<a href="$&" target="_blank" rel="noopener">$&</a>')
// plain www links without https?:// prefix
let re2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim
html = html.replace(re2, '$1<a href="http://$2" target="_blank" rel="noopener">$2</a>')
return html return html
} }
@ -326,7 +331,7 @@ export default {
aria-labelledby="nav-html-tab" tabindex="0"> aria-labelledby="nav-html-tab" tabindex="0">
<div id="responsive-view" :class="scaleHTMLPreview" :style="responsiveSizes[scaleHTMLPreview]"> <div id="responsive-view" :class="scaleHTMLPreview" :style="responsiveSizes[scaleHTMLPreview]">
<iframe target-blank="" class="tab-pane d-block" id="preview-html" :srcdoc="message.HTML" <iframe target-blank="" class="tab-pane d-block" id="preview-html" :srcdoc="message.HTML"
v-on:load="resizeIframe" seamless frameborder="0" style="width: 100%; height: 100%;"> v-on:load="resizeIframe" frameborder="0" style="width: 100%; height: 100%;">
</iframe> </iframe>
</div> </div>
<Attachments v-if="allAttachments(message).length" :message="message" <Attachments v-if="allAttachments(message).length" :message="message"
@ -346,8 +351,8 @@ export default {
<Headers v-if="loadHeaders" :message="message"></Headers> <Headers v-if="loadHeaders" :message="message"></Headers>
</div> </div>
<div class="tab-pane fade" id="nav-raw" role="tabpanel" aria-labelledby="nav-raw-tab" tabindex="0"> <div class="tab-pane fade" id="nav-raw" role="tabpanel" aria-labelledby="nav-raw-tab" tabindex="0">
<iframe v-if="srcURI" :src="srcURI" v-on:load="resizeIframe" seamless frameborder="0" <iframe v-if="srcURI" :src="srcURI" v-on:load="resizeIframe" frameborder="0"
style="width: 100%; height: 300px;" id="message-src"></iframe> style="width: 100%; height: 300px; background: #fff; color: #15141A"></iframe>
</div> </div>
</div> </div>
</div> </div>