This commit is contained in:
the-djmaze 2022-03-13 19:51:14 +01:00
parent 42813b90dd
commit 58f5e90f8f
3 changed files with 6 additions and 11 deletions

View file

@ -95,9 +95,7 @@ export const
]; ];
tpl.innerHTML = html tpl.innerHTML = html
.replace(/(<pre[^>]*>)([\s\S]*?)(<\/pre>)/gi, aMatches => { // .replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, pre => pre.replace(/\n/g, '\n<br>'))
return (aMatches[1] + aMatches[2].trim() + aMatches[3].trim()).replace(/\r?\n/g, '<br>');
})
.replace(/<!doctype[^>]*>/gi, '') .replace(/<!doctype[^>]*>/gi, '')
.replace(/<\?xml[^>]*\?>/gi, '') .replace(/<\?xml[^>]*\?>/gi, '')
// Not supported by <template> element // Not supported by <template> element

View file

@ -64,16 +64,14 @@
} }
pre, code { pre, code {
margin: 0;
padding: 0;
background: #fff;
border: none; border: none;
border-radius: 0; border-radius: 0;
font-family: var(--fontMono);
display: block; display: block;
font-family: var(--fontMono);
margin: 0;
padding: 0;
word-break: normal; word-break: normal;
word-wrap: break-word; word-wrap: break-word;
background-color: #f9f9f9;
} }
code { code {
@ -82,9 +80,8 @@
} }
pre { pre {
padding: 5px 10px;
border-radius: 5px; border-radius: 5px;
background-color: #f9f9f9; padding: 5px 10px;
} }
pre > code { pre > code {

View file

@ -222,7 +222,7 @@ abstract class HtmlUtils
} }
return '<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>' return '<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>'
. \MailSo\Base\Utils::StripSpaces($oDoc->saveHTML($oBody)) . '</html>'; . $oDoc->saveHTML($oBody) . '</html>';
} }
public static function ConvertPlainToHtml(string $sText, bool $bLinksWithTargetBlank = true) : string public static function ConvertPlainToHtml(string $sText, bool $bLinksWithTargetBlank = true) : string