easy-email-pro-theme 1.35.0 → 1.36.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/lib/index.js
CHANGED
|
@@ -8739,7 +8739,9 @@ const PreviewEmail = ({
|
|
|
8739
8739
|
universalElementSetting,
|
|
8740
8740
|
values: values2,
|
|
8741
8741
|
mergetagsData,
|
|
8742
|
-
pageDataVariables
|
|
8742
|
+
pageDataVariables,
|
|
8743
|
+
headerElement,
|
|
8744
|
+
footerElement
|
|
8743
8745
|
}) => {
|
|
8744
8746
|
const mjmlString = useMemo$1(() => {
|
|
8745
8747
|
return EditorCore.toMJML({
|
|
@@ -8747,13 +8749,17 @@ const PreviewEmail = ({
|
|
|
8747
8749
|
mode: "production",
|
|
8748
8750
|
universalElements: universalElementSetting,
|
|
8749
8751
|
mergetagsData: cloneDeep(mergetagsData),
|
|
8750
|
-
attributesVariables: pageDataVariables
|
|
8752
|
+
attributesVariables: pageDataVariables,
|
|
8753
|
+
headerElement,
|
|
8754
|
+
footerElement
|
|
8751
8755
|
});
|
|
8752
8756
|
}, [
|
|
8753
|
-
|
|
8757
|
+
values2.content,
|
|
8754
8758
|
universalElementSetting,
|
|
8759
|
+
mergetagsData,
|
|
8755
8760
|
pageDataVariables,
|
|
8756
|
-
|
|
8761
|
+
headerElement,
|
|
8762
|
+
footerElement
|
|
8757
8763
|
]);
|
|
8758
8764
|
const html = useMemo$1(() => {
|
|
8759
8765
|
const skeletonHtml = mjml(mjmlString, {
|
|
@@ -8821,7 +8827,7 @@ const PreviewEmailDrawer = ({
|
|
|
8821
8827
|
const { activeTab } = useEditorState();
|
|
8822
8828
|
const [isShowSidebar, setIsShowSidebar] = React__default.useState(false);
|
|
8823
8829
|
const { values: values2, mergetagsData, pageDataVariables } = useEditorContext();
|
|
8824
|
-
const { universalElementSetting } = useEditorProps();
|
|
8830
|
+
const { universalElementSetting, headerElement, footerElement } = useEditorProps();
|
|
8825
8831
|
const subject = useMemo$1(() => {
|
|
8826
8832
|
try {
|
|
8827
8833
|
return PluginManager.renderWithData(values2.subject, mergetagsData || {});
|
|
@@ -8898,7 +8904,9 @@ const PreviewEmailDrawer = ({
|
|
|
8898
8904
|
universalElementSetting,
|
|
8899
8905
|
values: values2,
|
|
8900
8906
|
mergetagsData,
|
|
8901
|
-
pageDataVariables
|
|
8907
|
+
pageDataVariables,
|
|
8908
|
+
headerElement,
|
|
8909
|
+
footerElement
|
|
8902
8910
|
}
|
|
8903
8911
|
))
|
|
8904
8912
|
), /* @__PURE__ */ React__default.createElement(
|
|
@@ -8930,6 +8938,8 @@ const PreviewEmailDrawer = ({
|
|
|
8930
8938
|
values2,
|
|
8931
8939
|
mergetagsData,
|
|
8932
8940
|
pageDataVariables,
|
|
8941
|
+
headerElement,
|
|
8942
|
+
footerElement,
|
|
8933
8943
|
isShowSidebar
|
|
8934
8944
|
]);
|
|
8935
8945
|
};
|
|
@@ -14113,6 +14123,7 @@ const getElementPageLayout = (params) => {
|
|
|
14113
14123
|
const top = overlayRectHeight + relativedElementReact.height + relativedElementReact.top;
|
|
14114
14124
|
const isBottomEnough = document.documentElement.clientHeight > top + edge;
|
|
14115
14125
|
const isTopEnough = iframeRect.top + relativedElementReact.top - overlayRectHeight > edge;
|
|
14126
|
+
const relativedElementVisible = !(relativedElementReact.top > iframeRect.height || relativedElementReact.top + relativedElementReact.height < 0);
|
|
14116
14127
|
return {
|
|
14117
14128
|
pageXOffset: iframeRect.left + relativedElementReact.left,
|
|
14118
14129
|
pageYOffset: iframeRect.top + relativedElementReact.top,
|
|
@@ -14121,7 +14132,8 @@ const getElementPageLayout = (params) => {
|
|
|
14121
14132
|
iframeRect,
|
|
14122
14133
|
relativedElementReact,
|
|
14123
14134
|
overlayRect,
|
|
14124
|
-
overlayRectHeight
|
|
14135
|
+
overlayRectHeight,
|
|
14136
|
+
relativedElementVisible
|
|
14125
14137
|
};
|
|
14126
14138
|
};
|
|
14127
14139
|
const HoveringToolbar = () => {
|
|
@@ -14181,7 +14193,7 @@ const HoveringToolbar = () => {
|
|
|
14181
14193
|
document.removeEventListener("click", onClick);
|
|
14182
14194
|
};
|
|
14183
14195
|
}, [contentWindow, editor]);
|
|
14184
|
-
|
|
14196
|
+
const setHoveringBarStyle = useEventCallback(() => {
|
|
14185
14197
|
var _a, _b;
|
|
14186
14198
|
if (!selectedNode)
|
|
14187
14199
|
return;
|
|
@@ -14189,13 +14201,13 @@ const HoveringToolbar = () => {
|
|
|
14189
14201
|
return;
|
|
14190
14202
|
const follow = (hoveringToolbar == null ? void 0 : hoveringToolbar.follow) || "selection";
|
|
14191
14203
|
try {
|
|
14192
|
-
const
|
|
14204
|
+
const el2 = ref2.current;
|
|
14193
14205
|
const doc = ReactEditor.findDocumentOrShadowRoot(editor);
|
|
14194
|
-
if (!contentWindow || !
|
|
14206
|
+
if (!contentWindow || !el2 || el2.contains(doc.activeElement) || !selectedContentBlockNode) {
|
|
14195
14207
|
return;
|
|
14196
14208
|
}
|
|
14197
14209
|
if (isNotSelect) {
|
|
14198
|
-
|
|
14210
|
+
el2.removeAttribute("style");
|
|
14199
14211
|
return;
|
|
14200
14212
|
}
|
|
14201
14213
|
if (follow === "container") {
|
|
@@ -14204,11 +14216,15 @@ const HoveringToolbar = () => {
|
|
|
14204
14216
|
return;
|
|
14205
14217
|
const layout = getElementPageLayout({
|
|
14206
14218
|
editor,
|
|
14207
|
-
overlayElement:
|
|
14219
|
+
overlayElement: el2,
|
|
14208
14220
|
relativedElement: ReactEditor.toDOMNode(editor, selectedNode)
|
|
14209
14221
|
});
|
|
14210
14222
|
if (!layout)
|
|
14211
14223
|
return;
|
|
14224
|
+
if (!layout.relativedElementVisible) {
|
|
14225
|
+
el2.removeAttribute("style");
|
|
14226
|
+
return;
|
|
14227
|
+
}
|
|
14212
14228
|
const {
|
|
14213
14229
|
isTopEnough,
|
|
14214
14230
|
iframeRect,
|
|
@@ -14216,16 +14232,17 @@ const HoveringToolbar = () => {
|
|
|
14216
14232
|
overlayRect,
|
|
14217
14233
|
pageYOffset
|
|
14218
14234
|
} = layout;
|
|
14219
|
-
|
|
14220
|
-
const offsetTop = isTopEnough ? pageYOffset - overlayRect.height - 30 : pageYOffset + relativedElementReact.height + 30;
|
|
14221
|
-
el.style.top = `${Math.max(offsetTop, iframeRect.top - overlayRect.height)}px`;
|
|
14235
|
+
el2.style.opacity = list.length === 0 ? "0" : "1";
|
|
14222
14236
|
const sectionDomNode = ReactEditor.toDOMNode(
|
|
14223
14237
|
editor,
|
|
14224
14238
|
Node$1.get(editor, [0, 0])
|
|
14225
14239
|
);
|
|
14240
|
+
const overlayRectWidth = overlayRect.width || relativedElementReact.width;
|
|
14226
14241
|
const sectionDomNodeRect = sectionDomNode.getBoundingClientRect();
|
|
14227
|
-
const offsetLeft = iframeRect.left + sectionDomNodeRect.left + (sectionDomNodeRect.width -
|
|
14228
|
-
|
|
14242
|
+
const offsetLeft = iframeRect.left + sectionDomNodeRect.left + (sectionDomNodeRect.width - overlayRectWidth) / 2;
|
|
14243
|
+
el2.style.left = offsetLeft + "px";
|
|
14244
|
+
const offsetTop = isTopEnough ? pageYOffset - overlayRect.height - 30 : pageYOffset + relativedElementReact.height + 30;
|
|
14245
|
+
el2.style.top = `${Math.max(offsetTop, iframeRect.top - overlayRect.height)}px`;
|
|
14229
14246
|
} else if (follow === "page") {
|
|
14230
14247
|
const selectedDomNode = ReactEditor.toDOMNode(editor, selectedNode);
|
|
14231
14248
|
if (!selectedDomNode)
|
|
@@ -14237,12 +14254,12 @@ const HoveringToolbar = () => {
|
|
|
14237
14254
|
);
|
|
14238
14255
|
if (!iframe)
|
|
14239
14256
|
return;
|
|
14240
|
-
const overlayRect =
|
|
14257
|
+
const overlayRect = el2.getBoundingClientRect();
|
|
14241
14258
|
const iframeRect = iframe.getBoundingClientRect();
|
|
14242
|
-
|
|
14243
|
-
|
|
14244
|
-
|
|
14245
|
-
|
|
14259
|
+
el2.style.opacity = list.length === 0 ? "0" : "1";
|
|
14260
|
+
el2.style.width = contentWindow2.document.body.clientWidth + "px";
|
|
14261
|
+
el2.style.left = iframeRect.left + "px";
|
|
14262
|
+
el2.style.top = `${selectedDomNodeRect.top + contentWindow2.scrollY < overlayRect.height ? iframeRect.top - overlayRect.height : iframeRect.top}px`;
|
|
14246
14263
|
} else {
|
|
14247
14264
|
const domSelection = contentWindow.getSelection();
|
|
14248
14265
|
if (!domSelection)
|
|
@@ -14259,7 +14276,7 @@ const HoveringToolbar = () => {
|
|
|
14259
14276
|
}
|
|
14260
14277
|
const layout = getElementPageLayout({
|
|
14261
14278
|
editor,
|
|
14262
|
-
overlayElement:
|
|
14279
|
+
overlayElement: el2,
|
|
14263
14280
|
relativedElement: ReactEditor.toDOMNode(
|
|
14264
14281
|
editor,
|
|
14265
14282
|
selectedContentBlockNode
|
|
@@ -14274,15 +14291,52 @@ const HoveringToolbar = () => {
|
|
|
14274
14291
|
overlayRect,
|
|
14275
14292
|
pageYOffset
|
|
14276
14293
|
} = layout;
|
|
14277
|
-
|
|
14278
|
-
|
|
14294
|
+
el2.style.opacity = list.length === 0 ? "0" : "1";
|
|
14295
|
+
el2.style.top = `${isTopEnough ? pageYOffset - overlayRect.height - 10 : pageYOffset + relativedElementReact.height + 10}px`;
|
|
14279
14296
|
const left = iframeRect.left + rect.left + overlayRect.width;
|
|
14280
14297
|
const offsetLeft = document.documentElement.clientWidth - left;
|
|
14281
|
-
|
|
14298
|
+
el2.style.left = offsetLeft > 0 ? `${rect.left + iframeRect.left - 30}px` : `${rect.left + iframeRect.left + offsetLeft - 30}px`;
|
|
14282
14299
|
}
|
|
14283
14300
|
} catch (error2) {
|
|
14284
14301
|
}
|
|
14285
14302
|
});
|
|
14303
|
+
useEffect(() => {
|
|
14304
|
+
setHoveringBarStyle();
|
|
14305
|
+
});
|
|
14306
|
+
const el = ref2.current;
|
|
14307
|
+
useEffect(() => {
|
|
14308
|
+
const handleScroll = debounce$2(() => {
|
|
14309
|
+
setHoveringBarStyle();
|
|
14310
|
+
}, 100);
|
|
14311
|
+
contentWindow == null ? void 0 : contentWindow.addEventListener("scroll", handleScroll);
|
|
14312
|
+
return () => {
|
|
14313
|
+
contentWindow == null ? void 0 : contentWindow.removeEventListener("scroll", handleScroll);
|
|
14314
|
+
};
|
|
14315
|
+
}, [contentWindow, setHoveringBarStyle]);
|
|
14316
|
+
useEffect(() => {
|
|
14317
|
+
if (!el || !selectedNode)
|
|
14318
|
+
return;
|
|
14319
|
+
const follow = hoveringToolbar == null ? void 0 : hoveringToolbar.follow;
|
|
14320
|
+
if (follow === "page")
|
|
14321
|
+
return;
|
|
14322
|
+
const selectedDomNode = ReactEditor.toDOMNode(editor, selectedNode);
|
|
14323
|
+
const observer = new IntersectionObserver(
|
|
14324
|
+
(entries) => {
|
|
14325
|
+
var _a;
|
|
14326
|
+
const isIntersecting = (_a = entries[0]) == null ? void 0 : _a.isIntersecting;
|
|
14327
|
+
if (isIntersecting) {
|
|
14328
|
+
el.style.removeProperty("visibility");
|
|
14329
|
+
} else {
|
|
14330
|
+
el.style.visibility = "hidden";
|
|
14331
|
+
}
|
|
14332
|
+
},
|
|
14333
|
+
{ threshold: 0.1 }
|
|
14334
|
+
);
|
|
14335
|
+
observer.observe(selectedDomNode);
|
|
14336
|
+
return () => {
|
|
14337
|
+
observer.unobserve(selectedDomNode);
|
|
14338
|
+
};
|
|
14339
|
+
}, [editor, el, hoveringToolbar == null ? void 0 : hoveringToolbar.follow, selectedNode, setHoveringBarStyle]);
|
|
14286
14340
|
const isShowHoveringBar = selectedContentBlockNode;
|
|
14287
14341
|
const isShowTurnInto = isShowHoveringBar && !NodeUtils.isTextListElement(selectedContentBlockNode);
|
|
14288
14342
|
const list = useMemo$1(() => {
|
|
@@ -14334,7 +14388,7 @@ const HoveringToolbar = () => {
|
|
|
14334
14388
|
return /* @__PURE__ */ React__default.createElement("div", null, content);
|
|
14335
14389
|
}
|
|
14336
14390
|
return createPortal(
|
|
14337
|
-
/* @__PURE__ */ React__default.createElement(
|
|
14391
|
+
/* @__PURE__ */ React__default.createElement("div", { style: { position: "fixed", top: 0, left: 0 } }, /* @__PURE__ */ React__default.createElement(
|
|
14338
14392
|
"div",
|
|
14339
14393
|
{
|
|
14340
14394
|
ref: ref2,
|
|
@@ -14348,7 +14402,7 @@ const HoveringToolbar = () => {
|
|
|
14348
14402
|
--hovering-bar-icon-size: ${(hoveringToolbar == null ? void 0 : hoveringToolbar.iconSize) || 12}px;
|
|
14349
14403
|
|
|
14350
14404
|
}`)
|
|
14351
|
-
),
|
|
14405
|
+
)),
|
|
14352
14406
|
document.body
|
|
14353
14407
|
);
|
|
14354
14408
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { EmailEditorProps, EmailTemplate } from "easy-email-pro-editor";
|
|
3
|
-
export declare const PreviewEmail: ({ isDesktop, universalElementSetting, values, mergetagsData, pageDataVariables, }: {
|
|
3
|
+
export declare const PreviewEmail: ({ isDesktop, universalElementSetting, values, mergetagsData, pageDataVariables, headerElement, footerElement, }: {
|
|
4
4
|
isDesktop: boolean;
|
|
5
5
|
universalElementSetting: EmailEditorProps["universalElementSetting"];
|
|
6
6
|
values: EmailTemplate;
|
|
7
7
|
mergetagsData: EmailEditorProps["mergetagsData"];
|
|
8
8
|
pageDataVariables: EmailEditorProps["attributesVariables"];
|
|
9
|
+
headerElement?: EmailEditorProps["headerElement"];
|
|
10
|
+
footerElement?: EmailEditorProps["footerElement"];
|
|
9
11
|
}) => React.JSX.Element;
|
|
@@ -7,7 +7,7 @@ export declare const SharedComponents: {
|
|
|
7
7
|
PreviewEmailDrawer: ({ children, }: {
|
|
8
8
|
children: import("react").ReactNode;
|
|
9
9
|
}) => import("react").JSX.Element;
|
|
10
|
-
PreviewEmail: ({ isDesktop, universalElementSetting, values, mergetagsData, pageDataVariables, }: {
|
|
10
|
+
PreviewEmail: ({ isDesktop, universalElementSetting, values, mergetagsData, pageDataVariables, headerElement, footerElement, }: {
|
|
11
11
|
isDesktop: boolean;
|
|
12
12
|
universalElementSetting: ({
|
|
13
13
|
elements: Record<string, import("../easy-email-pro-core/lib/typings").Element>;
|
|
@@ -34,6 +34,8 @@ export declare const SharedComponents: {
|
|
|
34
34
|
values: import("easy-email-pro-editor").BasicEmailTemplate;
|
|
35
35
|
mergetagsData: Record<string, any> | undefined;
|
|
36
36
|
pageDataVariables: Record<string, string | number | boolean | null | undefined> | undefined;
|
|
37
|
+
headerElement?: import("../easy-email-pro-core/lib/typings").Element | undefined;
|
|
38
|
+
footerElement?: import("../easy-email-pro-core/lib/typings").Element | undefined;
|
|
37
39
|
}) => import("react").JSX.Element;
|
|
38
40
|
BlockSideBar: ({ height }: import("./BlockSideBar").BlockSideBarProps) => import("react").JSX.Element;
|
|
39
41
|
ConfigurationSideBar: ({ height }: import("./ConfigurationSideBar").ConfigurationSideBarProps) => import("react").JSX.Element;
|