diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index 9e9f5ef82..253ef2cf1 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -80,14 +80,6 @@ function splitPlainText(text, len = 100) { return prefix + result; } -/** - * @param {any} m - * @returns {any} - */ -export function deModule(m) { - return (m && m.default ? m.default : m) || ''; -} - /** * @returns {boolean} */ diff --git a/dev/Html/PreviewMessage.html b/dev/Html/PreviewMessage.html index f5e6d1719..dc982e2d9 100644 --- a/dev/Html/PreviewMessage.html +++ b/dev/Html/PreviewMessage.html @@ -2,110 +2,61 @@ - - - {{title}} + {{subject}} -
-
{{subject}}
-
-
-
{{date}}
-
{{fromCreds}}
-
{{toLabel}}: {{toCreds}}
-
{{ccLabel}}: {{ccCreds}}
-
+
+

{{subject}}

+ +
{{fromCreds}}
+
{{toLabel}}: {{toCreds}}
+
{{ccLabel}}: {{ccCreds}}
+
{{html}}
- \ No newline at end of file + diff --git a/dev/Model/Message.js b/dev/Model/Message.js index b03e2c109..9d568f626 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -5,7 +5,6 @@ import { i18n } from 'Common/Translator'; import { pInt, - deModule, encodeHtml, friendlySize } from 'Common/Utils'; @@ -518,21 +517,19 @@ class MessageModel extends AbstractModel { ccLine = this.ccToLine(false), m = 0 < timeStampInUTC ? new Date(timeStampInUTC * 1000) : null, win = open(''), - doc = win.document; - - doc.write( - deModule(require('Html/PreviewMessage.html')) - .replace('{{title}}', encodeHtml(this.subject())) - .replace('{{subject}}', encodeHtml(this.subject())) - .replace('{{date}}', encodeHtml(m ? m.format('LLL') : '')) - .replace('{{fromCreds}}', encodeHtml(this.fromToLine(false))) - .replace('{{toCreds}}', encodeHtml(this.toToLine(false))) - .replace('{{toLabel}}', encodeHtml(i18n('MESSAGE/LABEL_TO'))) - .replace('{{ccClass}}', encodeHtml(ccLine ? '' : 'rl-preview-hide')) - .replace('{{ccCreds}}', encodeHtml(ccLine)) - .replace('{{ccLabel}}', encodeHtml(i18n('MESSAGE/LABEL_CC'))) - .replace('{{bodyClass}}', this.isHtml() ? 'html' : 'plain') - .replace('{{html}}', this.bodyAsHTML()) + doc = win.document, + html = require('Html/PreviewMessage.html'); + doc.write((html.default) + .replace(/{{subject}}/g, encodeHtml(this.subject())) + .replace('{{date}}', encodeHtml(m ? m.format('LLL') : '')) + .replace('{{fromCreds}}', encodeHtml(this.fromToLine(false))) + .replace('{{toCreds}}', encodeHtml(this.toToLine(false))) + .replace('{{toLabel}}', encodeHtml(i18n('MESSAGE/LABEL_TO'))) + .replace('{{ccHide}}', ccLine ? '' : 'hidden=""') + .replace('{{ccCreds}}', encodeHtml(ccLine)) + .replace('{{ccLabel}}', encodeHtml(i18n('MESSAGE/LABEL_CC'))) + .replace('{{bodyClass}}', this.isHtml() ? 'html' : 'plain') + .replace('{{html}}', this.bodyAsHTML()) ); doc.close();