TF-3622 Synchronize all style attributes in html and write E2E for it.

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-04-14 02:38:34 +07:00
committed by Dat H. Pham
parent 6fb5e8cb79
commit c6bb268a75
5 changed files with 65 additions and 35 deletions
@@ -119,7 +119,7 @@ class DownloadClient {
fileName = fileName.split('.').first;
}
mimeType = HtmlUtils.validateHtmlImageResourceMimeType(mimeType);
final base64Uri = '<img src="${HtmlUtils.convertBase64ToImageResourceData(base64Data: base64Data, mimeType: mimeType)}" alt="$fileName" style="max-width: $maxWidth;" data-mimetype="$mimeType" id="cid:$cid" />';
final base64Uri = '<img src="${HtmlUtils.convertBase64ToImageResourceData(base64Data: base64Data, mimeType: mimeType)}" alt="$fileName" style="max-width:$maxWidth;" data-mimetype="$mimeType" id="cid:$cid" />';
return base64Uri;
}
}
+4 -17
View File
@@ -158,22 +158,9 @@ class HtmlInteraction {
function normalizeStyleAttribute(attrs) {
// Normalize style attribute to ensure proper responsive behavior
let style = attrs['style'];
const widthStr = attrs['width'];
if (!style) {
if (!widthStr) {
attrs['style'] = 'max-width: 100%;height: auto;display: inline;';
} else {
if (!style.includes('height')) {
style += 'height: auto;';
}
if (!style.includes('display')) {
style += 'display: inline;';
}
attrs['style'] = style;
}
attrs['style'] = 'max-width:100%;height:auto;display:inline;';
return;
}
@@ -199,15 +186,15 @@ class HtmlInteraction {
// Add responsive defaults if missing
if (!style.includes('max-width')) {
style += 'max-width: 100%;';
style += 'max-width:100%;';
}
if (!style.includes('height')) {
style += 'height: auto;';
style += 'height:auto;';
}
if (!style.includes('display')) {
style += 'display: inline;';
style += 'display:inline;';
}
attrs['style'] = style;