react-email-studio 3.8.1 → 3.8.2
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.
- package/CHANGELOG.md +10 -0
- package/README.md +3 -2
- package/RELEASE.md +137 -0
- package/dist/index.cjs +7 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -835,6 +835,11 @@ function escHtmlAttr(s) {
|
|
|
835
835
|
function escHtml(s) {
|
|
836
836
|
return String(s ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
837
837
|
}
|
|
838
|
+
function textBlockContentToHtml(content) {
|
|
839
|
+
const raw = typeof content === "string" ? content : "";
|
|
840
|
+
if (/^\s*<[^>]+>/.test(raw)) return raw;
|
|
841
|
+
return escHtml(raw).replace(/\r?\n/g, "<br/>");
|
|
842
|
+
}
|
|
838
843
|
function utf8ToBase64(raw) {
|
|
839
844
|
const bytes = new TextEncoder().encode(raw);
|
|
840
845
|
let bin = "";
|
|
@@ -1175,8 +1180,7 @@ function blockToHtml(cb) {
|
|
|
1175
1180
|
case "text": {
|
|
1176
1181
|
const shell = emailSurfaceBgCss(p);
|
|
1177
1182
|
const inner = `font-size:${lenPx(p.fontSize)};color:${p.color};text-align:${p.align};font-weight:${p.fontWeight || 400};font-style:${p.italic ? "italic" : "normal"};text-decoration:${p.underline ? "underline" : "none"};line-height:${lh(p.lineHeight)};letter-spacing:${lenPx(p.letterSpacing)};font-family:${p.fontFamily || "Georgia,serif"}`;
|
|
1178
|
-
const
|
|
1179
|
-
const body = /^\s*<[^>]+>/.test(content) ? content : escHtml(content).replace(/\r?\n/g, "<br/>");
|
|
1183
|
+
const body = textBlockContentToHtml(p.content);
|
|
1180
1184
|
return `<div style="${pd(p.padding)};${marginCss()}${shell}"><div style="${inner}">${body}</div></div>`;
|
|
1181
1185
|
}
|
|
1182
1186
|
case "html": {
|
|
@@ -3021,7 +3025,7 @@ function ContentBlock({ block, selected, onClick, preview, C }) {
|
|
|
3021
3025
|
"div",
|
|
3022
3026
|
{
|
|
3023
3027
|
style: { fontSize: p.fontSize, color: p.color, textAlign: p.align, fontWeight: p.fontWeight || (p.bold ? 700 : 400), fontStyle: p.italic ? "italic" : "normal", textDecoration: p.underline ? "underline" : "none", lineHeight: p.lineHeight || 1.65, letterSpacing: `${p.letterSpacing || 0}px`, fontFamily: p.fontFamily || "Georgia,serif" },
|
|
3024
|
-
dangerouslySetInnerHTML: { __html: p.content }
|
|
3028
|
+
dangerouslySetInnerHTML: { __html: textBlockContentToHtml(p.content) }
|
|
3025
3029
|
}
|
|
3026
3030
|
)
|
|
3027
3031
|
);
|