@parathantl/react-email-editor 0.1.9 โ 0.1.11
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/README.md +75 -0
- package/dist/index.cjs +109 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +109 -58
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -165,6 +165,81 @@ Or pass MJML at init time without a ref:
|
|
|
165
165
|
| `className` | `string` | CSS class for the outer wrapper |
|
|
166
166
|
| `style` | `CSSProperties` | Inline styles for the outer wrapper |
|
|
167
167
|
|
|
168
|
+
## Custom Icons (`customIcons`)
|
|
169
|
+
|
|
170
|
+
You can pass `customIcons` to override built-in UI icons.
|
|
171
|
+
Every key is optional. If you skip a key, the editor uses its default emoji/icon.
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
<EmailEditor
|
|
175
|
+
customIcons={{
|
|
176
|
+
desktop: '๐ฅ๏ธ',
|
|
177
|
+
mobile: '๐ฑ',
|
|
178
|
+
undo: 'โฉ๏ธ',
|
|
179
|
+
redo: 'โช๏ธ',
|
|
180
|
+
addSection: 'โ',
|
|
181
|
+
sidebar: '๐',
|
|
182
|
+
properties: 'โ๏ธ',
|
|
183
|
+
visual: '๐จ',
|
|
184
|
+
source: '๐งพ',
|
|
185
|
+
preview: '๐๏ธ',
|
|
186
|
+
sectionDrag: 'โ๏ธ',
|
|
187
|
+
sectionDuplicate: '๐',
|
|
188
|
+
sectionRemove: '๐๏ธ',
|
|
189
|
+
blockDuplicate: '๐',
|
|
190
|
+
blockRemove: '๐๏ธ',
|
|
191
|
+
previewDesktop: '๐ฅ๏ธ',
|
|
192
|
+
previewMobile: '๐ฑ',
|
|
193
|
+
paletteText: '๐',
|
|
194
|
+
paletteHeading: '๐ค',
|
|
195
|
+
paletteButton: '๐',
|
|
196
|
+
paletteImage: '๐ผ๏ธ',
|
|
197
|
+
paletteVideo: 'โถ๏ธ',
|
|
198
|
+
paletteDivider: 'โ',
|
|
199
|
+
paletteSpacer: 'โ๏ธ',
|
|
200
|
+
paletteSocial: '๐',
|
|
201
|
+
paletteHtml: '๐ป',
|
|
202
|
+
paletteCountdown: 'โฐ',
|
|
203
|
+
paletteMenu: '๐',
|
|
204
|
+
paletteHero: 'โญ',
|
|
205
|
+
}}
|
|
206
|
+
/>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Available `customIcons` keys
|
|
210
|
+
|
|
211
|
+
| Key | Used In |
|
|
212
|
+
|-----|---------|
|
|
213
|
+
| `desktop` | Canvas desktop view toggle |
|
|
214
|
+
| `mobile` | Canvas mobile view toggle |
|
|
215
|
+
| `undo` | Canvas undo button |
|
|
216
|
+
| `redo` | Canvas redo button |
|
|
217
|
+
| `addSection` | Canvas "Add Section" button |
|
|
218
|
+
| `sidebar` | Toolbar sidebar toggle button |
|
|
219
|
+
| `properties` | Toolbar properties toggle button |
|
|
220
|
+
| `visual` | Toolbar Visual tab icon |
|
|
221
|
+
| `source` | Toolbar Source tab icon |
|
|
222
|
+
| `preview` | Toolbar Preview tab icon |
|
|
223
|
+
| `sectionDrag` | Section drag handle |
|
|
224
|
+
| `sectionDuplicate` | Section duplicate action |
|
|
225
|
+
| `sectionRemove` | Section remove action |
|
|
226
|
+
| `blockDuplicate` | Block duplicate action |
|
|
227
|
+
| `blockRemove` | Block remove action |
|
|
228
|
+
| `previewDesktop` | Preview panel desktop toggle |
|
|
229
|
+
| `previewMobile` | Preview panel mobile toggle |
|
|
230
|
+
| `paletteText` | Block palette icon for Text |
|
|
231
|
+
| `paletteHeading` | Block palette icon for Heading |
|
|
232
|
+
| `paletteButton` | Block palette icon for Button |
|
|
233
|
+
| `paletteImage` | Block palette icon for Image |
|
|
234
|
+
| `paletteVideo` | Block palette icon for Video |
|
|
235
|
+
| `paletteDivider` | Block palette icon for Divider |
|
|
236
|
+
| `paletteSpacer` | Block palette icon for Spacer |
|
|
237
|
+
| `paletteSocial` | Block palette icon for Social |
|
|
238
|
+
| `paletteHtml` | Block palette icon for HTML |
|
|
239
|
+
| `paletteCountdown` | Block palette icon for Countdown |
|
|
240
|
+
| `paletteMenu` | Block palette icon for Menu |
|
|
241
|
+
| `paletteHero` | Block palette icon for Hero |
|
|
242
|
+
|
|
168
243
|
## Block Types
|
|
169
244
|
|
|
170
245
|
| Type | Description | MJML Output |
|
package/dist/index.cjs
CHANGED
|
@@ -3078,11 +3078,18 @@ var editor_default = {
|
|
|
3078
3078
|
|
|
3079
3079
|
// src/components/Toolbar/Toolbar.tsx
|
|
3080
3080
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
3081
|
-
var Toolbar = import_react15.default.memo(function Toolbar2({ sidebarOpen, propertiesOpen, onToggleSidebar, onToggleProperties, toolbarActions }) {
|
|
3081
|
+
var Toolbar = import_react15.default.memo(function Toolbar2({ sidebarOpen, propertiesOpen, onToggleSidebar, onToggleProperties, toolbarActions, customIcons }) {
|
|
3082
3082
|
const { template, activeTab } = useTemplateContext();
|
|
3083
3083
|
const dispatch = useEditorDispatch();
|
|
3084
3084
|
const fileInputRef = (0, import_react15.useRef)(null);
|
|
3085
3085
|
const [exportOpen, setExportOpen] = (0, import_react15.useState)(false);
|
|
3086
|
+
const sidebarIcon = customIcons?.sidebar ?? "\u{1F4DA}";
|
|
3087
|
+
const propertiesIcon = customIcons?.properties ?? "\u2699\uFE0F";
|
|
3088
|
+
const tabIcons = {
|
|
3089
|
+
visual: customIcons?.visual ?? "\u{1F3A8}",
|
|
3090
|
+
source: customIcons?.source ?? "\u{1F9FE}",
|
|
3091
|
+
preview: customIcons?.preview ?? "\u{1F441}\uFE0F"
|
|
3092
|
+
};
|
|
3086
3093
|
const templateRef = (0, import_react15.useRef)(template);
|
|
3087
3094
|
templateRef.current = template;
|
|
3088
3095
|
(0, import_react15.useEffect)(() => {
|
|
@@ -3173,7 +3180,7 @@ var Toolbar = import_react15.default.memo(function Toolbar2({ sidebarOpen, prope
|
|
|
3173
3180
|
"aria-label": "Toggle sidebar",
|
|
3174
3181
|
"aria-pressed": sidebarOpen,
|
|
3175
3182
|
title: "Toggle sidebar",
|
|
3176
|
-
children:
|
|
3183
|
+
children: sidebarIcon
|
|
3177
3184
|
}
|
|
3178
3185
|
),
|
|
3179
3186
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -3184,19 +3191,22 @@ var Toolbar = import_react15.default.memo(function Toolbar2({ sidebarOpen, prope
|
|
|
3184
3191
|
"aria-label": "Toggle properties",
|
|
3185
3192
|
"aria-pressed": propertiesOpen,
|
|
3186
3193
|
title: "Toggle properties",
|
|
3187
|
-
children:
|
|
3194
|
+
children: propertiesIcon
|
|
3188
3195
|
}
|
|
3189
3196
|
)
|
|
3190
3197
|
] }),
|
|
3191
3198
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `ee-toolbar-separator ${toolbar_default.toolbarSeparator}`, role: "separator" }),
|
|
3192
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `ee-toolbar-tabs ${toolbar_default.tabBar}`, role: "tablist", "aria-label": "Editor views", children: ["visual", "source", "preview"].map((tab) => /* @__PURE__ */ (0, import_jsx_runtime4.
|
|
3199
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `ee-toolbar-tabs ${toolbar_default.tabBar}`, role: "tablist", "aria-label": "Editor views", children: ["visual", "source", "preview"].map((tab) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
3193
3200
|
"button",
|
|
3194
3201
|
{
|
|
3195
3202
|
role: "tab",
|
|
3196
3203
|
"aria-selected": activeTab === tab,
|
|
3197
3204
|
className: `ee-toolbar-tab ee-toolbar-tab--${tab} ${toolbar_default.tabBtn} ${activeTab === tab ? toolbar_default.tabBtnActive : ""}`,
|
|
3198
3205
|
onClick: () => handleTabChange(tab),
|
|
3199
|
-
children:
|
|
3206
|
+
children: [
|
|
3207
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "ee-toolbar-tab-icon", children: tabIcons[tab] }),
|
|
3208
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "ee-toolbar-tab-label", children: tab.charAt(0).toUpperCase() + tab.slice(1) })
|
|
3209
|
+
]
|
|
3200
3210
|
},
|
|
3201
3211
|
tab
|
|
3202
3212
|
)) }),
|
|
@@ -3334,7 +3344,21 @@ var sidebar_default = {
|
|
|
3334
3344
|
|
|
3335
3345
|
// src/components/Sidebar/BlockPalette.tsx
|
|
3336
3346
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
3337
|
-
var
|
|
3347
|
+
var BLOCK_PALETTE_ICON_KEYS = {
|
|
3348
|
+
text: "paletteText",
|
|
3349
|
+
heading: "paletteHeading",
|
|
3350
|
+
button: "paletteButton",
|
|
3351
|
+
image: "paletteImage",
|
|
3352
|
+
video: "paletteVideo",
|
|
3353
|
+
divider: "paletteDivider",
|
|
3354
|
+
spacer: "paletteSpacer",
|
|
3355
|
+
social: "paletteSocial",
|
|
3356
|
+
html: "paletteHtml",
|
|
3357
|
+
countdown: "paletteCountdown",
|
|
3358
|
+
menu: "paletteMenu",
|
|
3359
|
+
hero: "paletteHero"
|
|
3360
|
+
};
|
|
3361
|
+
var BlockPalette = import_react16.default.memo(function BlockPalette2({ blockDefinitions, customIcons }) {
|
|
3338
3362
|
const defs = blockDefinitions ?? BLOCK_DEFINITIONS;
|
|
3339
3363
|
const dispatch = useEditorDispatch();
|
|
3340
3364
|
const { template } = useTemplateContext();
|
|
@@ -3360,30 +3384,34 @@ var BlockPalette = import_react16.default.memo(function BlockPalette2({ blockDef
|
|
|
3360
3384
|
},
|
|
3361
3385
|
[dispatch, template.sections]
|
|
3362
3386
|
);
|
|
3363
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `ee-block-palette ${sidebar_default.blockPalette}`, role: "list", "aria-label": "Available blocks", children: defs.map((def) =>
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `ee-block-palette ${sidebar_default.blockPalette}`, role: "list", "aria-label": "Available blocks", children: defs.map((def) => {
|
|
3388
|
+
const iconKey = BLOCK_PALETTE_ICON_KEYS[def.type];
|
|
3389
|
+
const icon = customIcons?.[iconKey] ?? def.icon;
|
|
3390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3391
|
+
"div",
|
|
3392
|
+
{
|
|
3393
|
+
"data-block-type": def.type,
|
|
3394
|
+
className: `ee-palette-item ee-palette-item--${def.type} ${sidebar_default.blockCard}`,
|
|
3395
|
+
draggable: true,
|
|
3396
|
+
onDragStart: (e) => handleDragStart(def.type, e),
|
|
3397
|
+
title: def.description,
|
|
3398
|
+
role: "listitem",
|
|
3399
|
+
"aria-label": `${def.label} block - drag or press Enter to add`,
|
|
3400
|
+
tabIndex: 0,
|
|
3401
|
+
onKeyDown: (e) => {
|
|
3402
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3403
|
+
e.preventDefault();
|
|
3404
|
+
handleKeyboardAdd(def.type);
|
|
3405
|
+
}
|
|
3406
|
+
},
|
|
3407
|
+
children: [
|
|
3408
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `ee-palette-icon ${sidebar_default.blockCardIcon}`, "aria-hidden": "true", children: icon }),
|
|
3409
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `ee-palette-label ${sidebar_default.blockCardLabel}`, children: def.label })
|
|
3410
|
+
]
|
|
3379
3411
|
},
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
]
|
|
3384
|
-
},
|
|
3385
|
-
def.type
|
|
3386
|
-
)) });
|
|
3412
|
+
def.type
|
|
3413
|
+
);
|
|
3414
|
+
}) });
|
|
3387
3415
|
});
|
|
3388
3416
|
|
|
3389
3417
|
// src/components/Sidebar/VariableList.tsx
|
|
@@ -3562,7 +3590,7 @@ function AddVariableForm() {
|
|
|
3562
3590
|
|
|
3563
3591
|
// src/components/Sidebar/Sidebar.tsx
|
|
3564
3592
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3565
|
-
function Sidebar({ blockDefinitions }) {
|
|
3593
|
+
function Sidebar({ blockDefinitions, customIcons }) {
|
|
3566
3594
|
const dispatch = useEditorDispatch();
|
|
3567
3595
|
const handleAddSection = (0, import_react19.useCallback)(
|
|
3568
3596
|
(widths) => {
|
|
@@ -3575,7 +3603,7 @@ function Sidebar({ blockDefinitions }) {
|
|
|
3575
3603
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(VariableList, {}),
|
|
3576
3604
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: sidebar_default.addVariableSection, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AddVariableForm, {}) }),
|
|
3577
3605
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { className: `ee-sidebar-title ${sidebar_default.sectionTitle}`, children: "Blocks" }),
|
|
3578
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BlockPalette, { blockDefinitions }),
|
|
3606
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BlockPalette, { blockDefinitions, customIcons }),
|
|
3579
3607
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { className: `ee-sidebar-title ${sidebar_default.sectionTitle}`, children: "Layouts" }),
|
|
3580
3608
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `ee-layout-section ${sidebar_default.layoutSection}`, children: COLUMN_LAYOUTS.map((layout) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3581
3609
|
"div",
|
|
@@ -27649,10 +27677,12 @@ function getBlockData(e) {
|
|
|
27649
27677
|
if (!blockId || index === void 0) return null;
|
|
27650
27678
|
return { blockId, index: Number(index) };
|
|
27651
27679
|
}
|
|
27652
|
-
var Column = import_react41.default.memo(function Column2({ column, sectionId }) {
|
|
27680
|
+
var Column = import_react41.default.memo(function Column2({ column, sectionId, customIcons }) {
|
|
27653
27681
|
const selection = useSelectionContext();
|
|
27654
27682
|
const dispatch = useEditorDispatch();
|
|
27655
27683
|
const [blockToRemove, setBlockToRemove] = (0, import_react41.useState)(null);
|
|
27684
|
+
const blockDuplicateIcon = customIcons?.blockDuplicate ?? "\u{1F4C4}";
|
|
27685
|
+
const blockRemoveIcon = customIcons?.blockRemove ?? "\u{1F5D1}\uFE0F";
|
|
27656
27686
|
const confirmRemoveBlock = (0, import_react41.useCallback)(
|
|
27657
27687
|
(blockId) => {
|
|
27658
27688
|
setBlockToRemove(blockId);
|
|
@@ -27848,7 +27878,7 @@ var Column = import_react41.default.memo(function Column2({ column, sectionId })
|
|
|
27848
27878
|
onClick: handleDuplicateClick,
|
|
27849
27879
|
title: "Duplicate block",
|
|
27850
27880
|
"aria-label": "Duplicate block",
|
|
27851
|
-
children:
|
|
27881
|
+
children: blockDuplicateIcon
|
|
27852
27882
|
}
|
|
27853
27883
|
),
|
|
27854
27884
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
@@ -27858,7 +27888,7 @@ var Column = import_react41.default.memo(function Column2({ column, sectionId })
|
|
|
27858
27888
|
onClick: handleRemoveClick,
|
|
27859
27889
|
title: "Remove block",
|
|
27860
27890
|
"aria-label": "Remove block",
|
|
27861
|
-
children:
|
|
27891
|
+
children: blockRemoveIcon
|
|
27862
27892
|
}
|
|
27863
27893
|
)
|
|
27864
27894
|
] }),
|
|
@@ -27889,12 +27919,15 @@ var Column = import_react41.default.memo(function Column2({ column, sectionId })
|
|
|
27889
27919
|
|
|
27890
27920
|
// src/components/Canvas/Section.tsx
|
|
27891
27921
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
27892
|
-
var Section = import_react42.default.memo(function Section2({ section }) {
|
|
27922
|
+
var Section = import_react42.default.memo(function Section2({ section, customIcons }) {
|
|
27893
27923
|
const selection = useSelectionContext();
|
|
27894
27924
|
const dispatch = useEditorDispatch();
|
|
27895
27925
|
const { template } = useTemplateContext();
|
|
27896
27926
|
const isSelected = selection.sectionId === section.id && !selection.blockId;
|
|
27897
27927
|
const [showRemoveConfirm, setShowRemoveConfirm] = (0, import_react42.useState)(false);
|
|
27928
|
+
const sectionDragIcon = customIcons?.sectionDrag ?? "\u2195\uFE0F";
|
|
27929
|
+
const sectionDuplicateIcon = customIcons?.sectionDuplicate ?? "\u{1F4C4}";
|
|
27930
|
+
const sectionRemoveIcon = customIcons?.sectionRemove ?? "\u{1F5D1}\uFE0F";
|
|
27898
27931
|
const handleClick2 = (0, import_react42.useCallback)(
|
|
27899
27932
|
(e) => {
|
|
27900
27933
|
e.stopPropagation();
|
|
@@ -27969,7 +28002,7 @@ var Section = import_react42.default.memo(function Section2({ section }) {
|
|
|
27969
28002
|
role: "button",
|
|
27970
28003
|
"aria-label": "Reorder section with Arrow Up/Down keys",
|
|
27971
28004
|
tabIndex: 0,
|
|
27972
|
-
children:
|
|
28005
|
+
children: sectionDragIcon
|
|
27973
28006
|
}
|
|
27974
28007
|
),
|
|
27975
28008
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
@@ -27979,7 +28012,7 @@ var Section = import_react42.default.memo(function Section2({ section }) {
|
|
|
27979
28012
|
onClick: handleDuplicate,
|
|
27980
28013
|
title: "Duplicate section",
|
|
27981
28014
|
"aria-label": "Duplicate section",
|
|
27982
|
-
children:
|
|
28015
|
+
children: sectionDuplicateIcon
|
|
27983
28016
|
}
|
|
27984
28017
|
),
|
|
27985
28018
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
@@ -27989,11 +28022,11 @@ var Section = import_react42.default.memo(function Section2({ section }) {
|
|
|
27989
28022
|
onClick: handleRemove,
|
|
27990
28023
|
title: "Remove section",
|
|
27991
28024
|
"aria-label": "Remove section",
|
|
27992
|
-
children:
|
|
28025
|
+
children: sectionRemoveIcon
|
|
27993
28026
|
}
|
|
27994
28027
|
)
|
|
27995
28028
|
] }),
|
|
27996
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: canvas_default.sectionContent, children: section.columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Column, { column, sectionId: section.id }, column.id)) }),
|
|
28029
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: canvas_default.sectionContent, children: section.columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Column, { column, sectionId: section.id, customIcons }, column.id)) }),
|
|
27997
28030
|
showRemoveConfirm && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
27998
28031
|
ConfirmDialog,
|
|
27999
28032
|
{
|
|
@@ -28064,7 +28097,7 @@ var SectionDropZone = import_react43.default.memo(function SectionDropZone2({ in
|
|
|
28064
28097
|
// src/components/Canvas/Canvas.tsx
|
|
28065
28098
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
28066
28099
|
var MOBILE_WIDTH = 375;
|
|
28067
|
-
var Canvas = import_react44.default.memo(function Canvas2() {
|
|
28100
|
+
var Canvas = import_react44.default.memo(function Canvas2({ customIcons }) {
|
|
28068
28101
|
const { template } = useTemplateContext();
|
|
28069
28102
|
const { canUndo, canRedo } = useHistoryContext();
|
|
28070
28103
|
const dispatch = useEditorDispatch();
|
|
@@ -28114,6 +28147,10 @@ var Canvas = import_react44.default.memo(function Canvas2() {
|
|
|
28114
28147
|
dispatch({ type: "REDO" });
|
|
28115
28148
|
}, [dispatch]);
|
|
28116
28149
|
const canvasWidth = previewMode === "mobile" ? MOBILE_WIDTH : template.globalStyles.width;
|
|
28150
|
+
const desktopIcon = customIcons?.desktop ?? "\u{1F5A5}";
|
|
28151
|
+
const mobileIcon = customIcons?.mobile ?? "\u{1F4F1}";
|
|
28152
|
+
const undoIcon = customIcons?.undo ?? "\u21A9";
|
|
28153
|
+
const redoIcon = customIcons?.redo ?? "\u21AA";
|
|
28117
28154
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `ee-canvas-area ${canvas_default.canvasArea}`, children: [
|
|
28118
28155
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `ee-canvas-header ${canvas_default.canvasHeader}`, children: [
|
|
28119
28156
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: `ee-canvas-header-center ${canvas_default.canvasHeaderCenter}`, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `ee-canvas-view-toggle ${canvas_default.canvasHeaderGroup}`, role: "group", "aria-label": "Preview size", children: [
|
|
@@ -28125,7 +28162,7 @@ var Canvas = import_react44.default.memo(function Canvas2() {
|
|
|
28125
28162
|
"aria-pressed": previewMode === "desktop",
|
|
28126
28163
|
"aria-label": "Desktop view",
|
|
28127
28164
|
title: `Desktop (${template.globalStyles.width}px)`,
|
|
28128
|
-
children:
|
|
28165
|
+
children: desktopIcon
|
|
28129
28166
|
}
|
|
28130
28167
|
),
|
|
28131
28168
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
@@ -28136,7 +28173,7 @@ var Canvas = import_react44.default.memo(function Canvas2() {
|
|
|
28136
28173
|
"aria-pressed": previewMode === "mobile",
|
|
28137
28174
|
"aria-label": "Mobile view",
|
|
28138
28175
|
title: "Mobile (375px)",
|
|
28139
|
-
children:
|
|
28176
|
+
children: mobileIcon
|
|
28140
28177
|
}
|
|
28141
28178
|
)
|
|
28142
28179
|
] }) }),
|
|
@@ -28149,7 +28186,7 @@ var Canvas = import_react44.default.memo(function Canvas2() {
|
|
|
28149
28186
|
disabled: !canUndo,
|
|
28150
28187
|
title: "Undo (Ctrl+Z)",
|
|
28151
28188
|
"aria-label": "Undo",
|
|
28152
|
-
children:
|
|
28189
|
+
children: undoIcon
|
|
28153
28190
|
}
|
|
28154
28191
|
),
|
|
28155
28192
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
@@ -28160,7 +28197,7 @@ var Canvas = import_react44.default.memo(function Canvas2() {
|
|
|
28160
28197
|
disabled: !canRedo,
|
|
28161
28198
|
title: "Redo (Ctrl+Shift+Z)",
|
|
28162
28199
|
"aria-label": "Redo",
|
|
28163
|
-
children:
|
|
28200
|
+
children: redoIcon
|
|
28164
28201
|
}
|
|
28165
28202
|
)
|
|
28166
28203
|
] })
|
|
@@ -28182,10 +28219,13 @@ var Canvas = import_react44.default.memo(function Canvas2() {
|
|
|
28182
28219
|
children: [
|
|
28183
28220
|
template.sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react44.default.Fragment, { children: [
|
|
28184
28221
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SectionDropZone, { index }),
|
|
28185
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Section, { section })
|
|
28222
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Section, { section, customIcons })
|
|
28186
28223
|
] }, section.id)),
|
|
28187
28224
|
template.sections.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SectionDropZone, { index: template.sections.length }),
|
|
28188
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.
|
|
28225
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("button", { className: `ee-add-section ${canvas_default.addSectionBtn}`, onClick: handleAddSection, "aria-label": "Add new section", children: [
|
|
28226
|
+
customIcons?.addSection ?? "\u2795",
|
|
28227
|
+
" Add Section"
|
|
28228
|
+
] })
|
|
28189
28229
|
]
|
|
28190
28230
|
}
|
|
28191
28231
|
) })
|
|
@@ -29553,11 +29593,13 @@ var PREVIEW_WIDTHS = {
|
|
|
29553
29593
|
desktop: 600,
|
|
29554
29594
|
mobile: 375
|
|
29555
29595
|
};
|
|
29556
|
-
function PreviewPanel() {
|
|
29596
|
+
function PreviewPanel({ customIcons }) {
|
|
29557
29597
|
const { template } = useTemplateContext();
|
|
29558
29598
|
const [html2, setHtml] = (0, import_react59.useState)("");
|
|
29559
29599
|
const [previewMode, setPreviewMode] = (0, import_react59.useState)("desktop");
|
|
29560
29600
|
const iframeRef = (0, import_react59.useRef)(null);
|
|
29601
|
+
const desktopIcon = customIcons?.previewDesktop ?? "\u{1F5A5}\uFE0F";
|
|
29602
|
+
const mobileIcon = customIcons?.previewMobile ?? "\u{1F4F1}";
|
|
29561
29603
|
(0, import_react59.useEffect)(() => {
|
|
29562
29604
|
let cancelled = false;
|
|
29563
29605
|
const timer = setTimeout(() => {
|
|
@@ -29587,24 +29629,30 @@ function PreviewPanel() {
|
|
|
29587
29629
|
}, [html2]);
|
|
29588
29630
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: `ee-preview ${preview_default.preview}`, children: [
|
|
29589
29631
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: `ee-preview-toggles ${preview_default.previewToggles}`, role: "group", "aria-label": "Preview size", children: [
|
|
29590
|
-
/* @__PURE__ */ (0, import_jsx_runtime56.
|
|
29632
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
29591
29633
|
"button",
|
|
29592
29634
|
{
|
|
29593
29635
|
className: `ee-preview-toggle ee-preview-toggle--desktop ${preview_default.previewToggle} ${preview_default.previewToggleDesktop} ${previewMode === "desktop" ? `ee-preview-toggle--active ${preview_default.previewToggleActive}` : ""}`,
|
|
29594
29636
|
onClick: () => setPreviewMode("desktop"),
|
|
29595
29637
|
"aria-pressed": previewMode === "desktop",
|
|
29596
29638
|
"aria-label": "Desktop preview",
|
|
29597
|
-
children:
|
|
29639
|
+
children: [
|
|
29640
|
+
desktopIcon,
|
|
29641
|
+
" Desktop"
|
|
29642
|
+
]
|
|
29598
29643
|
}
|
|
29599
29644
|
),
|
|
29600
|
-
/* @__PURE__ */ (0, import_jsx_runtime56.
|
|
29645
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
29601
29646
|
"button",
|
|
29602
29647
|
{
|
|
29603
29648
|
className: `ee-preview-toggle ee-preview-toggle--mobile ${preview_default.previewToggle} ${preview_default.previewToggleMobile} ${previewMode === "mobile" ? `ee-preview-toggle--active ${preview_default.previewToggleActive}` : ""}`,
|
|
29604
29649
|
onClick: () => setPreviewMode("mobile"),
|
|
29605
29650
|
"aria-pressed": previewMode === "mobile",
|
|
29606
29651
|
"aria-label": "Mobile preview",
|
|
29607
|
-
children:
|
|
29652
|
+
children: [
|
|
29653
|
+
mobileIcon,
|
|
29654
|
+
" Mobile"
|
|
29655
|
+
]
|
|
29608
29656
|
}
|
|
29609
29657
|
)
|
|
29610
29658
|
] }),
|
|
@@ -29686,7 +29734,7 @@ var EditorInner = (0, import_react61.forwardRef)(function EditorInner2(props, re
|
|
|
29686
29734
|
const selection = useSelectionContext();
|
|
29687
29735
|
const { clearPersisted } = useConfigContext();
|
|
29688
29736
|
const containerRef = (0, import_react61.useRef)(null);
|
|
29689
|
-
const { onReady, onSave } = props;
|
|
29737
|
+
const { onReady, onSave, customIcons } = props;
|
|
29690
29738
|
const [sidebarOpen, setSidebarOpen] = (0, import_react61.useState)(false);
|
|
29691
29739
|
const [propertiesOpen, setPropertiesOpen] = (0, import_react61.useState)(false);
|
|
29692
29740
|
const [pendingRemoval, setPendingRemoval] = (0, import_react61.useState)(null);
|
|
@@ -29874,21 +29922,22 @@ var EditorInner = (0, import_react61.forwardRef)(function EditorInner2(props, re
|
|
|
29874
29922
|
propertiesOpen,
|
|
29875
29923
|
onToggleSidebar: toggleSidebar,
|
|
29876
29924
|
onToggleProperties: toggleProperties,
|
|
29877
|
-
toolbarActions: props.toolbarActions
|
|
29925
|
+
toolbarActions: props.toolbarActions,
|
|
29926
|
+
customIcons
|
|
29878
29927
|
}
|
|
29879
29928
|
),
|
|
29880
29929
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: editor_default.editorBody, children: [
|
|
29881
29930
|
activeTab === "visual" && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
29882
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-sidebar ${sidebarClasses}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Sidebar, { blockDefinitions: props.blockDefinitions }) }) }),
|
|
29883
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-canvas ${editor_default.editorPanel} ${editor_default.canvasPanel}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Canvas, {}) }) }),
|
|
29931
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-sidebar ${sidebarClasses}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Sidebar, { blockDefinitions: props.blockDefinitions, customIcons }) }) }),
|
|
29932
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-canvas ${editor_default.editorPanel} ${editor_default.canvasPanel}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Canvas, { customIcons }) }) }),
|
|
29884
29933
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-properties ${propertiesClasses}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PropertiesPanel, {}) }) }),
|
|
29885
29934
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: overlayClasses, onClick: closeOverlays })
|
|
29886
29935
|
] }),
|
|
29887
29936
|
activeTab === "source" && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: `ee-source-layout ${editor_default.sourceLayout}`, children: [
|
|
29888
29937
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-source-pane ${editor_default.sourcePane}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(SourceEditor, {}) }) }),
|
|
29889
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-preview-pane ${editor_default.sourcePaneDivider}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PreviewPanel, {}) }) })
|
|
29938
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-preview-pane ${editor_default.sourcePaneDivider}`, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PreviewPanel, { customIcons }) }) })
|
|
29890
29939
|
] }),
|
|
29891
|
-
activeTab === "preview" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PreviewPanel, {}) })
|
|
29940
|
+
activeTab === "preview" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PreviewPanel, { customIcons }) })
|
|
29892
29941
|
] })
|
|
29893
29942
|
] });
|
|
29894
29943
|
});
|
|
@@ -29917,7 +29966,8 @@ var EmailEditor = (0, import_react61.forwardRef)(
|
|
|
29917
29966
|
onSectionRemove,
|
|
29918
29967
|
onSelectionChange,
|
|
29919
29968
|
onTemplateLoad,
|
|
29920
|
-
onHistoryChange
|
|
29969
|
+
onHistoryChange,
|
|
29970
|
+
customIcons
|
|
29921
29971
|
} = props;
|
|
29922
29972
|
let template = initialTemplate;
|
|
29923
29973
|
if (!template && initialMJML) {
|
|
@@ -29950,6 +30000,7 @@ var EmailEditor = (0, import_react61.forwardRef)(
|
|
|
29950
30000
|
onSelectionChange,
|
|
29951
30001
|
onTemplateLoad,
|
|
29952
30002
|
onHistoryChange,
|
|
30003
|
+
customIcons,
|
|
29953
30004
|
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: `ee-editor-wrapper ${editor_default.editorWrapper} ${className || ""}`, style: style2, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(EditorInner, { ref, ...props }) })
|
|
29954
30005
|
}
|
|
29955
30006
|
);
|