@parathantl/react-email-editor 0.1.8 → 0.1.10
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 +92 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +74 -9
- package/dist/index.css.map +1 -1
- package/dist/index.js +92 -55
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3000,7 +3000,6 @@ var editor_default = {
|
|
|
3000
3000
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3001
3001
|
var Toolbar = React3.memo(function Toolbar2({ sidebarOpen, propertiesOpen, onToggleSidebar, onToggleProperties, toolbarActions }) {
|
|
3002
3002
|
const { template, activeTab } = useTemplateContext();
|
|
3003
|
-
const { canUndo, canRedo } = useHistoryContext();
|
|
3004
3003
|
const dispatch = useEditorDispatch();
|
|
3005
3004
|
const fileInputRef = useRef6(null);
|
|
3006
3005
|
const [exportOpen, setExportOpen] = useState3(false);
|
|
@@ -3018,12 +3017,6 @@ var Toolbar = React3.memo(function Toolbar2({ sidebarOpen, propertiesOpen, onTog
|
|
|
3018
3017
|
},
|
|
3019
3018
|
[dispatch]
|
|
3020
3019
|
);
|
|
3021
|
-
const handleUndo = useCallback6(() => {
|
|
3022
|
-
dispatch({ type: "UNDO" });
|
|
3023
|
-
}, [dispatch]);
|
|
3024
|
-
const handleRedo = useCallback6(() => {
|
|
3025
|
-
dispatch({ type: "REDO" });
|
|
3026
|
-
}, [dispatch]);
|
|
3027
3020
|
const handleExportMJML = useCallback6(() => {
|
|
3028
3021
|
const mjml = generateMJML(templateRef.current);
|
|
3029
3022
|
const blob = new Blob([mjml], { type: "text/xml" });
|
|
@@ -3091,30 +3084,6 @@ var Toolbar = React3.memo(function Toolbar2({ sidebarOpen, propertiesOpen, onTog
|
|
|
3091
3084
|
[dispatch]
|
|
3092
3085
|
);
|
|
3093
3086
|
return /* @__PURE__ */ jsxs3("div", { className: `ee-toolbar ${toolbar_default.toolbar}`, role: "toolbar", "aria-label": "Editor toolbar", children: [
|
|
3094
|
-
/* @__PURE__ */ jsxs3("div", { className: `ee-toolbar-history ${toolbar_default.toolbarGroup}`, role: "group", "aria-label": "History", children: [
|
|
3095
|
-
/* @__PURE__ */ jsx4(
|
|
3096
|
-
"button",
|
|
3097
|
-
{
|
|
3098
|
-
className: `ee-toolbar-undo ${toolbar_default.toolbarBtn}`,
|
|
3099
|
-
onClick: handleUndo,
|
|
3100
|
-
disabled: !canUndo,
|
|
3101
|
-
title: "Undo (Ctrl+Z)",
|
|
3102
|
-
"aria-label": "Undo",
|
|
3103
|
-
children: "Undo"
|
|
3104
|
-
}
|
|
3105
|
-
),
|
|
3106
|
-
/* @__PURE__ */ jsx4(
|
|
3107
|
-
"button",
|
|
3108
|
-
{
|
|
3109
|
-
className: `ee-toolbar-redo ${toolbar_default.toolbarBtn}`,
|
|
3110
|
-
onClick: handleRedo,
|
|
3111
|
-
disabled: !canRedo,
|
|
3112
|
-
title: "Redo (Ctrl+Shift+Z)",
|
|
3113
|
-
"aria-label": "Redo",
|
|
3114
|
-
children: "Redo"
|
|
3115
|
-
}
|
|
3116
|
-
)
|
|
3117
|
-
] }),
|
|
3118
3087
|
/* @__PURE__ */ jsxs3("div", { className: editor_default.panelToggle, children: [
|
|
3119
3088
|
/* @__PURE__ */ jsx4(
|
|
3120
3089
|
"button",
|
|
@@ -27467,6 +27436,12 @@ import React26, { useState as useState14, useCallback as useCallback18, useRef a
|
|
|
27467
27436
|
|
|
27468
27437
|
// src/styles/canvas.module.css
|
|
27469
27438
|
var canvas_default = {
|
|
27439
|
+
"canvasArea": "canvasArea",
|
|
27440
|
+
"canvasHeader": "canvasHeader",
|
|
27441
|
+
"canvasHeaderCenter": "canvasHeaderCenter",
|
|
27442
|
+
"canvasHeaderGroup": "canvasHeaderGroup",
|
|
27443
|
+
"canvasHeaderBtn": "canvasHeaderBtn",
|
|
27444
|
+
"canvasHeaderBtnActive": "canvasHeaderBtnActive",
|
|
27470
27445
|
"canvasWrapper": "canvasWrapper",
|
|
27471
27446
|
"canvasBody": "canvasBody",
|
|
27472
27447
|
"canvasBodyDragOver": "canvasBodyDragOver",
|
|
@@ -28008,10 +27983,13 @@ var SectionDropZone = React29.memo(function SectionDropZone2({ index }) {
|
|
|
28008
27983
|
|
|
28009
27984
|
// src/components/Canvas/Canvas.tsx
|
|
28010
27985
|
import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
27986
|
+
var MOBILE_WIDTH = 375;
|
|
28011
27987
|
var Canvas = React30.memo(function Canvas2() {
|
|
28012
27988
|
const { template } = useTemplateContext();
|
|
27989
|
+
const { canUndo, canRedo } = useHistoryContext();
|
|
28013
27990
|
const dispatch = useEditorDispatch();
|
|
28014
27991
|
const [isDragOver, setIsDragOver] = useState18(false);
|
|
27992
|
+
const [previewMode, setPreviewMode] = useState18("desktop");
|
|
28015
27993
|
const handleAddSection = useCallback22(() => {
|
|
28016
27994
|
dispatch({ type: "ADD_SECTION", payload: { section: createSection() } });
|
|
28017
27995
|
}, [dispatch]);
|
|
@@ -28049,30 +28027,89 @@ var Canvas = React30.memo(function Canvas2() {
|
|
|
28049
28027
|
},
|
|
28050
28028
|
[dispatch]
|
|
28051
28029
|
);
|
|
28052
|
-
|
|
28053
|
-
"
|
|
28054
|
-
|
|
28055
|
-
|
|
28056
|
-
|
|
28057
|
-
|
|
28058
|
-
|
|
28059
|
-
|
|
28060
|
-
|
|
28061
|
-
|
|
28062
|
-
|
|
28063
|
-
|
|
28064
|
-
|
|
28065
|
-
|
|
28066
|
-
|
|
28067
|
-
|
|
28068
|
-
|
|
28069
|
-
|
|
28070
|
-
|
|
28071
|
-
|
|
28072
|
-
|
|
28073
|
-
|
|
28074
|
-
|
|
28075
|
-
|
|
28030
|
+
const handleUndo = useCallback22(() => {
|
|
28031
|
+
dispatch({ type: "UNDO" });
|
|
28032
|
+
}, [dispatch]);
|
|
28033
|
+
const handleRedo = useCallback22(() => {
|
|
28034
|
+
dispatch({ type: "REDO" });
|
|
28035
|
+
}, [dispatch]);
|
|
28036
|
+
const canvasWidth = previewMode === "mobile" ? MOBILE_WIDTH : template.globalStyles.width;
|
|
28037
|
+
return /* @__PURE__ */ jsxs22("div", { className: `ee-canvas-area ${canvas_default.canvasArea}`, children: [
|
|
28038
|
+
/* @__PURE__ */ jsxs22("div", { className: `ee-canvas-header ${canvas_default.canvasHeader}`, children: [
|
|
28039
|
+
/* @__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: [
|
|
28040
|
+
/* @__PURE__ */ jsx32(
|
|
28041
|
+
"button",
|
|
28042
|
+
{
|
|
28043
|
+
className: `ee-canvas-view-desktop ${canvas_default.canvasHeaderBtn} ${previewMode === "desktop" ? `ee-canvas-view--active ${canvas_default.canvasHeaderBtnActive}` : ""}`,
|
|
28044
|
+
onClick: () => setPreviewMode("desktop"),
|
|
28045
|
+
"aria-pressed": previewMode === "desktop",
|
|
28046
|
+
"aria-label": "Desktop view",
|
|
28047
|
+
title: `Desktop (${template.globalStyles.width}px)`,
|
|
28048
|
+
children: "\u{1F5A5}"
|
|
28049
|
+
}
|
|
28050
|
+
),
|
|
28051
|
+
/* @__PURE__ */ jsx32(
|
|
28052
|
+
"button",
|
|
28053
|
+
{
|
|
28054
|
+
className: `ee-canvas-view-mobile ${canvas_default.canvasHeaderBtn} ${previewMode === "mobile" ? `ee-canvas-view--active ${canvas_default.canvasHeaderBtnActive}` : ""}`,
|
|
28055
|
+
onClick: () => setPreviewMode("mobile"),
|
|
28056
|
+
"aria-pressed": previewMode === "mobile",
|
|
28057
|
+
"aria-label": "Mobile view",
|
|
28058
|
+
title: "Mobile (375px)",
|
|
28059
|
+
children: "\u{1F4F1}"
|
|
28060
|
+
}
|
|
28061
|
+
)
|
|
28062
|
+
] }) }),
|
|
28063
|
+
/* @__PURE__ */ jsxs22("div", { className: `ee-canvas-history ${canvas_default.canvasHeaderGroup}`, role: "group", "aria-label": "History", children: [
|
|
28064
|
+
/* @__PURE__ */ jsx32(
|
|
28065
|
+
"button",
|
|
28066
|
+
{
|
|
28067
|
+
className: `ee-canvas-undo ${canvas_default.canvasHeaderBtn}`,
|
|
28068
|
+
onClick: handleUndo,
|
|
28069
|
+
disabled: !canUndo,
|
|
28070
|
+
title: "Undo (Ctrl+Z)",
|
|
28071
|
+
"aria-label": "Undo",
|
|
28072
|
+
children: "\u21A9"
|
|
28073
|
+
}
|
|
28074
|
+
),
|
|
28075
|
+
/* @__PURE__ */ jsx32(
|
|
28076
|
+
"button",
|
|
28077
|
+
{
|
|
28078
|
+
className: `ee-canvas-redo ${canvas_default.canvasHeaderBtn}`,
|
|
28079
|
+
onClick: handleRedo,
|
|
28080
|
+
disabled: !canRedo,
|
|
28081
|
+
title: "Redo (Ctrl+Shift+Z)",
|
|
28082
|
+
"aria-label": "Redo",
|
|
28083
|
+
children: "\u21AA"
|
|
28084
|
+
}
|
|
28085
|
+
)
|
|
28086
|
+
] })
|
|
28087
|
+
] }),
|
|
28088
|
+
/* @__PURE__ */ jsx32("div", { className: `ee-canvas-wrapper ${canvas_default.canvasWrapper}`, onClick: handleCanvasClick, role: "main", "aria-label": "Email canvas", children: /* @__PURE__ */ jsxs22(
|
|
28089
|
+
"div",
|
|
28090
|
+
{
|
|
28091
|
+
className: `ee-canvas-body ${canvas_default.canvasBody} ${isDragOver ? canvas_default.canvasBodyDragOver : ""}`,
|
|
28092
|
+
style: {
|
|
28093
|
+
width: canvasWidth,
|
|
28094
|
+
backgroundColor: template.globalStyles.backgroundColor,
|
|
28095
|
+
fontFamily: template.globalStyles.fontFamily
|
|
28096
|
+
},
|
|
28097
|
+
onClick: (e) => e.stopPropagation(),
|
|
28098
|
+
onDragOver: handleBodyDragOver,
|
|
28099
|
+
onDragLeave: handleBodyDragLeave,
|
|
28100
|
+
onDrop: handleBodyDrop,
|
|
28101
|
+
"aria-label": "Email content area",
|
|
28102
|
+
children: [
|
|
28103
|
+
template.sections.map((section, index) => /* @__PURE__ */ jsxs22(React30.Fragment, { children: [
|
|
28104
|
+
/* @__PURE__ */ jsx32(SectionDropZone, { index }),
|
|
28105
|
+
/* @__PURE__ */ jsx32(Section, { section })
|
|
28106
|
+
] }, section.id)),
|
|
28107
|
+
template.sections.length > 0 && /* @__PURE__ */ jsx32(SectionDropZone, { index: template.sections.length }),
|
|
28108
|
+
/* @__PURE__ */ jsx32("button", { className: `ee-add-section ${canvas_default.addSectionBtn}`, onClick: handleAddSection, "aria-label": "Add new section", children: "+ Add Section" })
|
|
28109
|
+
]
|
|
28110
|
+
}
|
|
28111
|
+
) })
|
|
28112
|
+
] });
|
|
28076
28113
|
});
|
|
28077
28114
|
|
|
28078
28115
|
// src/components/Properties/SectionProperties.tsx
|