mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Allow <body> element CSS as .mail-body
This commit is contained in:
parent
d11118a159
commit
8058c8d2f6
1 changed files with 8 additions and 3 deletions
|
|
@ -144,7 +144,12 @@ const
|
||||||
|
|
||||||
let selector = arr[arr[2] === undefined ? 5 : 2].split('\r\n').join('\n').trim()
|
let selector = arr[arr[2] === undefined ? 5 : 2].split('\r\n').join('\n').trim()
|
||||||
// Never have more than a single line break in a row
|
// Never have more than a single line break in a row
|
||||||
.replace(/\n+/, "\n");
|
.replace(/\n+/, "\n")
|
||||||
|
// Remove :root and html
|
||||||
|
.split(/\s+/g).map(item => item
|
||||||
|
.replace(/^body$/, '.mail-body')
|
||||||
|
.replace(/^(:root|html)$/, '')
|
||||||
|
).join(' ').trim();
|
||||||
|
|
||||||
// determine the type
|
// determine the type
|
||||||
if (selector.includes('@media')) {
|
if (selector.includes('@media')) {
|
||||||
|
|
@ -154,7 +159,7 @@ const
|
||||||
type: 'media',
|
type: 'media',
|
||||||
subStyles: parseCSS(arr[3] + '\n}') //recursively parse media query inner css
|
subStyles: parseCSS(arr[3] + '\n}') //recursively parse media query inner css
|
||||||
});
|
});
|
||||||
} else if (!selector.includes('@') && ![':root','html','body'].includes(selector)) {
|
} else if (selector && !selector.includes('@')) {
|
||||||
// we have standard css
|
// we have standard css
|
||||||
css.push({
|
css.push({
|
||||||
selector: selector,
|
selector: selector,
|
||||||
|
|
@ -288,7 +293,7 @@ export const
|
||||||
let css = msgId ? parseCSS(oElement.textContent) : [];
|
let css = msgId ? parseCSS(oElement.textContent) : [];
|
||||||
if (css.length) {
|
if (css.length) {
|
||||||
css.applyNamespace(msgId, 'msg-');
|
css.applyNamespace(msgId, 'msg-');
|
||||||
css = css.toString();
|
css = css.toString().replace('.msg-mail-body', '.mail-body');
|
||||||
if (SettingsUserStore.removeColors()) {
|
if (SettingsUserStore.removeColors()) {
|
||||||
css = css.replace(/(background-)?color:[^};]+;?/g, '');
|
css = css.replace(/(background-)?color:[^};]+;?/g, '');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue