react-email-studio 3.1.1 → 3.2.0
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 +27 -0
- package/README.md +5 -1
- package/TUTORIAL.md +1 -2
- package/dist/index.cjs +103 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -4
- package/dist/index.d.ts +0 -4
- package/dist/index.js +109 -113
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -108,10 +108,6 @@ type ReactEmailEditorOptions = EmailHtmlOptions & {
|
|
|
108
108
|
customThemes?: Record<string, ThemeColors>;
|
|
109
109
|
};
|
|
110
110
|
locale?: string;
|
|
111
|
-
mergeTags?: {
|
|
112
|
-
name: string;
|
|
113
|
-
value: string;
|
|
114
|
-
}[];
|
|
115
111
|
features?: {
|
|
116
112
|
autoSave?: {
|
|
117
113
|
enabled?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -108,10 +108,6 @@ type ReactEmailEditorOptions = EmailHtmlOptions & {
|
|
|
108
108
|
customThemes?: Record<string, ThemeColors>;
|
|
109
109
|
};
|
|
110
110
|
locale?: string;
|
|
111
|
-
mergeTags?: {
|
|
112
|
-
name: string;
|
|
113
|
-
value: string;
|
|
114
|
-
}[];
|
|
115
111
|
features?: {
|
|
116
112
|
autoSave?: {
|
|
117
113
|
enabled?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
useRef as useRef6,
|
|
5
5
|
useEffect as useEffect6,
|
|
6
6
|
useCallback as useCallback2,
|
|
7
|
-
useMemo as
|
|
7
|
+
useMemo as useMemo3,
|
|
8
8
|
forwardRef,
|
|
9
9
|
useImperativeHandle,
|
|
10
10
|
Fragment as Fragment6
|
|
@@ -120,7 +120,6 @@ var I18N = {
|
|
|
120
120
|
delete: "Delete",
|
|
121
121
|
moveUp: "Move Up",
|
|
122
122
|
moveDown: "Move Down",
|
|
123
|
-
mergeTags: "Merge Tags",
|
|
124
123
|
autoSaved: "Auto-saved",
|
|
125
124
|
search: "Search blocks\u2026",
|
|
126
125
|
zoomIn: "Zoom In",
|
|
@@ -179,7 +178,6 @@ var I18N = {
|
|
|
179
178
|
delete: "Supprimer",
|
|
180
179
|
moveUp: "Monter",
|
|
181
180
|
moveDown: "Descendre",
|
|
182
|
-
mergeTags: "Balises fusion",
|
|
183
181
|
autoSaved: "Auto-sauvegard\xE9",
|
|
184
182
|
search: "Rechercher\u2026",
|
|
185
183
|
colorScheme: "Sch\xE9ma de couleurs",
|
|
@@ -239,7 +237,6 @@ var I18N = {
|
|
|
239
237
|
delete: "L\xF6schen",
|
|
240
238
|
moveUp: "Nach oben",
|
|
241
239
|
moveDown: "Nach unten",
|
|
242
|
-
mergeTags: "Merge-Tags",
|
|
243
240
|
autoSaved: "Auto-gespeichert",
|
|
244
241
|
search: "Bl\xF6cke suchen\u2026",
|
|
245
242
|
colorScheme: "Farbschema",
|
|
@@ -297,7 +294,6 @@ var I18N = {
|
|
|
297
294
|
delete: "Eliminar",
|
|
298
295
|
moveUp: "Subir",
|
|
299
296
|
moveDown: "Bajar",
|
|
300
|
-
mergeTags: "Etiquetas de fusi\xF3n",
|
|
301
297
|
autoSaved: "Auto-guardado",
|
|
302
298
|
search: "Buscar bloques\u2026",
|
|
303
299
|
zoomIn: "Zoom +",
|
|
@@ -2206,9 +2202,8 @@ function useLiveCountdown(endDate) {
|
|
|
2206
2202
|
const s = Math.floor(diff % 6e4 / 1e3);
|
|
2207
2203
|
return [d, h, m, s];
|
|
2208
2204
|
}
|
|
2209
|
-
function editChromeBorder(
|
|
2210
|
-
|
|
2211
|
-
return { border: `1px dotted ${C.border}`, boxSizing: "border-box" };
|
|
2205
|
+
function editChromeBorder(_C, _preview) {
|
|
2206
|
+
return {};
|
|
2212
2207
|
}
|
|
2213
2208
|
function blockLinkCaptureHandler(preview, e) {
|
|
2214
2209
|
if (preview) return;
|
|
@@ -2510,6 +2505,8 @@ function NestedRowBlock({
|
|
|
2510
2505
|
rowId,
|
|
2511
2506
|
cellIdx,
|
|
2512
2507
|
parentBlockIdx,
|
|
2508
|
+
/** When this layout sits inside another layout column, meta uses `contentIdx` + `inner` like other nested blocks. */
|
|
2509
|
+
selectionInner,
|
|
2513
2510
|
editorId,
|
|
2514
2511
|
selectedKey,
|
|
2515
2512
|
selContentMeta,
|
|
@@ -2521,7 +2518,7 @@ function NestedRowBlock({
|
|
|
2521
2518
|
C
|
|
2522
2519
|
}) {
|
|
2523
2520
|
const p = block.props;
|
|
2524
|
-
const rowSelected = !preview && selContentMeta && selContentMeta.rowId === rowId && selContentMeta.cellIdx === cellIdx && selContentMeta.contentIdx === parentBlockIdx && !selContentMeta.inner &&
|
|
2521
|
+
const rowSelected = !preview && selContentMeta && selContentMeta.rowId === rowId && selContentMeta.cellIdx === cellIdx && selectedKey === block.id && (selectionInner == null ? selContentMeta.contentIdx === parentBlockIdx && !selContentMeta.inner : selContentMeta.contentIdx === parentBlockIdx && selContentMeta.inner && selContentMeta.inner.cellIdx === selectionInner.cellIdx && selContentMeta.inner.contentIdx === selectionInner.contentIdx);
|
|
2525
2522
|
const rowStyle = {
|
|
2526
2523
|
padding: p.padding ?? 8,
|
|
2527
2524
|
position: "relative",
|
|
@@ -2545,7 +2542,13 @@ function NestedRowBlock({
|
|
|
2545
2542
|
style: rowStyle,
|
|
2546
2543
|
onClick: preview ? void 0 : (e) => {
|
|
2547
2544
|
e.stopPropagation();
|
|
2548
|
-
onSelectContent(
|
|
2545
|
+
onSelectContent(
|
|
2546
|
+
block.id,
|
|
2547
|
+
rowId,
|
|
2548
|
+
cellIdx,
|
|
2549
|
+
parentBlockIdx,
|
|
2550
|
+
selectionInner ?? null
|
|
2551
|
+
);
|
|
2549
2552
|
},
|
|
2550
2553
|
children: /* @__PURE__ */ jsx3("div", { style: { display: "flex", gap: p.gap ?? 12 }, children: (p.cells || []).map((innerBlocks, ici) => {
|
|
2551
2554
|
const cS = p.columnStyles && p.columnStyles[ici] || {};
|
|
@@ -2611,7 +2614,13 @@ function BlockItem({
|
|
|
2611
2614
|
if (!onSelectContent) return;
|
|
2612
2615
|
e.stopPropagation();
|
|
2613
2616
|
if (isSplitLayoutBlock(cb)) {
|
|
2614
|
-
onSelectContent(
|
|
2617
|
+
onSelectContent(
|
|
2618
|
+
cb.id,
|
|
2619
|
+
rowId,
|
|
2620
|
+
cellIdx,
|
|
2621
|
+
nest ? nest.parentBlockIdx : ci,
|
|
2622
|
+
nest ? { cellIdx: innerCellIdx, contentIdx: ci } : null
|
|
2623
|
+
);
|
|
2615
2624
|
} else {
|
|
2616
2625
|
onSelectContent(
|
|
2617
2626
|
cb.id,
|
|
@@ -2682,6 +2691,7 @@ function BlockItem({
|
|
|
2682
2691
|
rowId,
|
|
2683
2692
|
cellIdx,
|
|
2684
2693
|
parentBlockIdx: nest ? nest.parentBlockIdx : ci,
|
|
2694
|
+
selectionInner: nest ? { cellIdx: innerCellIdx, contentIdx: ci } : null,
|
|
2685
2695
|
editorId,
|
|
2686
2696
|
selectedKey,
|
|
2687
2697
|
selContentMeta,
|
|
@@ -2989,7 +2999,7 @@ var CanvasRow = ({
|
|
|
2989
2999
|
import { Image as ImageIcon2, Repeat as RepeatIcon, Scaling as Scaling2, Crosshair as Crosshair2, Blend as GradientIcon2, Droplets as ColorIcon } from "lucide-react";
|
|
2990
3000
|
|
|
2991
3001
|
// src/editor/properties/PropertyEditors.tsx
|
|
2992
|
-
import { useRef as useRef2, useState as useState3, useEffect as useEffect3, Fragment as Fragment3 } from "react";
|
|
3002
|
+
import { useRef as useRef2, useState as useState3, useEffect as useEffect3, useMemo, Fragment as Fragment3 } from "react";
|
|
2993
3003
|
import {
|
|
2994
3004
|
AlignCenter as AlignCenter2,
|
|
2995
3005
|
AlignJustify as AlignJustify2,
|
|
@@ -3310,11 +3320,8 @@ function ToolbarTypographyControls({ editor, C }) {
|
|
|
3310
3320
|
}
|
|
3311
3321
|
function FormattingToolbar({
|
|
3312
3322
|
editor,
|
|
3313
|
-
C
|
|
3314
|
-
mergeTags,
|
|
3315
|
-
onMergeTagInsert
|
|
3323
|
+
C
|
|
3316
3324
|
}) {
|
|
3317
|
-
const [mergeSel, setMergeSel] = useState2("");
|
|
3318
3325
|
const [linkPanelOpen, setLinkPanelOpen] = useState2(false);
|
|
3319
3326
|
const [linkUrlValue, setLinkUrlValue] = useState2("");
|
|
3320
3327
|
const ibtn = (active) => toolbarIconBtn(C, active);
|
|
@@ -3634,8 +3641,6 @@ function TextRichEditor({
|
|
|
3634
3641
|
value,
|
|
3635
3642
|
onChange,
|
|
3636
3643
|
typography,
|
|
3637
|
-
mergeTags,
|
|
3638
|
-
onMergeTagInsert,
|
|
3639
3644
|
placeholder = "Write your message\u2026",
|
|
3640
3645
|
headerTitle = "Rich editor",
|
|
3641
3646
|
C
|
|
@@ -3779,15 +3784,7 @@ function TextRichEditor({
|
|
|
3779
3784
|
]
|
|
3780
3785
|
}
|
|
3781
3786
|
),
|
|
3782
|
-
/* @__PURE__ */ jsx4(
|
|
3783
|
-
FormattingToolbar,
|
|
3784
|
-
{
|
|
3785
|
-
editor,
|
|
3786
|
-
C,
|
|
3787
|
-
mergeTags,
|
|
3788
|
-
onMergeTagInsert
|
|
3789
|
-
}
|
|
3790
|
-
),
|
|
3787
|
+
/* @__PURE__ */ jsx4(FormattingToolbar, { editor, C }),
|
|
3791
3788
|
/* @__PURE__ */ jsx4("style", { children: proseStyle }),
|
|
3792
3789
|
/* @__PURE__ */ jsx4(
|
|
3793
3790
|
"div",
|
|
@@ -3838,15 +3835,7 @@ function TextRichEditor({
|
|
|
3838
3835
|
background: C.inputBg
|
|
3839
3836
|
},
|
|
3840
3837
|
children: [
|
|
3841
|
-
/* @__PURE__ */ jsx4(
|
|
3842
|
-
FormattingToolbar,
|
|
3843
|
-
{
|
|
3844
|
-
editor,
|
|
3845
|
-
C,
|
|
3846
|
-
mergeTags,
|
|
3847
|
-
onMergeTagInsert
|
|
3848
|
-
}
|
|
3849
|
-
),
|
|
3838
|
+
/* @__PURE__ */ jsx4(FormattingToolbar, { editor, C }),
|
|
3850
3839
|
/* @__PURE__ */ jsx4("style", { children: proseStyle }),
|
|
3851
3840
|
/* @__PURE__ */ jsx4(
|
|
3852
3841
|
"div",
|
|
@@ -4846,7 +4835,7 @@ function BlockSurfaceBgInspector({
|
|
|
4846
4835
|
] }) : null
|
|
4847
4836
|
] });
|
|
4848
4837
|
}
|
|
4849
|
-
function ContentBlockEditor({ block, onChange,
|
|
4838
|
+
function ContentBlockEditor({ block, onChange, onClose, onUpload, C }) {
|
|
4850
4839
|
const { IS, CI } = useIS(C);
|
|
4851
4840
|
const imageFileRef = useRef2(null);
|
|
4852
4841
|
const p = block.props;
|
|
@@ -4865,7 +4854,6 @@ function ContentBlockEditor({ block, onChange, mergeTags, onClose, onUpload, C }
|
|
|
4865
4854
|
/* @__PURE__ */ jsx6("input", { type: "checkbox", checked: !!p[k], onChange: (e) => set(k, e.target.checked), style: { width: 15, height: 15, accentColor: C.accent } }),
|
|
4866
4855
|
/* @__PURE__ */ jsx6("span", { style: { color: C.muted, fontSize: 12 }, children: p[k] ? "On" : "Off" })
|
|
4867
4856
|
] }) });
|
|
4868
|
-
const TagPicker = (_field) => null;
|
|
4869
4857
|
const FONTS2 = ["Georgia,serif", "Arial,sans-serif", "Verdana,sans-serif", "'Courier New',monospace", "Trebuchet MS,sans-serif", "Impact,sans-serif"];
|
|
4870
4858
|
const ImgUpload = (key) => {
|
|
4871
4859
|
if (!onUpload) return null;
|
|
@@ -4919,7 +4907,7 @@ function ContentBlockEditor({ block, onChange, mergeTags, onClose, onUpload, C }
|
|
|
4919
4907
|
] });
|
|
4920
4908
|
case "text":
|
|
4921
4909
|
return /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
4922
|
-
/* @__PURE__ */ jsx6(PR, { label: "Content
|
|
4910
|
+
/* @__PURE__ */ jsx6(PR, { label: "Content", C, children: /* @__PURE__ */ jsx6(
|
|
4923
4911
|
"textarea",
|
|
4924
4912
|
{
|
|
4925
4913
|
style: { ...IS, minHeight: 200, resize: "vertical", fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace", fontSize: 12, lineHeight: 1.45 },
|
|
@@ -4930,24 +4918,6 @@ function ContentBlockEditor({ block, onChange, mergeTags, onClose, onUpload, C }
|
|
|
4930
4918
|
},
|
|
4931
4919
|
block.id
|
|
4932
4920
|
) }),
|
|
4933
|
-
mergeTags && mergeTags.length > 0 ? /* @__PURE__ */ jsx6(PR, { label: "Insert merge tag", C, children: /* @__PURE__ */ jsxs4(
|
|
4934
|
-
"select",
|
|
4935
|
-
{
|
|
4936
|
-
style: IS,
|
|
4937
|
-
defaultValue: "",
|
|
4938
|
-
onChange: (e) => {
|
|
4939
|
-
const v = e.target.value;
|
|
4940
|
-
if (v) {
|
|
4941
|
-
set("content", normalizeRichHtmlForStorage((p.content || "") + " " + v));
|
|
4942
|
-
e.target.value = "";
|
|
4943
|
-
}
|
|
4944
|
-
},
|
|
4945
|
-
children: [
|
|
4946
|
-
/* @__PURE__ */ jsx6("option", { value: "", children: "Choose\u2026" }),
|
|
4947
|
-
mergeTags.map((t) => /* @__PURE__ */ jsx6("option", { value: t.value, children: t.name }, t.name))
|
|
4948
|
-
]
|
|
4949
|
-
}
|
|
4950
|
-
) }) : null,
|
|
4951
4921
|
/* @__PURE__ */ jsx6(NumRangePx, { label: "Font size", value: p.fontSize ?? 15, onChange: (n) => set("fontSize", n), min: 8, max: 96, step: 1, C }),
|
|
4952
4922
|
Col("color", "Color"),
|
|
4953
4923
|
/* @__PURE__ */ jsx6(AlignButtons, { value: p.align, onChange: (v) => set("align", v), options: ["left", "center", "right", "justify"], C }),
|
|
@@ -4977,8 +4947,6 @@ function ContentBlockEditor({ block, onChange, mergeTags, onClose, onUpload, C }
|
|
|
4977
4947
|
letterSpacing: p.letterSpacing,
|
|
4978
4948
|
padding: p.padding
|
|
4979
4949
|
},
|
|
4980
|
-
mergeTags,
|
|
4981
|
-
onMergeTagInsert: (tag) => set("content", (p.content || "") + " " + tag),
|
|
4982
4950
|
placeholder: "Write your rich content\u2026",
|
|
4983
4951
|
headerTitle: "Rich editor",
|
|
4984
4952
|
C
|
|
@@ -5385,6 +5353,19 @@ function ContentBlockEditor({ block, onChange, mergeTags, onClose, onUpload, C }
|
|
|
5385
5353
|
return null;
|
|
5386
5354
|
}
|
|
5387
5355
|
}
|
|
5356
|
+
function inferLayoutRowBgStep(r) {
|
|
5357
|
+
if (r.bgGradient) return "gradient";
|
|
5358
|
+
if (String(r.bgImage || "").trim()) return "image";
|
|
5359
|
+
if (String(r.bgColor || "").trim()) return "solid";
|
|
5360
|
+
return null;
|
|
5361
|
+
}
|
|
5362
|
+
function inferColumnBgStep(columnStyles, selCol) {
|
|
5363
|
+
const cs = (columnStyles || {})[selCol] || {};
|
|
5364
|
+
if (cs.bgGradient) return "gradient";
|
|
5365
|
+
if (String(cs.bgImage || "").trim()) return "image";
|
|
5366
|
+
if (String(cs.bgColor || "").trim()) return "solid";
|
|
5367
|
+
return null;
|
|
5368
|
+
}
|
|
5388
5369
|
function LayoutRowEditor({
|
|
5389
5370
|
row,
|
|
5390
5371
|
onChange,
|
|
@@ -5396,49 +5377,37 @@ function LayoutRowEditor({
|
|
|
5396
5377
|
customizationHint
|
|
5397
5378
|
}) {
|
|
5398
5379
|
const { IS, CI } = useIS(C);
|
|
5399
|
-
const
|
|
5400
|
-
const
|
|
5401
|
-
const [
|
|
5380
|
+
const colCount = Math.max(1, row.ratios?.length || row.cells?.length || 1);
|
|
5381
|
+
const ratioList = row.ratios?.length ? row.ratios : [1];
|
|
5382
|
+
const [selCol, setSelCol] = useState3(0);
|
|
5383
|
+
const [rowBgPickerMode, setRowBgPickerMode] = useState3(null);
|
|
5384
|
+
const [colBgPickerMode, setColBgPickerMode] = useState3(null);
|
|
5385
|
+
const inferredRowBg = useMemo(() => inferLayoutRowBgStep(row), [row.bgGradient, row.bgImage, row.bgColor]);
|
|
5386
|
+
const inferredColBg = useMemo(
|
|
5387
|
+
() => inferColumnBgStep(row.columnStyles, selCol),
|
|
5388
|
+
[row.columnStyles, selCol]
|
|
5389
|
+
);
|
|
5390
|
+
const rowBgUiStep = inferredRowBg ?? rowBgPickerMode;
|
|
5391
|
+
const colBgUiStep = inferredColBg ?? colBgPickerMode;
|
|
5402
5392
|
useEffect3(() => {
|
|
5403
|
-
if (initialCol !== null && initialCol !== void 0) {
|
|
5404
|
-
setSelCol(initialCol);
|
|
5393
|
+
if (initialCol !== null && initialCol !== void 0 && initialCol >= 0) {
|
|
5394
|
+
setSelCol(Math.min(initialCol, colCount - 1));
|
|
5395
|
+
} else {
|
|
5396
|
+
setSelCol((c) => Math.min(Math.max(0, c), colCount - 1));
|
|
5405
5397
|
}
|
|
5406
|
-
}, [initialCol]);
|
|
5398
|
+
}, [initialCol, row.id, colCount]);
|
|
5407
5399
|
useEffect3(() => {
|
|
5408
|
-
|
|
5409
|
-
setRowBgUiStep("gradient");
|
|
5410
|
-
return;
|
|
5411
|
-
}
|
|
5412
|
-
if (String(row.bgImage || "").trim()) {
|
|
5413
|
-
setRowBgUiStep("image");
|
|
5414
|
-
return;
|
|
5415
|
-
}
|
|
5416
|
-
if (String(row.bgColor || "").trim()) {
|
|
5417
|
-
setRowBgUiStep("solid");
|
|
5418
|
-
return;
|
|
5419
|
-
}
|
|
5420
|
-
setRowBgUiStep(null);
|
|
5400
|
+
setRowBgPickerMode(null);
|
|
5421
5401
|
}, [row.id]);
|
|
5422
5402
|
useEffect3(() => {
|
|
5423
|
-
|
|
5424
|
-
setColBgUiStep(null);
|
|
5425
|
-
return;
|
|
5426
|
-
}
|
|
5427
|
-
const cs = (row.columnStyles || {})[selCol] || {};
|
|
5428
|
-
if (cs.bgGradient) {
|
|
5429
|
-
setColBgUiStep("gradient");
|
|
5430
|
-
return;
|
|
5431
|
-
}
|
|
5432
|
-
if (String(cs.bgImage || "").trim()) {
|
|
5433
|
-
setColBgUiStep("image");
|
|
5434
|
-
return;
|
|
5435
|
-
}
|
|
5436
|
-
if (String(cs.bgColor || "").trim()) {
|
|
5437
|
-
setColBgUiStep("solid");
|
|
5438
|
-
return;
|
|
5439
|
-
}
|
|
5440
|
-
setColBgUiStep(null);
|
|
5403
|
+
setColBgPickerMode(null);
|
|
5441
5404
|
}, [selCol, row.id]);
|
|
5405
|
+
useEffect3(() => {
|
|
5406
|
+
if (inferredRowBg) setRowBgPickerMode(null);
|
|
5407
|
+
}, [inferredRowBg]);
|
|
5408
|
+
useEffect3(() => {
|
|
5409
|
+
if (inferredColBg) setColBgPickerMode(null);
|
|
5410
|
+
}, [inferredColBg]);
|
|
5442
5411
|
const set = (k, v) => onChange({ ...row, [k]: v });
|
|
5443
5412
|
const applyColumnCount = (n) => {
|
|
5444
5413
|
const prevCells = [...row.cells || []];
|
|
@@ -5454,16 +5423,13 @@ function LayoutRowEditor({
|
|
|
5454
5423
|
}
|
|
5455
5424
|
onChange({ ...row, cols: n, preset: "custom", cells, ratios });
|
|
5456
5425
|
};
|
|
5457
|
-
const colCount = Math.max(1, row.ratios?.length || row.cells?.length || 1);
|
|
5458
|
-
const ratioList = row.ratios?.length ? row.ratios : [1];
|
|
5459
5426
|
const updCol = (i, upd) => {
|
|
5460
5427
|
const styles = { ...row.columnStyles || {} };
|
|
5461
5428
|
styles[i] = { ...styles[i] || {}, ...upd };
|
|
5462
5429
|
set("columnStyles", styles);
|
|
5463
5430
|
};
|
|
5464
5431
|
const setColBgMode = (mode) => {
|
|
5465
|
-
|
|
5466
|
-
setColBgUiStep(mode);
|
|
5432
|
+
setColBgPickerMode(mode);
|
|
5467
5433
|
const cs = (row.columnStyles || {})[selCol] || {};
|
|
5468
5434
|
if (mode === "solid") {
|
|
5469
5435
|
updCol(selCol, { bgGradient: null, bgImage: "" });
|
|
@@ -5481,7 +5447,7 @@ function LayoutRowEditor({
|
|
|
5481
5447
|
const total = ratioList.reduce((a, b) => a + b, 0) || 1;
|
|
5482
5448
|
const POS_OPTS = ["center", "top", "bottom", "left", "right", "top left", "top right", "bottom left", "bottom right"];
|
|
5483
5449
|
const setRowBgMode = (mode) => {
|
|
5484
|
-
|
|
5450
|
+
setRowBgPickerMode(mode);
|
|
5485
5451
|
if (mode === "solid") {
|
|
5486
5452
|
set("bgGradient", null);
|
|
5487
5453
|
set("bgImage", "");
|
|
@@ -5639,7 +5605,7 @@ function LayoutRowEditor({
|
|
|
5639
5605
|
},
|
|
5640
5606
|
i
|
|
5641
5607
|
)) }),
|
|
5642
|
-
|
|
5608
|
+
colCount > 0 && /* @__PURE__ */ jsxs4("div", { style: { background: C.surface, padding: 10, borderRadius: 8, border: `1px solid ${C.border}` }, children: [
|
|
5643
5609
|
/* @__PURE__ */ jsx6(BgModeButtons, { value: colBgUiStep, onChange: setColBgMode, C }),
|
|
5644
5610
|
colBgUiStep === null ? /* @__PURE__ */ jsx6("div", { style: { fontSize: 11, color: C.muted, marginBottom: 10, lineHeight: 1.45 }, children: "Choose Color, Gradient, or Image \u2014 then edit column background details." }) : null,
|
|
5645
5611
|
colBgUiStep === "solid" ? /* @__PURE__ */ jsx6(PR, { label: `col ${selCol + 1} bg`, C, children: /* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
|
|
@@ -5738,7 +5704,7 @@ function LayoutRowEditor({
|
|
|
5738
5704
|
import {
|
|
5739
5705
|
useState as useState4,
|
|
5740
5706
|
useEffect as useEffect4,
|
|
5741
|
-
useMemo,
|
|
5707
|
+
useMemo as useMemo2,
|
|
5742
5708
|
useRef as useRef3,
|
|
5743
5709
|
useLayoutEffect
|
|
5744
5710
|
} from "react";
|
|
@@ -6116,8 +6082,8 @@ function PreviewModal({
|
|
|
6116
6082
|
const iframeHDesktop = "min(720px, calc(100vh - 200px))";
|
|
6117
6083
|
const mobileIframeW = previewIframeWidthPx("mobile", mobileVariant);
|
|
6118
6084
|
const tabletIframeW = previewIframeWidthPx("tablet");
|
|
6119
|
-
const srcDocMobile =
|
|
6120
|
-
const srcDocTablet =
|
|
6085
|
+
const srcDocMobile = useMemo2(() => previewEmailSrcDoc(html, mobileIframeW), [html, mobileIframeW]);
|
|
6086
|
+
const srcDocTablet = useMemo2(() => previewEmailSrcDoc(html, tabletIframeW), [html, tabletIframeW]);
|
|
6121
6087
|
const IframeContent = ({
|
|
6122
6088
|
srcDoc,
|
|
6123
6089
|
title: iframeTitle,
|
|
@@ -6513,7 +6479,7 @@ var ReactEmailEditor = forwardRef(
|
|
|
6513
6479
|
style = {}
|
|
6514
6480
|
}, ref) {
|
|
6515
6481
|
const opt = options;
|
|
6516
|
-
const mergedThemes =
|
|
6482
|
+
const mergedThemes = useMemo3(
|
|
6517
6483
|
() => ({ ...THEMES, ...opt.appearance?.customThemes || {} }),
|
|
6518
6484
|
[opt.appearance?.customThemes]
|
|
6519
6485
|
);
|
|
@@ -6536,7 +6502,6 @@ var ReactEmailEditor = forwardRef(
|
|
|
6536
6502
|
const [locale, setLocale] = useState6(
|
|
6537
6503
|
typeof opt.locale === "string" ? opt.locale : "en"
|
|
6538
6504
|
);
|
|
6539
|
-
const [mergeTags, setMergeTagsState] = useState6(() => opt.mergeTags ?? []);
|
|
6540
6505
|
const [zoom, setZoom] = useState6(100);
|
|
6541
6506
|
const [rightRailWidth, setRightRailWidth] = useState6(RIGHT_RAIL_DEFAULT_W);
|
|
6542
6507
|
const [ctxMenu, setCtxMenu] = useState6(null);
|
|
@@ -6931,7 +6896,7 @@ var ReactEmailEditor = forwardRef(
|
|
|
6931
6896
|
}));
|
|
6932
6897
|
return;
|
|
6933
6898
|
}
|
|
6934
|
-
const loc = { type: "nested", rowId, outerCellIdx: cellIdx, blockIdx:
|
|
6899
|
+
const loc = { type: "nested", rowId, outerCellIdx: cellIdx, blockIdx: ci, innerCellIdx: inner.cellIdx };
|
|
6935
6900
|
mutate((prev) => updateColumnAt(prev, loc, (c) => c.map((b, j) => j === inner.contentIdx ? upd : b)));
|
|
6936
6901
|
};
|
|
6937
6902
|
const selectContent = (contentId, rowId, cellIdx, parentBlockIdx, inner = null) => {
|
|
@@ -7662,7 +7627,6 @@ var ReactEmailEditor = forwardRef(
|
|
|
7662
7627
|
setSelMeta(null);
|
|
7663
7628
|
setSelectedRowId(null);
|
|
7664
7629
|
},
|
|
7665
|
-
mergeTags,
|
|
7666
7630
|
onUpload,
|
|
7667
7631
|
C
|
|
7668
7632
|
}
|
|
@@ -7731,11 +7695,43 @@ var ReactEmailEditor = forwardRef(
|
|
|
7731
7695
|
e.dataTransfer.setData("application/json", JSON.stringify({ contentType: bt.type }));
|
|
7732
7696
|
},
|
|
7733
7697
|
onClick: () => {
|
|
7734
|
-
|
|
7735
|
-
if (
|
|
7736
|
-
|
|
7698
|
+
if (!rows.length) return;
|
|
7699
|
+
if (selContentMeta?.inner) {
|
|
7700
|
+
const { rowId, cellIdx, contentIdx, inner } = selContentMeta;
|
|
7701
|
+
dropContent(rowId, cellIdx, {
|
|
7702
|
+
kind: "new",
|
|
7703
|
+
contentType: bt.type,
|
|
7704
|
+
insertAt: null,
|
|
7705
|
+
nested: { parentBlockIdx: contentIdx, innerCellIdx: inner.cellIdx }
|
|
7706
|
+
});
|
|
7707
|
+
return;
|
|
7708
|
+
}
|
|
7709
|
+
if (selContentMeta?.rowId && typeof selContentMeta.cellIdx === "number" && selContentMeta.cellIdx >= 0) {
|
|
7710
|
+
const r = rows.find((x) => x.id === selContentMeta.rowId);
|
|
7711
|
+
if (r && selContentMeta.cellIdx < r.cells.length) {
|
|
7712
|
+
dropContent(selContentMeta.rowId, selContentMeta.cellIdx, {
|
|
7713
|
+
kind: "new",
|
|
7714
|
+
contentType: bt.type,
|
|
7715
|
+
insertAt: null
|
|
7716
|
+
});
|
|
7717
|
+
return;
|
|
7718
|
+
}
|
|
7719
|
+
}
|
|
7720
|
+
if (selectedRowId) {
|
|
7721
|
+
const targetRow = rows.find((r) => r.id === selectedRowId);
|
|
7722
|
+
if (targetRow) {
|
|
7723
|
+
dropContent(targetRow.id, 0, {
|
|
7724
|
+
kind: "new",
|
|
7725
|
+
contentType: bt.type,
|
|
7726
|
+
insertAt: null
|
|
7727
|
+
});
|
|
7728
|
+
return;
|
|
7729
|
+
}
|
|
7730
|
+
}
|
|
7731
|
+
const main = rows[0];
|
|
7732
|
+
dropContent(main.id, 0, { kind: "new", contentType: bt.type, insertAt: null });
|
|
7737
7733
|
},
|
|
7738
|
-
title:
|
|
7734
|
+
title: selContentMeta?.inner ? "Click to add inside the selected nested column" : selContentMeta?.rowId ? "Click to add in the selected column" : selectedRowId ? "Click to add to column 1 of the selected row" : "Click to add to the first row, first column",
|
|
7739
7735
|
style: {
|
|
7740
7736
|
display: "flex",
|
|
7741
7737
|
flexDirection: "row",
|