mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 15:45:55 +08:00
Always show option to view as plain, by converting message HTML when plain is missing
This commit is contained in:
parent
e6fc06b346
commit
a5bff8674a
|
@ -4,7 +4,7 @@ import { MessagePriority } from 'Common/EnumsUser';
|
||||||
import { i18n } from 'Common/Translator';
|
import { i18n } from 'Common/Translator';
|
||||||
|
|
||||||
import { doc, SettingsGet } from 'Common/Globals';
|
import { doc, SettingsGet } from 'Common/Globals';
|
||||||
import { encodeHtml, plainToHtml, cleanHtml } from 'Common/Html';
|
import { encodeHtml, plainToHtml, htmlToPlain, cleanHtml } from 'Common/Html';
|
||||||
import { arrayLength, forEachObjectEntry } from 'Common/Utils';
|
import { arrayLength, forEachObjectEntry } from 'Common/Utils';
|
||||||
import { serverRequestRaw, proxy } from 'Common/Links';
|
import { serverRequestRaw, proxy } from 'Common/Links';
|
||||||
|
|
||||||
|
@ -407,13 +407,16 @@ export class MessageModel extends AbstractModel {
|
||||||
|
|
||||||
viewPlain() {
|
viewPlain() {
|
||||||
const body = this.body;
|
const body = this.body;
|
||||||
if (body && this.plain()) {
|
if (body) {
|
||||||
body.classList.toggle('html', 0);
|
body.classList.toggle('html', 0);
|
||||||
body.classList.toggle('plain', 1);
|
body.classList.toggle('plain', 1);
|
||||||
body.innerHTML = plainToHtml(
|
body.innerHTML = plainToHtml(
|
||||||
this.plain()
|
(this.plain()
|
||||||
.replace(/-----BEGIN PGP (SIGNED MESSAGE-----(\r?\n[a-z][^\r\n]+)+|SIGNATURE-----[\s\S]*)/, '')
|
? this.plain()
|
||||||
.trim()
|
.replace(/-----BEGIN PGP (SIGNED MESSAGE-----(\r?\n[a-z][^\r\n]+)+|SIGNATURE-----[\s\S]*)/, '')
|
||||||
|
.trim()
|
||||||
|
: htmlToPlain(body.innerHTML)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
this.isHtml(false);
|
this.isHtml(false);
|
||||||
this.hasImages(false);
|
this.hasImages(false);
|
||||||
|
|
|
@ -100,7 +100,7 @@
|
||||||
<li role="presentation" data-bind="visible: html() && !isHtml()">
|
<li role="presentation" data-bind="visible: html() && !isHtml()">
|
||||||
<a href="#" tabindex="-1" data-bind="click: viewHtml" data-icon="👁" data-i18n="MESSAGE/HTML_VIEW"></a>
|
<a href="#" tabindex="-1" data-bind="click: viewHtml" data-icon="👁" data-i18n="MESSAGE/HTML_VIEW"></a>
|
||||||
</li>
|
</li>
|
||||||
<li role="presentation" data-bind="visible: plain() && isHtml()">
|
<li role="presentation" data-bind="visible: isHtml()">
|
||||||
<a href="#" tabindex="-1" data-bind="click: viewPlain" data-icon="👁" data-i18n="MESSAGE/PLAIN_VIEW"></a>
|
<a href="#" tabindex="-1" data-bind="click: viewPlain" data-icon="👁" data-i18n="MESSAGE/PLAIN_VIEW"></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="dividerbar" role="presentation">
|
<li class="dividerbar" role="presentation">
|
||||||
|
|
Loading…
Reference in a new issue