@parathantl/react-email-editor 0.1.10 → 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/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/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, ComponentType } from 'react';
|
|
2
|
+
import { CSSProperties, ReactNode, Dispatch, ComponentType } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as _tiptap_core from '@tiptap/core';
|
|
5
5
|
import { Editor, Node } from '@tiptap/core';
|
|
@@ -434,7 +434,7 @@ interface EmailEditorProps {
|
|
|
434
434
|
/** Custom persistence adapter. Defaults to localStorage when persistenceKey is set. */
|
|
435
435
|
persistenceAdapter?: PersistenceAdapter;
|
|
436
436
|
className?: string;
|
|
437
|
-
style?:
|
|
437
|
+
style?: CSSProperties;
|
|
438
438
|
/** Called when a block is added to the template */
|
|
439
439
|
onBlockAdd?: (block: Block, sectionId: string, columnId: string) => void;
|
|
440
440
|
/** Called when a block is removed from the template */
|
|
@@ -456,7 +456,8 @@ interface EmailEditorProps {
|
|
|
456
456
|
/** Called when history state changes (undo/redo) */
|
|
457
457
|
onHistoryChange?: (canUndo: boolean, canRedo: boolean) => void;
|
|
458
458
|
/** React node rendered at the right end of the toolbar (e.g. a Save button). */
|
|
459
|
-
toolbarActions?:
|
|
459
|
+
toolbarActions?: ReactNode;
|
|
460
|
+
customIcons?: Record<string, ReactNode>;
|
|
460
461
|
}
|
|
461
462
|
interface EmailEditorRef {
|
|
462
463
|
getMJML: () => string;
|
|
@@ -485,7 +486,7 @@ declare function useEditorState(): {
|
|
|
485
486
|
canUndo: boolean;
|
|
486
487
|
canRedo: boolean;
|
|
487
488
|
};
|
|
488
|
-
declare function useEditorDispatch():
|
|
489
|
+
declare function useEditorDispatch(): Dispatch<EditorAction>;
|
|
489
490
|
declare function useSelectedBlock(): Block | null;
|
|
490
491
|
declare function useSelectedSection(): Section | null;
|
|
491
492
|
declare function useEditorVariables(): {
|
|
@@ -506,7 +507,7 @@ declare function useImageAdapter(): {
|
|
|
506
507
|
imageUploadAdapter: ImageUploadAdapter | undefined;
|
|
507
508
|
};
|
|
508
509
|
|
|
509
|
-
declare function useDispatchContext():
|
|
510
|
+
declare function useDispatchContext(): Dispatch<EditorAction>;
|
|
510
511
|
|
|
511
512
|
interface TemplateContextValue {
|
|
512
513
|
template: EmailTemplate;
|
|
@@ -560,6 +561,7 @@ interface EditorProviderProps {
|
|
|
560
561
|
initialTemplate?: EmailTemplate;
|
|
561
562
|
variables?: Variable[];
|
|
562
563
|
initialCustomVariables?: Variable[];
|
|
564
|
+
customIcons?: Record<string, ReactNode>;
|
|
563
565
|
imageUploadAdapter?: ImageUploadAdapter;
|
|
564
566
|
onChange?: (template: EmailTemplate) => void;
|
|
565
567
|
onVariablesChange?: (customVariables: Variable[]) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, ComponentType } from 'react';
|
|
2
|
+
import { CSSProperties, ReactNode, Dispatch, ComponentType } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as _tiptap_core from '@tiptap/core';
|
|
5
5
|
import { Editor, Node } from '@tiptap/core';
|
|
@@ -434,7 +434,7 @@ interface EmailEditorProps {
|
|
|
434
434
|
/** Custom persistence adapter. Defaults to localStorage when persistenceKey is set. */
|
|
435
435
|
persistenceAdapter?: PersistenceAdapter;
|
|
436
436
|
className?: string;
|
|
437
|
-
style?:
|
|
437
|
+
style?: CSSProperties;
|
|
438
438
|
/** Called when a block is added to the template */
|
|
439
439
|
onBlockAdd?: (block: Block, sectionId: string, columnId: string) => void;
|
|
440
440
|
/** Called when a block is removed from the template */
|
|
@@ -456,7 +456,8 @@ interface EmailEditorProps {
|
|
|
456
456
|
/** Called when history state changes (undo/redo) */
|
|
457
457
|
onHistoryChange?: (canUndo: boolean, canRedo: boolean) => void;
|
|
458
458
|
/** React node rendered at the right end of the toolbar (e.g. a Save button). */
|
|
459
|
-
toolbarActions?:
|
|
459
|
+
toolbarActions?: ReactNode;
|
|
460
|
+
customIcons?: Record<string, ReactNode>;
|
|
460
461
|
}
|
|
461
462
|
interface EmailEditorRef {
|
|
462
463
|
getMJML: () => string;
|
|
@@ -485,7 +486,7 @@ declare function useEditorState(): {
|
|
|
485
486
|
canUndo: boolean;
|
|
486
487
|
canRedo: boolean;
|
|
487
488
|
};
|
|
488
|
-
declare function useEditorDispatch():
|
|
489
|
+
declare function useEditorDispatch(): Dispatch<EditorAction>;
|
|
489
490
|
declare function useSelectedBlock(): Block | null;
|
|
490
491
|
declare function useSelectedSection(): Section | null;
|
|
491
492
|
declare function useEditorVariables(): {
|
|
@@ -506,7 +507,7 @@ declare function useImageAdapter(): {
|
|
|
506
507
|
imageUploadAdapter: ImageUploadAdapter | undefined;
|
|
507
508
|
};
|
|
508
509
|
|
|
509
|
-
declare function useDispatchContext():
|
|
510
|
+
declare function useDispatchContext(): Dispatch<EditorAction>;
|
|
510
511
|
|
|
511
512
|
interface TemplateContextValue {
|
|
512
513
|
template: EmailTemplate;
|
|
@@ -560,6 +561,7 @@ interface EditorProviderProps {
|
|
|
560
561
|
initialTemplate?: EmailTemplate;
|
|
561
562
|
variables?: Variable[];
|
|
562
563
|
initialCustomVariables?: Variable[];
|
|
564
|
+
customIcons?: Record<string, ReactNode>;
|
|
563
565
|
imageUploadAdapter?: ImageUploadAdapter;
|
|
564
566
|
onChange?: (template: EmailTemplate) => void;
|
|
565
567
|
onVariablesChange?: (customVariables: Variable[]) => void;
|
package/dist/index.js
CHANGED
|
@@ -2998,11 +2998,18 @@ var editor_default = {
|
|
|
2998
2998
|
|
|
2999
2999
|
// src/components/Toolbar/Toolbar.tsx
|
|
3000
3000
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3001
|
-
var Toolbar = React3.memo(function Toolbar2({ sidebarOpen, propertiesOpen, onToggleSidebar, onToggleProperties, toolbarActions }) {
|
|
3001
|
+
var Toolbar = React3.memo(function Toolbar2({ sidebarOpen, propertiesOpen, onToggleSidebar, onToggleProperties, toolbarActions, customIcons }) {
|
|
3002
3002
|
const { template, activeTab } = useTemplateContext();
|
|
3003
3003
|
const dispatch = useEditorDispatch();
|
|
3004
3004
|
const fileInputRef = useRef6(null);
|
|
3005
3005
|
const [exportOpen, setExportOpen] = useState3(false);
|
|
3006
|
+
const sidebarIcon = customIcons?.sidebar ?? "\u{1F4DA}";
|
|
3007
|
+
const propertiesIcon = customIcons?.properties ?? "\u2699\uFE0F";
|
|
3008
|
+
const tabIcons = {
|
|
3009
|
+
visual: customIcons?.visual ?? "\u{1F3A8}",
|
|
3010
|
+
source: customIcons?.source ?? "\u{1F9FE}",
|
|
3011
|
+
preview: customIcons?.preview ?? "\u{1F441}\uFE0F"
|
|
3012
|
+
};
|
|
3006
3013
|
const templateRef = useRef6(template);
|
|
3007
3014
|
templateRef.current = template;
|
|
3008
3015
|
useEffect5(() => {
|
|
@@ -3093,7 +3100,7 @@ var Toolbar = React3.memo(function Toolbar2({ sidebarOpen, propertiesOpen, onTog
|
|
|
3093
3100
|
"aria-label": "Toggle sidebar",
|
|
3094
3101
|
"aria-pressed": sidebarOpen,
|
|
3095
3102
|
title: "Toggle sidebar",
|
|
3096
|
-
children:
|
|
3103
|
+
children: sidebarIcon
|
|
3097
3104
|
}
|
|
3098
3105
|
),
|
|
3099
3106
|
/* @__PURE__ */ jsx4(
|
|
@@ -3104,19 +3111,22 @@ var Toolbar = React3.memo(function Toolbar2({ sidebarOpen, propertiesOpen, onTog
|
|
|
3104
3111
|
"aria-label": "Toggle properties",
|
|
3105
3112
|
"aria-pressed": propertiesOpen,
|
|
3106
3113
|
title: "Toggle properties",
|
|
3107
|
-
children:
|
|
3114
|
+
children: propertiesIcon
|
|
3108
3115
|
}
|
|
3109
3116
|
)
|
|
3110
3117
|
] }),
|
|
3111
3118
|
/* @__PURE__ */ jsx4("div", { className: `ee-toolbar-separator ${toolbar_default.toolbarSeparator}`, role: "separator" }),
|
|
3112
|
-
/* @__PURE__ */ jsx4("div", { className: `ee-toolbar-tabs ${toolbar_default.tabBar}`, role: "tablist", "aria-label": "Editor views", children: ["visual", "source", "preview"].map((tab) => /* @__PURE__ */
|
|
3119
|
+
/* @__PURE__ */ jsx4("div", { className: `ee-toolbar-tabs ${toolbar_default.tabBar}`, role: "tablist", "aria-label": "Editor views", children: ["visual", "source", "preview"].map((tab) => /* @__PURE__ */ jsxs3(
|
|
3113
3120
|
"button",
|
|
3114
3121
|
{
|
|
3115
3122
|
role: "tab",
|
|
3116
3123
|
"aria-selected": activeTab === tab,
|
|
3117
3124
|
className: `ee-toolbar-tab ee-toolbar-tab--${tab} ${toolbar_default.tabBtn} ${activeTab === tab ? toolbar_default.tabBtnActive : ""}`,
|
|
3118
3125
|
onClick: () => handleTabChange(tab),
|
|
3119
|
-
children:
|
|
3126
|
+
children: [
|
|
3127
|
+
/* @__PURE__ */ jsx4("span", { className: "ee-toolbar-tab-icon", children: tabIcons[tab] }),
|
|
3128
|
+
/* @__PURE__ */ jsx4("span", { className: "ee-toolbar-tab-label", children: tab.charAt(0).toUpperCase() + tab.slice(1) })
|
|
3129
|
+
]
|
|
3120
3130
|
},
|
|
3121
3131
|
tab
|
|
3122
3132
|
)) }),
|
|
@@ -3254,7 +3264,21 @@ var sidebar_default = {
|
|
|
3254
3264
|
|
|
3255
3265
|
// src/components/Sidebar/BlockPalette.tsx
|
|
3256
3266
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3257
|
-
var
|
|
3267
|
+
var BLOCK_PALETTE_ICON_KEYS = {
|
|
3268
|
+
text: "paletteText",
|
|
3269
|
+
heading: "paletteHeading",
|
|
3270
|
+
button: "paletteButton",
|
|
3271
|
+
image: "paletteImage",
|
|
3272
|
+
video: "paletteVideo",
|
|
3273
|
+
divider: "paletteDivider",
|
|
3274
|
+
spacer: "paletteSpacer",
|
|
3275
|
+
social: "paletteSocial",
|
|
3276
|
+
html: "paletteHtml",
|
|
3277
|
+
countdown: "paletteCountdown",
|
|
3278
|
+
menu: "paletteMenu",
|
|
3279
|
+
hero: "paletteHero"
|
|
3280
|
+
};
|
|
3281
|
+
var BlockPalette = React4.memo(function BlockPalette2({ blockDefinitions, customIcons }) {
|
|
3258
3282
|
const defs = blockDefinitions ?? BLOCK_DEFINITIONS;
|
|
3259
3283
|
const dispatch = useEditorDispatch();
|
|
3260
3284
|
const { template } = useTemplateContext();
|
|
@@ -3280,30 +3304,34 @@ var BlockPalette = React4.memo(function BlockPalette2({ blockDefinitions }) {
|
|
|
3280
3304
|
},
|
|
3281
3305
|
[dispatch, template.sections]
|
|
3282
3306
|
);
|
|
3283
|
-
return /* @__PURE__ */ jsx5("div", { className: `ee-block-palette ${sidebar_default.blockPalette}`, role: "list", "aria-label": "Available blocks", children: defs.map((def) =>
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3307
|
+
return /* @__PURE__ */ jsx5("div", { className: `ee-block-palette ${sidebar_default.blockPalette}`, role: "list", "aria-label": "Available blocks", children: defs.map((def) => {
|
|
3308
|
+
const iconKey = BLOCK_PALETTE_ICON_KEYS[def.type];
|
|
3309
|
+
const icon = customIcons?.[iconKey] ?? def.icon;
|
|
3310
|
+
return /* @__PURE__ */ jsxs4(
|
|
3311
|
+
"div",
|
|
3312
|
+
{
|
|
3313
|
+
"data-block-type": def.type,
|
|
3314
|
+
className: `ee-palette-item ee-palette-item--${def.type} ${sidebar_default.blockCard}`,
|
|
3315
|
+
draggable: true,
|
|
3316
|
+
onDragStart: (e) => handleDragStart(def.type, e),
|
|
3317
|
+
title: def.description,
|
|
3318
|
+
role: "listitem",
|
|
3319
|
+
"aria-label": `${def.label} block - drag or press Enter to add`,
|
|
3320
|
+
tabIndex: 0,
|
|
3321
|
+
onKeyDown: (e) => {
|
|
3322
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3323
|
+
e.preventDefault();
|
|
3324
|
+
handleKeyboardAdd(def.type);
|
|
3325
|
+
}
|
|
3326
|
+
},
|
|
3327
|
+
children: [
|
|
3328
|
+
/* @__PURE__ */ jsx5("span", { className: `ee-palette-icon ${sidebar_default.blockCardIcon}`, "aria-hidden": "true", children: icon }),
|
|
3329
|
+
/* @__PURE__ */ jsx5("span", { className: `ee-palette-label ${sidebar_default.blockCardLabel}`, children: def.label })
|
|
3330
|
+
]
|
|
3299
3331
|
},
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
]
|
|
3304
|
-
},
|
|
3305
|
-
def.type
|
|
3306
|
-
)) });
|
|
3332
|
+
def.type
|
|
3333
|
+
);
|
|
3334
|
+
}) });
|
|
3307
3335
|
});
|
|
3308
3336
|
|
|
3309
3337
|
// src/components/Sidebar/VariableList.tsx
|
|
@@ -3482,7 +3510,7 @@ function AddVariableForm() {
|
|
|
3482
3510
|
|
|
3483
3511
|
// src/components/Sidebar/Sidebar.tsx
|
|
3484
3512
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3485
|
-
function Sidebar({ blockDefinitions }) {
|
|
3513
|
+
function Sidebar({ blockDefinitions, customIcons }) {
|
|
3486
3514
|
const dispatch = useEditorDispatch();
|
|
3487
3515
|
const handleAddSection = useCallback10(
|
|
3488
3516
|
(widths) => {
|
|
@@ -3495,7 +3523,7 @@ function Sidebar({ blockDefinitions }) {
|
|
|
3495
3523
|
/* @__PURE__ */ jsx8(VariableList, {}),
|
|
3496
3524
|
/* @__PURE__ */ jsx8("div", { className: sidebar_default.addVariableSection, children: /* @__PURE__ */ jsx8(AddVariableForm, {}) }),
|
|
3497
3525
|
/* @__PURE__ */ jsx8("h3", { className: `ee-sidebar-title ${sidebar_default.sectionTitle}`, children: "Blocks" }),
|
|
3498
|
-
/* @__PURE__ */ jsx8(BlockPalette, { blockDefinitions }),
|
|
3526
|
+
/* @__PURE__ */ jsx8(BlockPalette, { blockDefinitions, customIcons }),
|
|
3499
3527
|
/* @__PURE__ */ jsx8("h3", { className: `ee-sidebar-title ${sidebar_default.sectionTitle}`, children: "Layouts" }),
|
|
3500
3528
|
/* @__PURE__ */ jsx8("div", { className: `ee-layout-section ${sidebar_default.layoutSection}`, children: COLUMN_LAYOUTS.map((layout) => /* @__PURE__ */ jsxs7(
|
|
3501
3529
|
"div",
|
|
@@ -27569,10 +27597,12 @@ function getBlockData(e) {
|
|
|
27569
27597
|
if (!blockId || index === void 0) return null;
|
|
27570
27598
|
return { blockId, index: Number(index) };
|
|
27571
27599
|
}
|
|
27572
|
-
var Column = React27.memo(function Column2({ column, sectionId }) {
|
|
27600
|
+
var Column = React27.memo(function Column2({ column, sectionId, customIcons }) {
|
|
27573
27601
|
const selection = useSelectionContext();
|
|
27574
27602
|
const dispatch = useEditorDispatch();
|
|
27575
27603
|
const [blockToRemove, setBlockToRemove] = useState15(null);
|
|
27604
|
+
const blockDuplicateIcon = customIcons?.blockDuplicate ?? "\u{1F4C4}";
|
|
27605
|
+
const blockRemoveIcon = customIcons?.blockRemove ?? "\u{1F5D1}\uFE0F";
|
|
27576
27606
|
const confirmRemoveBlock = useCallback19(
|
|
27577
27607
|
(blockId) => {
|
|
27578
27608
|
setBlockToRemove(blockId);
|
|
@@ -27768,7 +27798,7 @@ var Column = React27.memo(function Column2({ column, sectionId }) {
|
|
|
27768
27798
|
onClick: handleDuplicateClick,
|
|
27769
27799
|
title: "Duplicate block",
|
|
27770
27800
|
"aria-label": "Duplicate block",
|
|
27771
|
-
children:
|
|
27801
|
+
children: blockDuplicateIcon
|
|
27772
27802
|
}
|
|
27773
27803
|
),
|
|
27774
27804
|
/* @__PURE__ */ jsx29(
|
|
@@ -27778,7 +27808,7 @@ var Column = React27.memo(function Column2({ column, sectionId }) {
|
|
|
27778
27808
|
onClick: handleRemoveClick,
|
|
27779
27809
|
title: "Remove block",
|
|
27780
27810
|
"aria-label": "Remove block",
|
|
27781
|
-
children:
|
|
27811
|
+
children: blockRemoveIcon
|
|
27782
27812
|
}
|
|
27783
27813
|
)
|
|
27784
27814
|
] }),
|
|
@@ -27809,12 +27839,15 @@ var Column = React27.memo(function Column2({ column, sectionId }) {
|
|
|
27809
27839
|
|
|
27810
27840
|
// src/components/Canvas/Section.tsx
|
|
27811
27841
|
import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
27812
|
-
var Section = React28.memo(function Section2({ section }) {
|
|
27842
|
+
var Section = React28.memo(function Section2({ section, customIcons }) {
|
|
27813
27843
|
const selection = useSelectionContext();
|
|
27814
27844
|
const dispatch = useEditorDispatch();
|
|
27815
27845
|
const { template } = useTemplateContext();
|
|
27816
27846
|
const isSelected = selection.sectionId === section.id && !selection.blockId;
|
|
27817
27847
|
const [showRemoveConfirm, setShowRemoveConfirm] = useState16(false);
|
|
27848
|
+
const sectionDragIcon = customIcons?.sectionDrag ?? "\u2195\uFE0F";
|
|
27849
|
+
const sectionDuplicateIcon = customIcons?.sectionDuplicate ?? "\u{1F4C4}";
|
|
27850
|
+
const sectionRemoveIcon = customIcons?.sectionRemove ?? "\u{1F5D1}\uFE0F";
|
|
27818
27851
|
const handleClick2 = useCallback20(
|
|
27819
27852
|
(e) => {
|
|
27820
27853
|
e.stopPropagation();
|
|
@@ -27889,7 +27922,7 @@ var Section = React28.memo(function Section2({ section }) {
|
|
|
27889
27922
|
role: "button",
|
|
27890
27923
|
"aria-label": "Reorder section with Arrow Up/Down keys",
|
|
27891
27924
|
tabIndex: 0,
|
|
27892
|
-
children:
|
|
27925
|
+
children: sectionDragIcon
|
|
27893
27926
|
}
|
|
27894
27927
|
),
|
|
27895
27928
|
/* @__PURE__ */ jsx30(
|
|
@@ -27899,7 +27932,7 @@ var Section = React28.memo(function Section2({ section }) {
|
|
|
27899
27932
|
onClick: handleDuplicate,
|
|
27900
27933
|
title: "Duplicate section",
|
|
27901
27934
|
"aria-label": "Duplicate section",
|
|
27902
|
-
children:
|
|
27935
|
+
children: sectionDuplicateIcon
|
|
27903
27936
|
}
|
|
27904
27937
|
),
|
|
27905
27938
|
/* @__PURE__ */ jsx30(
|
|
@@ -27909,11 +27942,11 @@ var Section = React28.memo(function Section2({ section }) {
|
|
|
27909
27942
|
onClick: handleRemove,
|
|
27910
27943
|
title: "Remove section",
|
|
27911
27944
|
"aria-label": "Remove section",
|
|
27912
|
-
children:
|
|
27945
|
+
children: sectionRemoveIcon
|
|
27913
27946
|
}
|
|
27914
27947
|
)
|
|
27915
27948
|
] }),
|
|
27916
|
-
/* @__PURE__ */ jsx30("div", { className: canvas_default.sectionContent, children: section.columns.map((column) => /* @__PURE__ */ jsx30(Column, { column, sectionId: section.id }, column.id)) }),
|
|
27949
|
+
/* @__PURE__ */ jsx30("div", { className: canvas_default.sectionContent, children: section.columns.map((column) => /* @__PURE__ */ jsx30(Column, { column, sectionId: section.id, customIcons }, column.id)) }),
|
|
27917
27950
|
showRemoveConfirm && /* @__PURE__ */ jsx30(
|
|
27918
27951
|
ConfirmDialog,
|
|
27919
27952
|
{
|
|
@@ -27984,7 +28017,7 @@ var SectionDropZone = React29.memo(function SectionDropZone2({ index }) {
|
|
|
27984
28017
|
// src/components/Canvas/Canvas.tsx
|
|
27985
28018
|
import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
27986
28019
|
var MOBILE_WIDTH = 375;
|
|
27987
|
-
var Canvas = React30.memo(function Canvas2() {
|
|
28020
|
+
var Canvas = React30.memo(function Canvas2({ customIcons }) {
|
|
27988
28021
|
const { template } = useTemplateContext();
|
|
27989
28022
|
const { canUndo, canRedo } = useHistoryContext();
|
|
27990
28023
|
const dispatch = useEditorDispatch();
|
|
@@ -28034,6 +28067,10 @@ var Canvas = React30.memo(function Canvas2() {
|
|
|
28034
28067
|
dispatch({ type: "REDO" });
|
|
28035
28068
|
}, [dispatch]);
|
|
28036
28069
|
const canvasWidth = previewMode === "mobile" ? MOBILE_WIDTH : template.globalStyles.width;
|
|
28070
|
+
const desktopIcon = customIcons?.desktop ?? "\u{1F5A5}";
|
|
28071
|
+
const mobileIcon = customIcons?.mobile ?? "\u{1F4F1}";
|
|
28072
|
+
const undoIcon = customIcons?.undo ?? "\u21A9";
|
|
28073
|
+
const redoIcon = customIcons?.redo ?? "\u21AA";
|
|
28037
28074
|
return /* @__PURE__ */ jsxs22("div", { className: `ee-canvas-area ${canvas_default.canvasArea}`, children: [
|
|
28038
28075
|
/* @__PURE__ */ jsxs22("div", { className: `ee-canvas-header ${canvas_default.canvasHeader}`, children: [
|
|
28039
28076
|
/* @__PURE__ */ jsx32("div", { className: `ee-canvas-header-center ${canvas_default.canvasHeaderCenter}`, children: /* @__PURE__ */ jsxs22("div", { className: `ee-canvas-view-toggle ${canvas_default.canvasHeaderGroup}`, role: "group", "aria-label": "Preview size", children: [
|
|
@@ -28045,7 +28082,7 @@ var Canvas = React30.memo(function Canvas2() {
|
|
|
28045
28082
|
"aria-pressed": previewMode === "desktop",
|
|
28046
28083
|
"aria-label": "Desktop view",
|
|
28047
28084
|
title: `Desktop (${template.globalStyles.width}px)`,
|
|
28048
|
-
children:
|
|
28085
|
+
children: desktopIcon
|
|
28049
28086
|
}
|
|
28050
28087
|
),
|
|
28051
28088
|
/* @__PURE__ */ jsx32(
|
|
@@ -28056,7 +28093,7 @@ var Canvas = React30.memo(function Canvas2() {
|
|
|
28056
28093
|
"aria-pressed": previewMode === "mobile",
|
|
28057
28094
|
"aria-label": "Mobile view",
|
|
28058
28095
|
title: "Mobile (375px)",
|
|
28059
|
-
children:
|
|
28096
|
+
children: mobileIcon
|
|
28060
28097
|
}
|
|
28061
28098
|
)
|
|
28062
28099
|
] }) }),
|
|
@@ -28069,7 +28106,7 @@ var Canvas = React30.memo(function Canvas2() {
|
|
|
28069
28106
|
disabled: !canUndo,
|
|
28070
28107
|
title: "Undo (Ctrl+Z)",
|
|
28071
28108
|
"aria-label": "Undo",
|
|
28072
|
-
children:
|
|
28109
|
+
children: undoIcon
|
|
28073
28110
|
}
|
|
28074
28111
|
),
|
|
28075
28112
|
/* @__PURE__ */ jsx32(
|
|
@@ -28080,7 +28117,7 @@ var Canvas = React30.memo(function Canvas2() {
|
|
|
28080
28117
|
disabled: !canRedo,
|
|
28081
28118
|
title: "Redo (Ctrl+Shift+Z)",
|
|
28082
28119
|
"aria-label": "Redo",
|
|
28083
|
-
children:
|
|
28120
|
+
children: redoIcon
|
|
28084
28121
|
}
|
|
28085
28122
|
)
|
|
28086
28123
|
] })
|
|
@@ -28102,10 +28139,13 @@ var Canvas = React30.memo(function Canvas2() {
|
|
|
28102
28139
|
children: [
|
|
28103
28140
|
template.sections.map((section, index) => /* @__PURE__ */ jsxs22(React30.Fragment, { children: [
|
|
28104
28141
|
/* @__PURE__ */ jsx32(SectionDropZone, { index }),
|
|
28105
|
-
/* @__PURE__ */ jsx32(Section, { section })
|
|
28142
|
+
/* @__PURE__ */ jsx32(Section, { section, customIcons })
|
|
28106
28143
|
] }, section.id)),
|
|
28107
28144
|
template.sections.length > 0 && /* @__PURE__ */ jsx32(SectionDropZone, { index: template.sections.length }),
|
|
28108
|
-
/* @__PURE__ */
|
|
28145
|
+
/* @__PURE__ */ jsxs22("button", { className: `ee-add-section ${canvas_default.addSectionBtn}`, onClick: handleAddSection, "aria-label": "Add new section", children: [
|
|
28146
|
+
customIcons?.addSection ?? "\u2795",
|
|
28147
|
+
" Add Section"
|
|
28148
|
+
] })
|
|
28109
28149
|
]
|
|
28110
28150
|
}
|
|
28111
28151
|
) })
|
|
@@ -29473,11 +29513,13 @@ var PREVIEW_WIDTHS = {
|
|
|
29473
29513
|
desktop: 600,
|
|
29474
29514
|
mobile: 375
|
|
29475
29515
|
};
|
|
29476
|
-
function PreviewPanel() {
|
|
29516
|
+
function PreviewPanel({ customIcons }) {
|
|
29477
29517
|
const { template } = useTemplateContext();
|
|
29478
29518
|
const [html2, setHtml] = useState22("");
|
|
29479
29519
|
const [previewMode, setPreviewMode] = useState22("desktop");
|
|
29480
29520
|
const iframeRef = useRef23(null);
|
|
29521
|
+
const desktopIcon = customIcons?.previewDesktop ?? "\u{1F5A5}\uFE0F";
|
|
29522
|
+
const mobileIcon = customIcons?.previewMobile ?? "\u{1F4F1}";
|
|
29481
29523
|
useEffect16(() => {
|
|
29482
29524
|
let cancelled = false;
|
|
29483
29525
|
const timer = setTimeout(() => {
|
|
@@ -29507,24 +29549,30 @@ function PreviewPanel() {
|
|
|
29507
29549
|
}, [html2]);
|
|
29508
29550
|
return /* @__PURE__ */ jsxs45("div", { className: `ee-preview ${preview_default.preview}`, children: [
|
|
29509
29551
|
/* @__PURE__ */ jsxs45("div", { className: `ee-preview-toggles ${preview_default.previewToggles}`, role: "group", "aria-label": "Preview size", children: [
|
|
29510
|
-
/* @__PURE__ */
|
|
29552
|
+
/* @__PURE__ */ jsxs45(
|
|
29511
29553
|
"button",
|
|
29512
29554
|
{
|
|
29513
29555
|
className: `ee-preview-toggle ee-preview-toggle--desktop ${preview_default.previewToggle} ${preview_default.previewToggleDesktop} ${previewMode === "desktop" ? `ee-preview-toggle--active ${preview_default.previewToggleActive}` : ""}`,
|
|
29514
29556
|
onClick: () => setPreviewMode("desktop"),
|
|
29515
29557
|
"aria-pressed": previewMode === "desktop",
|
|
29516
29558
|
"aria-label": "Desktop preview",
|
|
29517
|
-
children:
|
|
29559
|
+
children: [
|
|
29560
|
+
desktopIcon,
|
|
29561
|
+
" Desktop"
|
|
29562
|
+
]
|
|
29518
29563
|
}
|
|
29519
29564
|
),
|
|
29520
|
-
/* @__PURE__ */
|
|
29565
|
+
/* @__PURE__ */ jsxs45(
|
|
29521
29566
|
"button",
|
|
29522
29567
|
{
|
|
29523
29568
|
className: `ee-preview-toggle ee-preview-toggle--mobile ${preview_default.previewToggle} ${preview_default.previewToggleMobile} ${previewMode === "mobile" ? `ee-preview-toggle--active ${preview_default.previewToggleActive}` : ""}`,
|
|
29524
29569
|
onClick: () => setPreviewMode("mobile"),
|
|
29525
29570
|
"aria-pressed": previewMode === "mobile",
|
|
29526
29571
|
"aria-label": "Mobile preview",
|
|
29527
|
-
children:
|
|
29572
|
+
children: [
|
|
29573
|
+
mobileIcon,
|
|
29574
|
+
" Mobile"
|
|
29575
|
+
]
|
|
29528
29576
|
}
|
|
29529
29577
|
)
|
|
29530
29578
|
] }),
|
|
@@ -29606,7 +29654,7 @@ var EditorInner = forwardRef2(function EditorInner2(props, ref) {
|
|
|
29606
29654
|
const selection = useSelectionContext();
|
|
29607
29655
|
const { clearPersisted } = useConfigContext();
|
|
29608
29656
|
const containerRef = useRef24(null);
|
|
29609
|
-
const { onReady, onSave } = props;
|
|
29657
|
+
const { onReady, onSave, customIcons } = props;
|
|
29610
29658
|
const [sidebarOpen, setSidebarOpen] = useState24(false);
|
|
29611
29659
|
const [propertiesOpen, setPropertiesOpen] = useState24(false);
|
|
29612
29660
|
const [pendingRemoval, setPendingRemoval] = useState24(null);
|
|
@@ -29794,21 +29842,22 @@ var EditorInner = forwardRef2(function EditorInner2(props, ref) {
|
|
|
29794
29842
|
propertiesOpen,
|
|
29795
29843
|
onToggleSidebar: toggleSidebar,
|
|
29796
29844
|
onToggleProperties: toggleProperties,
|
|
29797
|
-
toolbarActions: props.toolbarActions
|
|
29845
|
+
toolbarActions: props.toolbarActions,
|
|
29846
|
+
customIcons
|
|
29798
29847
|
}
|
|
29799
29848
|
),
|
|
29800
29849
|
/* @__PURE__ */ jsxs47("div", { className: editor_default.editorBody, children: [
|
|
29801
29850
|
activeTab === "visual" && /* @__PURE__ */ jsxs47(Fragment5, { children: [
|
|
29802
|
-
/* @__PURE__ */ jsx58("div", { className: `ee-sidebar ${sidebarClasses}`, children: /* @__PURE__ */ jsx58(ErrorBoundary, { children: /* @__PURE__ */ jsx58(Sidebar, { blockDefinitions: props.blockDefinitions }) }) }),
|
|
29803
|
-
/* @__PURE__ */ jsx58("div", { className: `ee-canvas ${editor_default.editorPanel} ${editor_default.canvasPanel}`, children: /* @__PURE__ */ jsx58(ErrorBoundary, { children: /* @__PURE__ */ jsx58(Canvas, {}) }) }),
|
|
29851
|
+
/* @__PURE__ */ jsx58("div", { className: `ee-sidebar ${sidebarClasses}`, children: /* @__PURE__ */ jsx58(ErrorBoundary, { children: /* @__PURE__ */ jsx58(Sidebar, { blockDefinitions: props.blockDefinitions, customIcons }) }) }),
|
|
29852
|
+
/* @__PURE__ */ jsx58("div", { className: `ee-canvas ${editor_default.editorPanel} ${editor_default.canvasPanel}`, children: /* @__PURE__ */ jsx58(ErrorBoundary, { children: /* @__PURE__ */ jsx58(Canvas, { customIcons }) }) }),
|
|
29804
29853
|
/* @__PURE__ */ jsx58("div", { className: `ee-properties ${propertiesClasses}`, children: /* @__PURE__ */ jsx58(ErrorBoundary, { children: /* @__PURE__ */ jsx58(PropertiesPanel, {}) }) }),
|
|
29805
29854
|
/* @__PURE__ */ jsx58("div", { className: overlayClasses, onClick: closeOverlays })
|
|
29806
29855
|
] }),
|
|
29807
29856
|
activeTab === "source" && /* @__PURE__ */ jsxs47("div", { className: `ee-source-layout ${editor_default.sourceLayout}`, children: [
|
|
29808
29857
|
/* @__PURE__ */ jsx58("div", { className: `ee-source-pane ${editor_default.sourcePane}`, children: /* @__PURE__ */ jsx58(ErrorBoundary, { children: /* @__PURE__ */ jsx58(SourceEditor, {}) }) }),
|
|
29809
|
-
/* @__PURE__ */ jsx58("div", { className: `ee-preview-pane ${editor_default.sourcePaneDivider}`, children: /* @__PURE__ */ jsx58(ErrorBoundary, { children: /* @__PURE__ */ jsx58(PreviewPanel, {}) }) })
|
|
29858
|
+
/* @__PURE__ */ jsx58("div", { className: `ee-preview-pane ${editor_default.sourcePaneDivider}`, children: /* @__PURE__ */ jsx58(ErrorBoundary, { children: /* @__PURE__ */ jsx58(PreviewPanel, { customIcons }) }) })
|
|
29810
29859
|
] }),
|
|
29811
|
-
activeTab === "preview" && /* @__PURE__ */ jsx58(ErrorBoundary, { children: /* @__PURE__ */ jsx58(PreviewPanel, {}) })
|
|
29860
|
+
activeTab === "preview" && /* @__PURE__ */ jsx58(ErrorBoundary, { children: /* @__PURE__ */ jsx58(PreviewPanel, { customIcons }) })
|
|
29812
29861
|
] })
|
|
29813
29862
|
] });
|
|
29814
29863
|
});
|
|
@@ -29837,7 +29886,8 @@ var EmailEditor = forwardRef2(
|
|
|
29837
29886
|
onSectionRemove,
|
|
29838
29887
|
onSelectionChange,
|
|
29839
29888
|
onTemplateLoad,
|
|
29840
|
-
onHistoryChange
|
|
29889
|
+
onHistoryChange,
|
|
29890
|
+
customIcons
|
|
29841
29891
|
} = props;
|
|
29842
29892
|
let template = initialTemplate;
|
|
29843
29893
|
if (!template && initialMJML) {
|
|
@@ -29870,6 +29920,7 @@ var EmailEditor = forwardRef2(
|
|
|
29870
29920
|
onSelectionChange,
|
|
29871
29921
|
onTemplateLoad,
|
|
29872
29922
|
onHistoryChange,
|
|
29923
|
+
customIcons,
|
|
29873
29924
|
children: /* @__PURE__ */ jsx58("div", { className: `ee-editor-wrapper ${editor_default.editorWrapper} ${className || ""}`, style: style2, children: /* @__PURE__ */ jsx58(EditorInner, { ref, ...props }) })
|
|
29874
29925
|
}
|
|
29875
29926
|
);
|