easy-email-pro-theme 1.11.0 → 1.12.1
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
|
@@ -860,12 +860,6 @@ const getNodePathName = (path2, name) => {
|
|
|
860
860
|
return path2.join(".children.");
|
|
861
861
|
return path2.join(".children.") + "." + name;
|
|
862
862
|
};
|
|
863
|
-
const unauthorizedHtml = `<div style="position: fixed;z-index: 9999999999;bottom: 40px;right: 40px;background-color: #ffffff;width: 320px;padding: 20px;box-sizing: border-box;box-shadow: 1px 1px 5px 0px #ccc;">
|
|
864
|
-
<div style="font-weight:bold">Authorization Terminated</div>
|
|
865
|
-
<div>We regret to inform you that your authorization has been terminated.</div>
|
|
866
|
-
<div>Please contact us: <a target="_blank" style="font-weight: bold;color: rgb(0, 120, 212);cursor:pointer;" href="mailto:ch.mao@qq.com">ch.mao@qq.com</a></div>
|
|
867
|
-
|
|
868
|
-
</div>`;
|
|
869
863
|
const EditorContext = createContext({});
|
|
870
864
|
const getInited = (editor) => {
|
|
871
865
|
let inited = false;
|
|
@@ -883,46 +877,29 @@ const EditorContextProvider = (props) => {
|
|
|
883
877
|
const editor = useSlate();
|
|
884
878
|
const { form } = Form.useFormContext();
|
|
885
879
|
const values2 = form.getFieldsValue();
|
|
886
|
-
const { attributesVariables
|
|
880
|
+
const { attributesVariables } = useEditorProps();
|
|
887
881
|
const [mergetagsData, setMergetagsData] = useState({});
|
|
888
882
|
const initialValuesRef = useRef(props.initialValues);
|
|
889
883
|
const lastAdapterNonPageValues = useRef({});
|
|
890
884
|
const mergetagsDataRef = useRefState(mergetagsData);
|
|
891
885
|
const [inited, setInited] = useState(false);
|
|
892
|
-
const [hasAuth, setHasAuth] = useState(false);
|
|
893
|
-
const [isUnauthorized, setIsUnauthorized] = useState(false);
|
|
894
886
|
useEffect(() => {
|
|
895
887
|
if (isEqual$3(props.mergetagsData, mergetagsDataRef.current))
|
|
896
888
|
return;
|
|
897
889
|
setMergetagsData(cloneDeep(props.mergetagsData) || {});
|
|
898
890
|
}, [mergetagsDataRef, props.mergetagsData]);
|
|
899
891
|
const pageElement = editor.children[0];
|
|
900
|
-
useEffect(() => {
|
|
901
|
-
EditorCore.auth(props.clientId).then(() => {
|
|
902
|
-
setHasAuth(true);
|
|
903
|
-
}).catch((error2) => {
|
|
904
|
-
const status = get(error2, "response.status");
|
|
905
|
-
if (status === 401) {
|
|
906
|
-
setIsUnauthorized(true);
|
|
907
|
-
} else {
|
|
908
|
-
const errorMessage = unauthorizedHtml;
|
|
909
|
-
const div = document.createElement("div");
|
|
910
|
-
div.innerHTML = errorMessage;
|
|
911
|
-
document.body.appendChild(div);
|
|
912
|
-
}
|
|
913
|
-
});
|
|
914
|
-
}, [props.clientId]);
|
|
915
892
|
useEffect(() => {
|
|
916
893
|
const timer = setInterval(() => {
|
|
917
894
|
const inited2 = getInited(editor);
|
|
918
|
-
if (inited2
|
|
895
|
+
if (inited2) {
|
|
919
896
|
setInited(true);
|
|
920
897
|
} else {
|
|
921
898
|
setInited(false);
|
|
922
899
|
}
|
|
923
900
|
}, 100);
|
|
924
901
|
return () => timer && clearInterval(timer);
|
|
925
|
-
}, [editor
|
|
902
|
+
}, [editor]);
|
|
926
903
|
const { lock } = useEditorState();
|
|
927
904
|
const { universalElementSetting } = useEditorProps();
|
|
928
905
|
const valid = !lock;
|
|
@@ -1064,8 +1041,7 @@ const EditorContextProvider = (props) => {
|
|
|
1064
1041
|
valid,
|
|
1065
1042
|
reset,
|
|
1066
1043
|
getFieldValue,
|
|
1067
|
-
submit
|
|
1068
|
-
hasAuth
|
|
1044
|
+
submit
|
|
1069
1045
|
};
|
|
1070
1046
|
}, [
|
|
1071
1047
|
adapterValues,
|
|
@@ -1077,18 +1053,11 @@ const EditorContextProvider = (props) => {
|
|
|
1077
1053
|
valid,
|
|
1078
1054
|
reset,
|
|
1079
1055
|
getFieldValue,
|
|
1080
|
-
submit
|
|
1081
|
-
hasAuth
|
|
1056
|
+
submit
|
|
1082
1057
|
]);
|
|
1083
1058
|
return useMemo$1(() => {
|
|
1084
|
-
if (!hasAuth) {
|
|
1085
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, loadingElement) || null;
|
|
1086
|
-
}
|
|
1087
|
-
if (isUnauthorized) {
|
|
1088
|
-
return /* @__PURE__ */ React__default.createElement("div", { dangerouslySetInnerHTML: { __html: unauthorizedHtml } });
|
|
1089
|
-
}
|
|
1090
1059
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(EditorContext.Provider, { value: data }, props.children));
|
|
1091
|
-
}, [
|
|
1060
|
+
}, [data, props.children]);
|
|
1092
1061
|
};
|
|
1093
1062
|
const FormProvider = ({ children }) => {
|
|
1094
1063
|
const props = useEditorProps();
|
|
@@ -1386,26 +1355,64 @@ const useElementInteract = () => {
|
|
|
1386
1355
|
},
|
|
1387
1356
|
[editor, setSelectedNodePath]
|
|
1388
1357
|
);
|
|
1358
|
+
const moveUp3 = useCallback$1(
|
|
1359
|
+
(path2) => {
|
|
1360
|
+
try {
|
|
1361
|
+
const previous = Path.previous(path2);
|
|
1362
|
+
if (!Node$1.get(editor, previous))
|
|
1363
|
+
return;
|
|
1364
|
+
Transforms.moveNodes(editor, {
|
|
1365
|
+
at: path2,
|
|
1366
|
+
to: previous
|
|
1367
|
+
});
|
|
1368
|
+
setSelectedNodePath(previous);
|
|
1369
|
+
return previous;
|
|
1370
|
+
} catch (error2) {
|
|
1371
|
+
}
|
|
1372
|
+
},
|
|
1373
|
+
[editor, setSelectedNodePath]
|
|
1374
|
+
);
|
|
1375
|
+
const moveDown3 = useCallback$1(
|
|
1376
|
+
(path2) => {
|
|
1377
|
+
try {
|
|
1378
|
+
const next = Path.next(path2);
|
|
1379
|
+
if (!Node$1.get(editor, next))
|
|
1380
|
+
return;
|
|
1381
|
+
Transforms.moveNodes(editor, {
|
|
1382
|
+
at: path2,
|
|
1383
|
+
to: next
|
|
1384
|
+
});
|
|
1385
|
+
setSelectedNodePath(next);
|
|
1386
|
+
return next;
|
|
1387
|
+
} catch (error2) {
|
|
1388
|
+
}
|
|
1389
|
+
},
|
|
1390
|
+
[editor, setSelectedNodePath]
|
|
1391
|
+
);
|
|
1389
1392
|
const deleteBlock = useCallback$1(
|
|
1390
1393
|
(path2) => {
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1394
|
+
try {
|
|
1395
|
+
const [entry] = Editor.nodes(editor, {
|
|
1396
|
+
match(node, currentPath) {
|
|
1397
|
+
return Path.equals(path2, currentPath);
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
if (entry) {
|
|
1401
|
+
setSelectedNodePath(null);
|
|
1402
|
+
setTimeout(() => {
|
|
1403
|
+
Transforms.delete(editor, {
|
|
1404
|
+
at: path2
|
|
1405
|
+
});
|
|
1406
|
+
}, 0);
|
|
1407
|
+
} else {
|
|
1399
1408
|
Transforms.delete(editor, {
|
|
1400
1409
|
at: path2
|
|
1401
1410
|
});
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
});
|
|
1411
|
+
}
|
|
1412
|
+
setHoverNodePath(null);
|
|
1413
|
+
} catch (error2) {
|
|
1414
|
+
console.log(error2);
|
|
1407
1415
|
}
|
|
1408
|
-
setHoverNodePath(null);
|
|
1409
1416
|
},
|
|
1410
1417
|
[editor, setHoverNodePath, setSelectedNodePath]
|
|
1411
1418
|
);
|
|
@@ -1456,7 +1463,9 @@ const useElementInteract = () => {
|
|
|
1456
1463
|
deleteBlock,
|
|
1457
1464
|
clearCanvas,
|
|
1458
1465
|
isChanged: !isEqual$3(lastSelectedNode.current, selectedNode),
|
|
1459
|
-
resetSelectedNode
|
|
1466
|
+
resetSelectedNode,
|
|
1467
|
+
moveUp: moveUp3,
|
|
1468
|
+
moveDown: moveDown3
|
|
1460
1469
|
};
|
|
1461
1470
|
};
|
|
1462
1471
|
const defaultFontList = [
|
|
@@ -1649,7 +1658,12 @@ const useMinimalistContext = () => {
|
|
|
1649
1658
|
const ElementTools$1 = ({ element, nodeElement, path: path2 }) => {
|
|
1650
1659
|
const editor = useSlate();
|
|
1651
1660
|
const { copyBlock, deleteBlock } = useElementInteract();
|
|
1652
|
-
const {
|
|
1661
|
+
const {
|
|
1662
|
+
universalElementSetting,
|
|
1663
|
+
quantityLimitCheck,
|
|
1664
|
+
ElementTools: ElementTools2,
|
|
1665
|
+
ElementToolsInner
|
|
1666
|
+
} = useEditorProps();
|
|
1653
1667
|
const { open } = useUniversalContent();
|
|
1654
1668
|
const { setSelectedNodePath, universalElementEditing, universalElementPath } = useEditorState();
|
|
1655
1669
|
const { dragHandle: dragHandle2 } = useDragging({
|
|
@@ -1703,7 +1717,14 @@ const ElementTools$1 = ({ element, nodeElement, path: path2 }) => {
|
|
|
1703
1717
|
"data-is-wrapper-category": isWrapperCategory,
|
|
1704
1718
|
"data-is-full-width": isFullWidth
|
|
1705
1719
|
},
|
|
1706
|
-
/* @__PURE__ */ React__default.createElement(
|
|
1720
|
+
ElementTools2 ? /* @__PURE__ */ React__default.createElement(
|
|
1721
|
+
ElementTools2,
|
|
1722
|
+
{
|
|
1723
|
+
element,
|
|
1724
|
+
nodeElement,
|
|
1725
|
+
path: path2
|
|
1726
|
+
}
|
|
1727
|
+
) : /* @__PURE__ */ React__default.createElement(
|
|
1707
1728
|
"div",
|
|
1708
1729
|
{
|
|
1709
1730
|
className: classnames$1(
|
|
@@ -1728,9 +1749,21 @@ const ElementTools$1 = ({ element, nodeElement, path: path2 }) => {
|
|
|
1728
1749
|
),
|
|
1729
1750
|
BlockManager.getBlockTitle(element)
|
|
1730
1751
|
),
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1752
|
+
ElementToolsInner ? /* @__PURE__ */ React__default.createElement(
|
|
1753
|
+
ElementToolsInner,
|
|
1754
|
+
{
|
|
1755
|
+
element,
|
|
1756
|
+
nodeElement,
|
|
1757
|
+
path: path2
|
|
1758
|
+
}
|
|
1759
|
+
) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, !isEditingUniversalElement && /* @__PURE__ */ React__default.createElement("div", { className: "element-tools-item", onPointerDown: onCopy }, /* @__PURE__ */ React__default.createElement(IconFont, { iconName: "icon-copy" })), universalElementSetting && !universalElementEditing && !isUniversalElement && /* @__PURE__ */ React__default.createElement(
|
|
1760
|
+
"div",
|
|
1761
|
+
{
|
|
1762
|
+
className: "element-tools-item",
|
|
1763
|
+
onPointerDown: openModal
|
|
1764
|
+
},
|
|
1765
|
+
/* @__PURE__ */ React__default.createElement(IconFont, { iconName: "icon-collection" })
|
|
1766
|
+
), !isEditingUniversalElement && /* @__PURE__ */ React__default.createElement("div", { className: "element-tools-item", onPointerDown: onDelete }, /* @__PURE__ */ React__default.createElement(IconFont, { iconName: "icon-delete" })))
|
|
1734
1767
|
)
|
|
1735
1768
|
), /* @__PURE__ */ React__default.createElement("div", { className: "element-dragover" }), /* @__PURE__ */ React__default.createElement("style", null, styleText$b));
|
|
1736
1769
|
const isContentElement = NodeUtils.isContentElement(element);
|
|
@@ -18933,7 +18966,7 @@ const DirectionOptions = [
|
|
|
18933
18966
|
{
|
|
18934
18967
|
value: "ltr",
|
|
18935
18968
|
get label() {
|
|
18936
|
-
return t("Left to
|
|
18969
|
+
return t("Left to right");
|
|
18937
18970
|
}
|
|
18938
18971
|
},
|
|
18939
18972
|
{
|
|
@@ -39627,7 +39660,7 @@ const useCreateConfig$1 = (_m) => {
|
|
|
39627
39660
|
});
|
|
39628
39661
|
};
|
|
39629
39662
|
const Layout$1 = ({ children }) => {
|
|
39630
|
-
const { inited } = useEditorContext();
|
|
39663
|
+
const { inited, values: values2 } = useEditorContext();
|
|
39631
39664
|
const {
|
|
39632
39665
|
controller = true,
|
|
39633
39666
|
showSidebar = true,
|
|
@@ -39635,6 +39668,7 @@ const Layout$1 = ({ children }) => {
|
|
|
39635
39668
|
height,
|
|
39636
39669
|
compact
|
|
39637
39670
|
} = useEditorProps();
|
|
39671
|
+
const pageDataWidth = parseInt(values2.content.attributes.width || "600") || 600;
|
|
39638
39672
|
const editor = useSlate();
|
|
39639
39673
|
const getRoot = () => {
|
|
39640
39674
|
try {
|
|
@@ -39683,7 +39717,12 @@ const Layout$1 = ({ children }) => {
|
|
|
39683
39717
|
},
|
|
39684
39718
|
/* @__PURE__ */ React__default.createElement(SharedComponents.BlockSideBar, { height })
|
|
39685
39719
|
),
|
|
39686
|
-
/* @__PURE__ */ React__default.createElement("div", { style: { height, minWidth: 800, flex: 1 } }, /* @__PURE__ */ React__default.createElement(SharedComponents.EditorTabs, null, /* @__PURE__ */ React__default.createElement(EmailEditor, null, /* @__PURE__ */ React__default.createElement("style", { id: "Retro-CSS" }, styleText$c, RetroStyleText
|
|
39720
|
+
/* @__PURE__ */ React__default.createElement("div", { style: { height, minWidth: 800, flex: 1 } }, /* @__PURE__ */ React__default.createElement(SharedComponents.EditorTabs, null, /* @__PURE__ */ React__default.createElement(EmailEditor, null, /* @__PURE__ */ React__default.createElement("style", { id: "Retro-CSS" }, styleText$c, RetroStyleText, `
|
|
39721
|
+
body {
|
|
39722
|
+
--page-width: ${pageDataWidth}px;
|
|
39723
|
+
}
|
|
39724
|
+
|
|
39725
|
+
`), children))),
|
|
39687
39726
|
showSidebar && compact && /* @__PURE__ */ React__default.createElement(
|
|
39688
39727
|
Layout$2.Sider,
|
|
39689
39728
|
{
|
|
@@ -98,7 +98,16 @@ export interface PluginsCustomEditorTypes {
|
|
|
98
98
|
widgetMode?: boolean;
|
|
99
99
|
widgetElement?: SectionWidgetElement | ContentWidgetElement;
|
|
100
100
|
emptyPageElement?: PageElement;
|
|
101
|
-
|
|
101
|
+
ElementToolsInner?: React.FC<{
|
|
102
|
+
element: Element;
|
|
103
|
+
nodeElement: HTMLElement;
|
|
104
|
+
path: Path;
|
|
105
|
+
}>;
|
|
106
|
+
ElementTools?: React.FC<{
|
|
107
|
+
element: Element;
|
|
108
|
+
nodeElement: HTMLElement;
|
|
109
|
+
path: Path;
|
|
110
|
+
}>;
|
|
102
111
|
};
|
|
103
112
|
EmailTemplate: BasicEmailTemplate;
|
|
104
113
|
}
|