react-email-studio 3.8.0 → 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 +14 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -8
- 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 = "";
|
|
@@ -869,7 +874,7 @@ function videoUrlToEmbedSrc(url) {
|
|
|
869
874
|
if (vi) return `https://player.vimeo.com/video/${vi[1]}`;
|
|
870
875
|
return url;
|
|
871
876
|
}
|
|
872
|
-
var EMPTY_RICH_HTML = "
|
|
877
|
+
var EMPTY_RICH_HTML = "";
|
|
873
878
|
function unwrapAllDivElements(container) {
|
|
874
879
|
let el;
|
|
875
880
|
while (el = container.querySelector("div")) {
|
|
@@ -1175,13 +1180,14 @@ 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
|
-
|
|
1183
|
+
const body = textBlockContentToHtml(p.content);
|
|
1184
|
+
return `<div style="${pd(p.padding)};${marginCss()}${shell}"><div style="${inner}">${body}</div></div>`;
|
|
1179
1185
|
}
|
|
1180
1186
|
case "html": {
|
|
1181
1187
|
const shell = emailSurfaceBgCss(p);
|
|
1182
1188
|
const inner = `font-size:${lenPx(p.fontSize)};color:${p.color};text-align:${p.align};line-height:${lh(p.lineHeight)};letter-spacing:${lenPx(p.letterSpacing)};font-family:${p.fontFamily || "Georgia,serif"}`;
|
|
1183
1189
|
const bodyRaw = typeof cb.content === "string" ? cb.content : typeof p.content === "string" ? p.content : "";
|
|
1184
|
-
const body = enhanceRichHtmlForEmail(bodyRaw || "
|
|
1190
|
+
const body = enhanceRichHtmlForEmail(bodyRaw || "");
|
|
1185
1191
|
return `<div style="${pd(p.padding)};${marginCss()}${shell}"><div class="email-rich-html-inner" style="${inner}">${body}</div></div>`;
|
|
1186
1192
|
}
|
|
1187
1193
|
case "image": {
|
|
@@ -3019,7 +3025,7 @@ function ContentBlock({ block, selected, onClick, preview, C }) {
|
|
|
3019
3025
|
"div",
|
|
3020
3026
|
{
|
|
3021
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" },
|
|
3022
|
-
dangerouslySetInnerHTML: { __html: p.content }
|
|
3028
|
+
dangerouslySetInnerHTML: { __html: textBlockContentToHtml(p.content) }
|
|
3023
3029
|
}
|
|
3024
3030
|
)
|
|
3025
3031
|
);
|
|
@@ -3043,7 +3049,7 @@ function ContentBlock({ block, selected, onClick, preview, C }) {
|
|
|
3043
3049
|
wordBreak: "break-word",
|
|
3044
3050
|
minHeight: emptyRich && !preview ? "2.75em" : void 0
|
|
3045
3051
|
},
|
|
3046
|
-
dangerouslySetInnerHTML: { __html: richHtml || "
|
|
3052
|
+
dangerouslySetInnerHTML: { __html: richHtml || "" }
|
|
3047
3053
|
}
|
|
3048
3054
|
),
|
|
3049
3055
|
emptyRich && !preview ? /* @__PURE__ */ jsx3(
|
|
@@ -5948,10 +5954,10 @@ function ContentBlockEditor({ block, onChange, onClose, onUpload, C }) {
|
|
|
5948
5954
|
"textarea",
|
|
5949
5955
|
{
|
|
5950
5956
|
style: { ...IS, minHeight: 200, resize: "vertical", fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace", fontSize: 12, lineHeight: 1.45 },
|
|
5951
|
-
value:
|
|
5952
|
-
onChange: (e) => set("content",
|
|
5957
|
+
value: String(p.content ?? ""),
|
|
5958
|
+
onChange: (e) => set("content", e.target.value),
|
|
5953
5959
|
spellCheck: false,
|
|
5954
|
-
placeholder: "
|
|
5960
|
+
placeholder: "Write your text\u2026"
|
|
5955
5961
|
},
|
|
5956
5962
|
block.id
|
|
5957
5963
|
) }),
|