mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +03:00
Move SettingsUserStore.removeColors() to cleanHtml()
This commit is contained in:
parent
33b228a86f
commit
5c43378d71
2 changed files with 6 additions and 6 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
import { createElement } from 'Common/Globals';
|
import { createElement } from 'Common/Globals';
|
||||||
import { forEachObjectEntry, pInt } from 'Common/Utils';
|
import { forEachObjectEntry, pInt } from 'Common/Utils';
|
||||||
|
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||||
|
|
||||||
const
|
const
|
||||||
tpl = createElement('template'),
|
tpl = createElement('template'),
|
||||||
|
|
@ -36,7 +37,7 @@ export const
|
||||||
* @param {string} text
|
* @param {string} text
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
cleanHtml = (html, oAttachments, removeColors) => {
|
cleanHtml = (html, oAttachments) => {
|
||||||
const
|
const
|
||||||
debug = false, // Config()->Get('debug', 'enable', false);
|
debug = false, // Config()->Get('debug', 'enable', false);
|
||||||
detectHiddenImages = true, // !!SettingsGet('try_to_detect_hidden_images'),
|
detectHiddenImages = true, // !!SettingsGet('try_to_detect_hidden_images'),
|
||||||
|
|
@ -354,7 +355,7 @@ export const
|
||||||
// Removes background and color
|
// Removes background and color
|
||||||
// Many e-mails incorrectly only define one, not both
|
// Many e-mails incorrectly only define one, not both
|
||||||
// And in dark theme mode this kills the readability
|
// And in dark theme mode this kills the readability
|
||||||
if (removeColors) {
|
if (SettingsUserStore.removeColors()) {
|
||||||
oStyle.removeProperty('background-color');
|
oStyle.removeProperty('background-color');
|
||||||
oStyle.removeProperty('background-image');
|
oStyle.removeProperty('background-image');
|
||||||
oStyle.removeProperty('color');
|
oStyle.removeProperty('color');
|
||||||
|
|
|
||||||
|
|
@ -454,7 +454,7 @@ export class MessageModel extends AbstractModel {
|
||||||
viewHtml() {
|
viewHtml() {
|
||||||
const body = this.body;
|
const body = this.body;
|
||||||
if (body && this.html()) {
|
if (body && this.html()) {
|
||||||
let result = cleanHtml(this.html(), this.attachments(), SettingsUserStore.removeColors());
|
let result = cleanHtml(this.html(), this.attachments());
|
||||||
this.hasExternals(result.hasExternals);
|
this.hasExternals(result.hasExternals);
|
||||||
this.hasImages(body.rlHasImages = !!result.hasExternals);
|
this.hasImages(body.rlHasImages = !!result.hasExternals);
|
||||||
|
|
||||||
|
|
@ -629,8 +629,7 @@ export class MessageModel extends AbstractModel {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
bodyAsHTML() {
|
bodyAsHTML() {
|
||||||
// if (this.body && !this.body.querySelector('iframe[src*=decrypt]')) {
|
if (this.body) {
|
||||||
if (this.body && !this.body.querySelector('iframe')) {
|
|
||||||
let clone = this.body.cloneNode(true);
|
let clone = this.body.cloneNode(true);
|
||||||
clone.querySelectorAll('blockquote.rl-bq-switcher').forEach(
|
clone.querySelectorAll('blockquote.rl-bq-switcher').forEach(
|
||||||
node => node.classList.remove('rl-bq-switcher','hidden-bq')
|
node => node.classList.remove('rl-bq-switcher','hidden-bq')
|
||||||
|
|
@ -640,7 +639,7 @@ export class MessageModel extends AbstractModel {
|
||||||
);
|
);
|
||||||
return clone.innerHTML;
|
return clone.innerHTML;
|
||||||
}
|
}
|
||||||
let result = cleanHtml(this.html(), this.attachments(), SettingsUserStore.removeColors())
|
let result = cleanHtml(this.html(), this.attachments())
|
||||||
return result.html || plainToHtml(this.plain());
|
return result.html || plainToHtml(this.plain());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue