Merge branch 'master' into rtl-support

This commit is contained in:
the-djmaze 2023-04-18 09:54:24 +02:00
commit 9cabfe7570
12 changed files with 92 additions and 48 deletions

View file

@ -265,8 +265,6 @@ export const
}
tmpl.innerHTML = html
// Strip Microsoft comments
.replace(/<!--\[if[\s\S]*?-->/gi, '')
// .replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, pre => pre.replace(/\n/g, '\n<br>'))
// Not supported by <template> element
// .replace(/<!doctype[^>]*>/gi, '')
@ -280,8 +278,7 @@ export const
.trim();
html = '';
// \MailSo\Base\HtmlUtils::ClearComments()
// https://github.com/the-djmaze/snappymail/issues/187
// Strip all comments
const nodeIterator = document.createNodeIterator(tmpl.content, NodeFilter.SHOW_COMMENT);
while (nodeIterator.nextNode()) {
nodeIterator.referenceNode.remove();
@ -531,11 +528,12 @@ export const
if (urls_broken.length) {
setAttribute('data-x-style-broken-urls', JSON.stringify(urls_broken));
}
/*
// https://github.com/the-djmaze/snappymail/issues/1082
if (11 > pInt(oStyle.fontSize)) {
oStyle.removeProperty('font-size');
}
*/
// Removes background and color
// Many e-mails incorrectly only define one, not both
// And in dark theme mode this kills the readability

View file

@ -1355,10 +1355,15 @@ export class ComposePopupView extends AbstractViewPopup {
async getMessageRequestParams(sSaveFolder, draft)
{
let Text = this.oEditor.getData().trim(),
l = Text.length,
hasAttachments = 0;
// Prepare ComposeAttachmentModel attachments
const attachments = {};
this.attachments.forEach(item => {
if (item?.complete() && item?.tempName() && item?.enabled()) {
++hasAttachments;
attachments[item.tempName()] = {
name: item.fileName(),
inline: item.isInline,
@ -1369,6 +1374,10 @@ export class ComposePopupView extends AbstractViewPopup {
}
});
if (!draft && !l && !hasAttachments) {
throw i18n('COMPOSE/ERROR_EMPTY_BODY');
}
const
identity = this.currentIdentity(),
params = {
@ -1397,12 +1406,7 @@ export class ComposePopupView extends AbstractViewPopup {
encrypt = this.pgpEncrypt() && this.canPgpEncrypt(),
isHtml = this.oEditor.isHtml();
let Text = this.oEditor.getData().trim();
if (!draft && !Text.length) {
throw i18n('COMPOSE/ERROR_EMPTY_BODY');
}
if (isHtml) {
let l;
do {
l = Text.length;
Text = Text