email-builder-utils 1.1.54 → 1.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/utils/blocks/text.ts"],"names":[],"mappings":"AASA,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,aAAa,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/utils/blocks/text.ts"],"names":[],"mappings":"AASA,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,aAAa,CAAC,EAAE,MAAM,UAsKtE"}
|
|
@@ -62,14 +62,17 @@ function convertTextBlock(blockData, cellWidthInPx) {
|
|
|
62
62
|
.replace(/<\/p>/gi, "</div>");
|
|
63
63
|
const navigateToUrl = props.navigateToUrl || "";
|
|
64
64
|
const fontSizeStyle = fontSize != null ? `font-size:${fontSize}px;` : "";
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
// text-decoration so inline links match the surrounding text appearance.
|
|
65
|
+
// Links default to standard link blue + underline. Preserve any color or
|
|
66
|
+
// text-decoration the user explicitly set; only inject what is missing.
|
|
68
67
|
const blockTextColor = rest.color;
|
|
69
68
|
const processedText = sanitizedText.replace(/<a(\s[^>]*)?>/gi, (_match, attrs = '') => {
|
|
70
69
|
const hasExistingColor = /style\s*=\s*["'][^"']*\bcolor\s*:/i.test(attrs);
|
|
71
|
-
const
|
|
72
|
-
const
|
|
70
|
+
const hasExistingDecoration = /style\s*=\s*["'][^"']*\btext-decoration\s*:/i.test(attrs);
|
|
71
|
+
const colorPart = hasExistingColor ? '' : 'color:#0066CC;';
|
|
72
|
+
const decorationPart = hasExistingDecoration ? '' : 'text-decoration:underline;';
|
|
73
|
+
const injected = `${colorPart}${decorationPart}`;
|
|
74
|
+
if (!injected)
|
|
75
|
+
return `<a${attrs}>`;
|
|
73
76
|
if (/\bstyle\s*=/i.test(attrs)) {
|
|
74
77
|
return `<a${attrs.replace(/(\bstyle\s*=\s*["'])/, `$1${injected}`)}>`;
|
|
75
78
|
}
|