easy-email-extensions 3.0.14 → 3.1.3
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/BlockLayer/components/BlockTree/index.d.ts +40 -18
- package/lib/BlockLayer/components/BlockTree/transparentImage.d.ts +1 -0
- package/lib/BlockLayer/hooks/useAvatarWrapperDrop.d.ts +24 -0
- package/lib/BlockLayer/index.d.ts +1 -0
- package/lib/components/Form/index.d.ts +18 -17
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -3
- package/lib/index.js.map +1 -1
- package/lib/index2.js +1500 -1463
- package/lib/index2.js.map +1 -1
- package/lib/index3.js +1 -2
- package/lib/index3.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +4 -8
- package/lib/BlockLayer/components/BlockTree/components/BlockTreeItem/index.d.ts +0 -23
- package/lib/BlockLayer/components/BlockTree/components/TreeCollapse.d.ts +0 -6
- package/lib/components/Form/RichTextToolBar/components/MergeTags/MergeTags.d.ts +0 -6
- package/lib/components/Form/RichTextToolBar/components/MergeTags/index.d.ts +0 -1
package/lib/index2.js
CHANGED
@@ -54,15 +54,14 @@ var __async = (__this, __arguments, generator) => {
|
|
54
54
|
});
|
55
55
|
};
|
56
56
|
import * as React from "react";
|
57
|
-
import React__default, {
|
58
|
-
import { IconFont, Stack as Stack$6, TextStyle, getBlockNodeByIdx, useBlock, getEditNode, getEditContent, useEditorProps,
|
59
|
-
import { BasicType, ImageManager, getIndexByIdx, getSiblingIdx,
|
60
|
-
import { ReactSortable } from "react-sortablejs";
|
61
|
-
import { useField, Field, useForm as useForm$1, Form as Form$3, version as version$2, useFormState } from "react-final-form";
|
57
|
+
import React__default, { Children, isValidElement, cloneElement, createContext, useContext, Component, useMemo, memo, forwardRef, useEffect, useRef, useLayoutEffect, useState, createRef, useImperativeHandle, PureComponent, useCallback, useReducer, createElement, Suspense } from "react";
|
58
|
+
import { IconFont, Stack as Stack$6, TextStyle, getBlockNodeByIdx, useBlock, getEditNode, getEditContent, useEditorProps, useFocusIdx, useEditorContext, getShadowRoot, FIXED_CONTAINER_ID, scrollBlockEleIntoView, useHoverIdx, useDataTransfer, getBlockNodeByChildEle, getDirectionPosition, DATA_ATTRIBUTE_ID, DATA_ATTRIBUTE_DROP_CONTAINER, BlockAvatarWrapper, getEditorRoot, useActiveTab, ActiveTabKeys } from "easy-email-editor";
|
59
|
+
import { BasicType, ImageManager, getContextMergeTags, BlockManager, createBlockDataByType, getParentByIdx, getValueByIdx, getIndexByIdx, getSiblingIdx, getNodeIdxFromClassName, getParentIdx, getNodeIdxClassName, getPageIdx, getChildIdx, MjmlToJson, JsonToMjml, getNodeTypeFromClassName } from "easy-email-core";
|
62
60
|
import ReactDOM, { findDOMNode, createPortal } from "react-dom";
|
63
|
-
|
64
|
-
|
65
|
-
|
61
|
+
import { useField, Field, useForm as useForm$1, Form as Form$3, version as version$2, useFormState } from "react-final-form";
|
62
|
+
var index$2 = "";
|
63
|
+
const title = "_title_pteer_1";
|
64
|
+
var styles$6 = {
|
66
65
|
title
|
67
66
|
};
|
68
67
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
@@ -5498,313 +5497,6 @@ function EyeIcon$1({
|
|
5498
5497
|
iconName: "icon-eye"
|
5499
5498
|
});
|
5500
5499
|
}
|
5501
|
-
const treeNodeList = "_treeNodeList_7a1ah_1";
|
5502
|
-
const treeNodeWrapper = "_treeNodeWrapper_7a1ah_6";
|
5503
|
-
const treeNode = "_treeNode_7a1ah_1";
|
5504
|
-
const treeNodeSelected = "_treeNodeSelected_7a1ah_18";
|
5505
|
-
const treeNodeTitle = "_treeNodeTitle_7a1ah_21";
|
5506
|
-
var styles$8 = {
|
5507
|
-
treeNodeList,
|
5508
|
-
treeNodeWrapper,
|
5509
|
-
treeNode,
|
5510
|
-
treeNodeSelected,
|
5511
|
-
treeNodeTitle
|
5512
|
-
};
|
5513
|
-
const TreeCollapse = React__default.memo(({ expand, setExpand, hasChildren }) => {
|
5514
|
-
const onToggle = useCallback(() => {
|
5515
|
-
setExpand((v) => !v);
|
5516
|
-
}, [setExpand]);
|
5517
|
-
if (!hasChildren)
|
5518
|
-
return /* @__PURE__ */ React__default.createElement(IconFont, {
|
5519
|
-
size: 12,
|
5520
|
-
iconName: "icon-dot",
|
5521
|
-
onClickCapture: onToggle
|
5522
|
-
});
|
5523
|
-
if (expand) {
|
5524
|
-
return /* @__PURE__ */ React__default.createElement(IconFont, {
|
5525
|
-
size: 12,
|
5526
|
-
iconName: "icon-minus-square",
|
5527
|
-
onClickCapture: onToggle
|
5528
|
-
});
|
5529
|
-
}
|
5530
|
-
return /* @__PURE__ */ React__default.createElement(IconFont, {
|
5531
|
-
size: 12,
|
5532
|
-
iconName: "icon-plus-square",
|
5533
|
-
onClickCapture: onToggle
|
5534
|
-
});
|
5535
|
-
});
|
5536
|
-
function classnames$1(...rest) {
|
5537
|
-
return rest.filter((item2) => typeof item2 === "string").join(" ");
|
5538
|
-
}
|
5539
|
-
const DATA_ATTRIBUTE_ID = "data-tree-node-id";
|
5540
|
-
const DATA_ATTRIBUTE_INDEX = "data-tree-node-index";
|
5541
|
-
function BlockTreeItem(props) {
|
5542
|
-
var _a, _b;
|
5543
|
-
const {
|
5544
|
-
nodeData,
|
5545
|
-
renderTitle,
|
5546
|
-
defaultExpandAll,
|
5547
|
-
onDragStart,
|
5548
|
-
onDragMove,
|
5549
|
-
onDragEnd,
|
5550
|
-
onSpill,
|
5551
|
-
indent,
|
5552
|
-
index: index2,
|
5553
|
-
onSelect: handleSelect,
|
5554
|
-
onMouseEnter: handleMouseEnter,
|
5555
|
-
onContextMenu: handleContextMenu
|
5556
|
-
} = props;
|
5557
|
-
const [expand, setExpand] = useState(Boolean(defaultExpandAll));
|
5558
|
-
const ulRef = useRef(null);
|
5559
|
-
const initedRef = useRef(false);
|
5560
|
-
useEffect(() => {
|
5561
|
-
const ulEle = ulRef.current;
|
5562
|
-
if (!ulEle)
|
5563
|
-
return;
|
5564
|
-
if (!initedRef.current) {
|
5565
|
-
initedRef.current = true;
|
5566
|
-
if (!expand) {
|
5567
|
-
ulEle.style.setProperty("max-height", "0px");
|
5568
|
-
}
|
5569
|
-
return;
|
5570
|
-
}
|
5571
|
-
if (expand) {
|
5572
|
-
const onTransitionEnd = () => {
|
5573
|
-
ulEle.style.removeProperty("max-height");
|
5574
|
-
ulEle.removeEventListener("transitionend", onTransitionEnd);
|
5575
|
-
};
|
5576
|
-
ulEle.style.setProperty("transition", "none");
|
5577
|
-
ulEle.style.removeProperty("max-height");
|
5578
|
-
const maxHeight = ulEle.getBoundingClientRect().height;
|
5579
|
-
ulEle.style.setProperty("max-height", "0px");
|
5580
|
-
ulEle.addEventListener("transitionend", onTransitionEnd);
|
5581
|
-
requestAnimationFrame(() => {
|
5582
|
-
ulEle.style.setProperty("transition", "all .3s ease-out");
|
5583
|
-
ulEle.style.setProperty("max-height", maxHeight + "px");
|
5584
|
-
});
|
5585
|
-
} else {
|
5586
|
-
ulEle.style.setProperty("transition", "none");
|
5587
|
-
const maxHeight = ulEle.getBoundingClientRect().height;
|
5588
|
-
ulEle.style.setProperty("max-height", maxHeight + "px");
|
5589
|
-
requestAnimationFrame(() => {
|
5590
|
-
ulEle.style.setProperty("transition", "all .3s ease-out");
|
5591
|
-
ulEle.style.setProperty("max-height", "0px");
|
5592
|
-
});
|
5593
|
-
}
|
5594
|
-
}, [expand]);
|
5595
|
-
const onStart = useCallback((evt, sortable, store) => {
|
5596
|
-
if (onDragStart) {
|
5597
|
-
onDragStart(evt, sortable, store);
|
5598
|
-
}
|
5599
|
-
setExpand(false);
|
5600
|
-
}, [onDragStart]);
|
5601
|
-
const onSelect = useCallback((ev) => {
|
5602
|
-
ev.stopPropagation();
|
5603
|
-
handleSelect(nodeData.id);
|
5604
|
-
}, [nodeData.id, handleSelect]);
|
5605
|
-
const onMouseEnter = useCallback((ev) => {
|
5606
|
-
handleMouseEnter && handleMouseEnter(nodeData.id, ev);
|
5607
|
-
}, [nodeData.id, handleMouseEnter]);
|
5608
|
-
const onContextMenu = useCallback((ev) => {
|
5609
|
-
handleContextMenu && handleContextMenu(nodeData, ev);
|
5610
|
-
}, [handleContextMenu, nodeData]);
|
5611
|
-
return /* @__PURE__ */ React__default.createElement("li", {
|
5612
|
-
className: styles$8.treeNodeWrapper
|
5613
|
-
}, /* @__PURE__ */ React__default.createElement(ReactSortable, __spreadValues({
|
5614
|
-
revertOnSpill: true,
|
5615
|
-
list: [{ id: nodeData.id }],
|
5616
|
-
setList: () => {
|
5617
|
-
},
|
5618
|
-
onMove: onDragMove,
|
5619
|
-
onEnd: onDragEnd,
|
5620
|
-
onStart,
|
5621
|
-
onSpill
|
5622
|
-
}, {
|
5623
|
-
animation: 150,
|
5624
|
-
fallbackOnBody: true,
|
5625
|
-
swapThreshold: 0.65,
|
5626
|
-
ghostClass: "ghost",
|
5627
|
-
group: "shared"
|
5628
|
-
}), /* @__PURE__ */ React__default.createElement("div", __spreadValues({
|
5629
|
-
onMouseEnter,
|
5630
|
-
onContextMenu,
|
5631
|
-
className: classnames$1(styles$8.treeNode)
|
5632
|
-
}, {
|
5633
|
-
[DATA_ATTRIBUTE_ID]: nodeData.id,
|
5634
|
-
[DATA_ATTRIBUTE_INDEX]: index2
|
5635
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
5636
|
-
style: { width: indent * 18 }
|
5637
|
-
}), /* @__PURE__ */ React__default.createElement(TreeCollapse, {
|
5638
|
-
hasChildren: Boolean((_a = nodeData.children) == null ? void 0 : _a.length),
|
5639
|
-
expand,
|
5640
|
-
setExpand
|
5641
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
5642
|
-
className: styles$8.treeNodeTitle,
|
5643
|
-
onClick: onSelect
|
5644
|
-
}, renderTitle(nodeData)), /* @__PURE__ */ React__default.createElement(IconFont, {
|
5645
|
-
iconName: "icon-drag",
|
5646
|
-
style: { cursor: "grab", fontSize: 12 }
|
5647
|
-
}))), /* @__PURE__ */ React__default.createElement("ul", {
|
5648
|
-
ref: ulRef,
|
5649
|
-
style: { overflow: "hidden" },
|
5650
|
-
className: styles$8.treeNodeList
|
5651
|
-
}, (_b = nodeData.children) == null ? void 0 : _b.map((item2, index22) => {
|
5652
|
-
return /* @__PURE__ */ React__default.createElement(BlockTreeItem, {
|
5653
|
-
key: index22,
|
5654
|
-
index: index22,
|
5655
|
-
onSelect: handleSelect,
|
5656
|
-
onMouseEnter: handleMouseEnter,
|
5657
|
-
onContextMenu: handleContextMenu,
|
5658
|
-
nodeData: item2,
|
5659
|
-
renderTitle,
|
5660
|
-
indent: indent + 1,
|
5661
|
-
defaultExpandAll,
|
5662
|
-
onDragStart,
|
5663
|
-
onDragMove,
|
5664
|
-
onDragEnd,
|
5665
|
-
onSpill
|
5666
|
-
});
|
5667
|
-
})));
|
5668
|
-
}
|
5669
|
-
const getCurrenTreeNode = (ele, rootEle) => {
|
5670
|
-
if (ele.classList.contains(styles$8.treeNode))
|
5671
|
-
return ele;
|
5672
|
-
if (ele.parentElement && rootEle && rootEle.contains(ele.parentElement))
|
5673
|
-
return getCurrenTreeNode(ele.parentElement, rootEle);
|
5674
|
-
return null;
|
5675
|
-
};
|
5676
|
-
function BlockTree(props) {
|
5677
|
-
const [eleRef, setEleRef] = useState(null);
|
5678
|
-
const [selectedId, setSelectedId] = useState(props.selectedId);
|
5679
|
-
const dropDataRef = useRef(null);
|
5680
|
-
const {
|
5681
|
-
treeData,
|
5682
|
-
allowDrop,
|
5683
|
-
onDrop,
|
5684
|
-
onSelect,
|
5685
|
-
onMouseEnter,
|
5686
|
-
onMouseLeave,
|
5687
|
-
onContextMenu
|
5688
|
-
} = props;
|
5689
|
-
const treeDataMap = useMemo(() => {
|
5690
|
-
const map2 = {};
|
5691
|
-
const loop2 = (node) => {
|
5692
|
-
if (map2[node.id]) {
|
5693
|
-
console.warn(`have same id ${node.id}`);
|
5694
|
-
}
|
5695
|
-
map2[node.id] = node;
|
5696
|
-
if (node.children) {
|
5697
|
-
node.children.forEach((item2) => {
|
5698
|
-
loop2(item2);
|
5699
|
-
});
|
5700
|
-
}
|
5701
|
-
};
|
5702
|
-
treeData.forEach((item2) => {
|
5703
|
-
loop2(item2);
|
5704
|
-
});
|
5705
|
-
return map2;
|
5706
|
-
}, [treeData]);
|
5707
|
-
useEffect(() => {
|
5708
|
-
setSelectedId(props.selectedId);
|
5709
|
-
}, [props.selectedId]);
|
5710
|
-
useEffect(() => {
|
5711
|
-
if (!eleRef)
|
5712
|
-
return;
|
5713
|
-
if (selectedId) {
|
5714
|
-
const node = eleRef.querySelector("." + styles$8.treeNodeSelected);
|
5715
|
-
if (node) {
|
5716
|
-
node.classList.remove(styles$8.treeNodeSelected);
|
5717
|
-
}
|
5718
|
-
setTimeout(() => {
|
5719
|
-
const selectedNode = eleRef.querySelector(`[${DATA_ATTRIBUTE_ID}="${selectedId}"]`);
|
5720
|
-
if (selectedNode) {
|
5721
|
-
selectedNode.classList.add(styles$8.treeNodeSelected);
|
5722
|
-
selectedNode.scrollIntoView({
|
5723
|
-
block: "center",
|
5724
|
-
behavior: "smooth"
|
5725
|
-
});
|
5726
|
-
}
|
5727
|
-
}, 50);
|
5728
|
-
}
|
5729
|
-
}, [eleRef, selectedId]);
|
5730
|
-
const onDragStart = useCallback((evt, sortable, store) => {
|
5731
|
-
}, []);
|
5732
|
-
const onDragMove = useCallback((evt, originalEvent) => {
|
5733
|
-
const dragEle = getCurrenTreeNode(evt.dragged);
|
5734
|
-
const dropEle = getCurrenTreeNode(evt.related);
|
5735
|
-
if (dropEle && dragEle) {
|
5736
|
-
const dragId = dragEle.getAttribute(DATA_ATTRIBUTE_ID);
|
5737
|
-
const dragIndex = dragEle.getAttribute(DATA_ATTRIBUTE_INDEX);
|
5738
|
-
const dropId = dropEle.getAttribute(DATA_ATTRIBUTE_ID);
|
5739
|
-
const dropIndex = dropEle.getAttribute(DATA_ATTRIBUTE_INDEX);
|
5740
|
-
const currentDropData = {
|
5741
|
-
dragNode: treeDataMap[dragId],
|
5742
|
-
dragIndex: Number(dragIndex),
|
5743
|
-
dropIndex: Number(dropIndex),
|
5744
|
-
dropNode: treeDataMap[dropId],
|
5745
|
-
willInsertAfter: evt.willInsertAfter,
|
5746
|
-
event: originalEvent
|
5747
|
-
};
|
5748
|
-
const isAllowDrop = allowDrop(currentDropData);
|
5749
|
-
if (isAllowDrop) {
|
5750
|
-
dropEle.classList.add(styles$8.treeNodeDrop);
|
5751
|
-
dropDataRef.current = currentDropData;
|
5752
|
-
return true;
|
5753
|
-
}
|
5754
|
-
}
|
5755
|
-
return false;
|
5756
|
-
}, [allowDrop, treeDataMap]);
|
5757
|
-
const onDragEnd = useCallback((evt) => {
|
5758
|
-
if (dropDataRef.current) {
|
5759
|
-
onDrop(dropDataRef.current);
|
5760
|
-
}
|
5761
|
-
dropDataRef.current = null;
|
5762
|
-
}, [dropDataRef, , onDrop]);
|
5763
|
-
const onSpill = useCallback((evt) => {
|
5764
|
-
dropDataRef.current = null;
|
5765
|
-
}, []);
|
5766
|
-
return useMemo(() => /* @__PURE__ */ React__default.createElement("div", {
|
5767
|
-
ref: setEleRef,
|
5768
|
-
className: styles$8.tree,
|
5769
|
-
onMouseLeave
|
5770
|
-
}, props.treeData.map((item2) => /* @__PURE__ */ React__default.createElement("ul", {
|
5771
|
-
key: item2.id,
|
5772
|
-
className: styles$8.treeNodeList
|
5773
|
-
}, /* @__PURE__ */ React__default.createElement(BlockTreeItem, {
|
5774
|
-
nodeData: item2,
|
5775
|
-
renderTitle: props.renderTitle,
|
5776
|
-
indent: 0,
|
5777
|
-
index: 0,
|
5778
|
-
onSelect,
|
5779
|
-
onMouseEnter,
|
5780
|
-
onContextMenu,
|
5781
|
-
defaultExpandAll: Boolean(props.defaultExpandAll),
|
5782
|
-
onDragStart,
|
5783
|
-
onDragMove,
|
5784
|
-
onDragEnd,
|
5785
|
-
onSpill
|
5786
|
-
})))), [
|
5787
|
-
onContextMenu,
|
5788
|
-
onDragEnd,
|
5789
|
-
onDragMove,
|
5790
|
-
onDragStart,
|
5791
|
-
onMouseEnter,
|
5792
|
-
onMouseLeave,
|
5793
|
-
onSelect,
|
5794
|
-
onSpill,
|
5795
|
-
props.defaultExpandAll,
|
5796
|
-
props.renderTitle,
|
5797
|
-
props.treeData
|
5798
|
-
]);
|
5799
|
-
}
|
5800
|
-
const wrap$1 = "_wrap_aul3a_1";
|
5801
|
-
const listItem = "_listItem_aul3a_13";
|
5802
|
-
const contextmenuMark = "_contextmenuMark_aul3a_23";
|
5803
|
-
var styles$7 = {
|
5804
|
-
wrap: wrap$1,
|
5805
|
-
listItem,
|
5806
|
-
contextmenuMark
|
5807
|
-
};
|
5808
5500
|
function _extends$f() {
|
5809
5501
|
_extends$f = Object.assign || function(target2) {
|
5810
5502
|
for (var i2 = 1; i2 < arguments.length; i2++) {
|
@@ -21735,7 +21427,7 @@ var __assign$y = globalThis && globalThis.__assign || function() {
|
|
21735
21427
|
};
|
21736
21428
|
return __assign$y.apply(this, arguments);
|
21737
21429
|
};
|
21738
|
-
function wrapper
|
21430
|
+
function wrapper(picker, displayName) {
|
21739
21431
|
var _a;
|
21740
21432
|
return _a = function(_super) {
|
21741
21433
|
__extends$5(PickerWrapper, _super);
|
@@ -21748,11 +21440,11 @@ function wrapper$1(picker, displayName) {
|
|
21748
21440
|
return PickerWrapper;
|
21749
21441
|
}(React__default.Component), _a.displayName = displayName, _a;
|
21750
21442
|
}
|
21751
|
-
var DatePicker = wrapper
|
21752
|
-
var MonthPicker = wrapper
|
21753
|
-
var YearPicker = wrapper
|
21754
|
-
var WeekPicker = wrapper
|
21755
|
-
var QuarterPicker = wrapper
|
21443
|
+
var DatePicker = wrapper(React__default.createElement(DatePicker$2, null), "DatePicker");
|
21444
|
+
var MonthPicker = wrapper(React__default.createElement(MonthPicker$1, null), "MonthPicker");
|
21445
|
+
var YearPicker = wrapper(React__default.createElement(YearPicker$1, null), "YearPicker");
|
21446
|
+
var WeekPicker = wrapper(React__default.createElement(WeekPicker$1, null), "WeekPicker");
|
21447
|
+
var QuarterPicker = wrapper(React__default.createElement(QuarterPicker$1, null), "QuarterPicker");
|
21756
21448
|
var RangePicker = PickerRange;
|
21757
21449
|
Object.assign(DatePicker, { MonthPicker, YearPicker, WeekPicker, QuarterPicker, RangePicker });
|
21758
21450
|
var DatePicker$1 = DatePicker;
|
@@ -27893,7 +27585,7 @@ var __rest$2 = globalThis && globalThis.__rest || function(s, e) {
|
|
27893
27585
|
}
|
27894
27586
|
return t;
|
27895
27587
|
};
|
27896
|
-
function TabPane$
|
27588
|
+
function TabPane$1(props, ref) {
|
27897
27589
|
var shouldRender = useRef(false);
|
27898
27590
|
var getPrefixCls = useContext(ConfigContext).getPrefixCls;
|
27899
27591
|
var children = props.children, className = props.className, style = props.style, lazyload = props.lazyload, isActive = props.isActive, rest = __rest$2(props, ["children", "className", "style", "lazyload", "isActive"]);
|
@@ -27901,10 +27593,10 @@ function TabPane$2(props, ref) {
|
|
27901
27593
|
shouldRender.current = lazyload ? shouldRender.current || isActive : true;
|
27902
27594
|
return shouldRender.current && React__default.createElement("div", __assign$b({ ref }, omit$1(rest, ["destroyOnHide", "title", "closable"]), { className: cs(prefixCls2 + "-pane", className), style }), children);
|
27903
27595
|
}
|
27904
|
-
var TabPaneRef = React__default.forwardRef(TabPane$
|
27596
|
+
var TabPaneRef = React__default.forwardRef(TabPane$1);
|
27905
27597
|
TabPaneRef.displayName = "TabPane";
|
27906
27598
|
TabPaneRef.isTabPane = true;
|
27907
|
-
var TabPane$
|
27599
|
+
var TabPane$2 = TabPaneRef;
|
27908
27600
|
function DropdownIcon(props) {
|
27909
27601
|
var prefixCls2 = props.prefixCls, currentOffset = props.currentOffset, headerSize = props.headerSize, headerWrapperSize = props.headerWrapperSize, getTitleRef = props.getTitleRef, paneChildren = props.paneChildren, direction = props.direction;
|
27910
27602
|
var paneKeys = paneChildren.map(function(child) {
|
@@ -28609,7 +28301,7 @@ function Tabs(baseProps, ref) {
|
|
28609
28301
|
var ForwardRefTabs = React__default.forwardRef(Tabs);
|
28610
28302
|
var TabsComponent = ForwardRefTabs;
|
28611
28303
|
TabsComponent.displayName = "Tabs";
|
28612
|
-
TabsComponent.TabPane = TabPane$
|
28304
|
+
TabsComponent.TabPane = TabPane$2;
|
28613
28305
|
var Tabs$1 = TabsComponent;
|
28614
28306
|
function ownKeys$3(object, enumerableOnly) {
|
28615
28307
|
var keys2 = Object.keys(object);
|
@@ -30501,10 +30193,10 @@ function TreeList(props, ref) {
|
|
30501
30193
|
treeRef.current.handleCheck && treeRef.current.handleCheck(!checked, node.props._key, e);
|
30502
30194
|
}
|
30503
30195
|
}, []);
|
30504
|
-
var handleLoadMore = useCallback(function(
|
30196
|
+
var handleLoadMore = useCallback(function(treeNode) {
|
30505
30197
|
if (isFunction$5(loadMore)) {
|
30506
|
-
var dataRef =
|
30507
|
-
return loadMore(
|
30198
|
+
var dataRef = treeNode.props.dataRef;
|
30199
|
+
return loadMore(treeNode, dataRef);
|
30508
30200
|
}
|
30509
30201
|
return [];
|
30510
30202
|
}, [loadMore]);
|
@@ -30942,6 +30634,171 @@ IconUpload.defaultProps = {
|
|
30942
30634
|
};
|
30943
30635
|
IconUpload.displayName = "IconUpload";
|
30944
30636
|
var IconUpload$1 = IconUpload;
|
30637
|
+
const transparentImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";
|
30638
|
+
const img = new Image();
|
30639
|
+
img.width = 0;
|
30640
|
+
img.height = 0;
|
30641
|
+
img.src = transparentImage;
|
30642
|
+
const fileNames = {
|
30643
|
+
key: "id"
|
30644
|
+
};
|
30645
|
+
function BlockTree(props) {
|
30646
|
+
const [blockTreeRef, setBlockTreeRef] = useState(null);
|
30647
|
+
const dragNode = useRef(null);
|
30648
|
+
const { treeData, allowDrop, onContextMenu, selectedKeys } = props;
|
30649
|
+
const treeDataRef = useRef(treeData);
|
30650
|
+
const [expandedKeys, setExpandedKeys] = useState([]);
|
30651
|
+
const onExpand = useCallback((keys2) => {
|
30652
|
+
setExpandedKeys(keys2);
|
30653
|
+
}, [setExpandedKeys]);
|
30654
|
+
useEffect(() => {
|
30655
|
+
if (props.defaultExpandAll) {
|
30656
|
+
const keys2 = [];
|
30657
|
+
const loop2 = (data) => {
|
30658
|
+
var _a;
|
30659
|
+
keys2.push(data.id);
|
30660
|
+
(_a = data.children) == null ? void 0 : _a.forEach(loop2);
|
30661
|
+
};
|
30662
|
+
treeDataRef.current.forEach(loop2);
|
30663
|
+
setExpandedKeys(keys2);
|
30664
|
+
}
|
30665
|
+
}, [props.defaultExpandAll]);
|
30666
|
+
useEffect(() => {
|
30667
|
+
setExpandedKeys((keys2) => props.expandedKeys ? [...keys2, ...props.expandedKeys] : keys2);
|
30668
|
+
}, [props.expandedKeys]);
|
30669
|
+
const onDragStart = useCallback((e, node) => {
|
30670
|
+
var _a;
|
30671
|
+
e.dataTransfer.dropEffect = "none";
|
30672
|
+
const dragNodeData = node.props.dataRef;
|
30673
|
+
dragNode.current = {
|
30674
|
+
dataRef: dragNodeData,
|
30675
|
+
parent: node.props.parent,
|
30676
|
+
key: node.props._key,
|
30677
|
+
parentKey: node.props.parentKey
|
30678
|
+
};
|
30679
|
+
(_a = props.onDragStart) == null ? void 0 : _a.call(props);
|
30680
|
+
}, [props.onDragStart]);
|
30681
|
+
const onDragMove = useCallback((option) => {
|
30682
|
+
if (!dragNode.current)
|
30683
|
+
return false;
|
30684
|
+
const dropData = option.dropNode.props.dataRef;
|
30685
|
+
const dropId = option.dropNode.props._key;
|
30686
|
+
const currentDropData = {
|
30687
|
+
dragNode: { key: dragNode.current.key },
|
30688
|
+
dropNode: {
|
30689
|
+
dataRef: dropData,
|
30690
|
+
parent: option.dropNode.props.parent,
|
30691
|
+
key: dropId
|
30692
|
+
},
|
30693
|
+
dropPosition: option.dropPosition
|
30694
|
+
};
|
30695
|
+
const isAllowDrop = allowDrop(currentDropData);
|
30696
|
+
if (isAllowDrop) {
|
30697
|
+
return true;
|
30698
|
+
}
|
30699
|
+
return false;
|
30700
|
+
}, [dragNode]);
|
30701
|
+
const onDrop = useCallback((info2) => {
|
30702
|
+
const { dropNode, dropPosition, e } = info2;
|
30703
|
+
e.dataTransfer.dropEffect = "move";
|
30704
|
+
if (!dragNode.current || !dropNode)
|
30705
|
+
return;
|
30706
|
+
const dropData = dropNode.props.dataRef;
|
30707
|
+
const currentDropData = {
|
30708
|
+
dragNode: dragNode.current,
|
30709
|
+
dropNode: {
|
30710
|
+
dataRef: dropData,
|
30711
|
+
parent: dropNode.props.parent,
|
30712
|
+
key: dropNode.props._key,
|
30713
|
+
parentKey: dropNode.props.parentKey
|
30714
|
+
},
|
30715
|
+
dropPosition
|
30716
|
+
};
|
30717
|
+
props.onDrop(currentDropData);
|
30718
|
+
}, []);
|
30719
|
+
const renderTitle = useCallback((nodeData) => {
|
30720
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
30721
|
+
style: { display: "inline-flex", width: "100%" },
|
30722
|
+
onContextMenu: (ev) => onContextMenu && onContextMenu(nodeData, ev)
|
30723
|
+
}, props.renderTitle(nodeData));
|
30724
|
+
}, [onContextMenu]);
|
30725
|
+
const onDragEnd = useCallback(() => {
|
30726
|
+
var _a;
|
30727
|
+
dragNode.current = null;
|
30728
|
+
(_a = props.onDragEnd) == null ? void 0 : _a.call(props);
|
30729
|
+
}, [props.onDragEnd]);
|
30730
|
+
const onSelect = useCallback((selectedKeys2) => {
|
30731
|
+
props.onSelect(selectedKeys2[0]);
|
30732
|
+
}, [props.onSelect]);
|
30733
|
+
useEffect(() => {
|
30734
|
+
if (blockTreeRef) {
|
30735
|
+
blockTreeRef.addEventListener("dragover", (e) => {
|
30736
|
+
if (e.dataTransfer) {
|
30737
|
+
e.dataTransfer.dropEffect = "move";
|
30738
|
+
}
|
30739
|
+
});
|
30740
|
+
}
|
30741
|
+
}, [blockTreeRef]);
|
30742
|
+
return useMemo(() => /* @__PURE__ */ React__default.createElement("div", {
|
30743
|
+
ref: setBlockTreeRef,
|
30744
|
+
onMouseLeave: props.onMouseLeave
|
30745
|
+
}, /* @__PURE__ */ React__default.createElement(CacheTree, {
|
30746
|
+
selectedKeys,
|
30747
|
+
expandedKeys,
|
30748
|
+
onExpand,
|
30749
|
+
draggable: true,
|
30750
|
+
size: "small",
|
30751
|
+
treeData,
|
30752
|
+
blockNode: true,
|
30753
|
+
fieldNames: fileNames,
|
30754
|
+
onDragEnd,
|
30755
|
+
onDragStart,
|
30756
|
+
onDrop,
|
30757
|
+
allowDrop: onDragMove,
|
30758
|
+
onSelect,
|
30759
|
+
renderTitle
|
30760
|
+
})), [
|
30761
|
+
treeData,
|
30762
|
+
props.onMouseLeave,
|
30763
|
+
expandedKeys,
|
30764
|
+
selectedKeys,
|
30765
|
+
onExpand,
|
30766
|
+
onDragEnd,
|
30767
|
+
onDragStart,
|
30768
|
+
onDrop,
|
30769
|
+
onDragMove,
|
30770
|
+
onSelect,
|
30771
|
+
renderTitle
|
30772
|
+
]);
|
30773
|
+
}
|
30774
|
+
const cacheTreeDebounceCallback = lodash.exports.debounce((data, setCacheProps) => {
|
30775
|
+
setCacheProps(data);
|
30776
|
+
}, 300);
|
30777
|
+
function CacheTree(props) {
|
30778
|
+
const [cacheProps, setCacheProps] = useState(props);
|
30779
|
+
const lastProps = useRef(props);
|
30780
|
+
useEffect(() => {
|
30781
|
+
if (lastProps.current.treeData !== props.treeData) {
|
30782
|
+
lastProps.current = props;
|
30783
|
+
cacheTreeDebounceCallback(props, setCacheProps);
|
30784
|
+
return () => {
|
30785
|
+
cacheTreeDebounceCallback.cancel();
|
30786
|
+
};
|
30787
|
+
} else {
|
30788
|
+
lastProps.current = props;
|
30789
|
+
setCacheProps(props);
|
30790
|
+
}
|
30791
|
+
}, [props]);
|
30792
|
+
return useMemo(() => /* @__PURE__ */ React__default.createElement(Tree$1, __spreadValues({}, cacheProps)), [cacheProps]);
|
30793
|
+
}
|
30794
|
+
const wrap$1 = "_wrap_aul3a_1";
|
30795
|
+
const listItem = "_listItem_aul3a_13";
|
30796
|
+
const contextmenuMark = "_contextmenuMark_aul3a_23";
|
30797
|
+
var styles$5 = {
|
30798
|
+
wrap: wrap$1,
|
30799
|
+
listItem,
|
30800
|
+
contextmenuMark
|
30801
|
+
};
|
30945
30802
|
var rngBrowser = { exports: {} };
|
30946
30803
|
var getRandomValues = typeof crypto != "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != "undefined" && typeof window.msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto);
|
30947
30804
|
if (getRandomValues) {
|
@@ -31150,7 +31007,7 @@ const btnWrap = "_btn-wrap_jzksr_43";
|
|
31150
31007
|
const upload = "_upload_jzksr_68";
|
31151
31008
|
const wrap = "_wrap_jzksr_80";
|
31152
31009
|
const urlInput = "_urlInput_jzksr_80";
|
31153
|
-
var styles$
|
31010
|
+
var styles$4 = {
|
31154
31011
|
container: container$1,
|
31155
31012
|
error,
|
31156
31013
|
item,
|
@@ -31312,16 +31169,16 @@ class Uploader {
|
|
31312
31169
|
this.handler[event2] = handles.filter((item2) => item2 !== fn);
|
31313
31170
|
}
|
31314
31171
|
}
|
31315
|
-
function classnames(...rest) {
|
31172
|
+
function classnames$1(...rest) {
|
31316
31173
|
return rest.filter((item2) => typeof item2 === "string").join(" ");
|
31317
31174
|
}
|
31318
31175
|
function previewLoadImage(url) {
|
31319
31176
|
return new Promise((resolve) => {
|
31320
|
-
const
|
31321
|
-
|
31322
|
-
|
31323
|
-
|
31324
|
-
|
31177
|
+
const img2 = new Image();
|
31178
|
+
img2.setAttribute("crossOrigin", "Anonymous");
|
31179
|
+
img2.src = url;
|
31180
|
+
img2.onload = () => resolve(img2);
|
31181
|
+
img2.onerror = () => resolve(img2);
|
31325
31182
|
});
|
31326
31183
|
}
|
31327
31184
|
const defaultImagesMap$1 = {
|
@@ -31392,30 +31249,30 @@ function ImageUploader(props) {
|
|
31392
31249
|
const content = useMemo(() => {
|
31393
31250
|
if (isUploading) {
|
31394
31251
|
return /* @__PURE__ */ React__default.createElement("div", {
|
31395
|
-
className: styles$
|
31252
|
+
className: styles$4["item"]
|
31396
31253
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
31397
|
-
className: classnames(styles$
|
31254
|
+
className: classnames$1(styles$4["info"])
|
31398
31255
|
}, /* @__PURE__ */ React__default.createElement("img", {
|
31399
31256
|
src: getImg$1("AttributePanel_03"),
|
31400
31257
|
alt: "Loading..."
|
31401
31258
|
}), /* @__PURE__ */ React__default.createElement("div", {
|
31402
|
-
className: styles$
|
31259
|
+
className: styles$4["btn-wrap"]
|
31403
31260
|
})));
|
31404
31261
|
}
|
31405
31262
|
if (!props.value) {
|
31406
31263
|
return /* @__PURE__ */ React__default.createElement("div", {
|
31407
|
-
className: styles$
|
31264
|
+
className: styles$4["upload"],
|
31408
31265
|
onClick: onUpload
|
31409
31266
|
}, /* @__PURE__ */ React__default.createElement(IconPlus$1, null), /* @__PURE__ */ React__default.createElement("div", null, "Upload"));
|
31410
31267
|
}
|
31411
31268
|
return /* @__PURE__ */ React__default.createElement("div", {
|
31412
|
-
className: styles$
|
31269
|
+
className: styles$4["item"]
|
31413
31270
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
31414
|
-
className: classnames(styles$
|
31271
|
+
className: classnames$1(styles$4["info"])
|
31415
31272
|
}, /* @__PURE__ */ React__default.createElement("img", {
|
31416
31273
|
src: props.value
|
31417
31274
|
}), /* @__PURE__ */ React__default.createElement("div", {
|
31418
|
-
className: styles$
|
31275
|
+
className: styles$4["btn-wrap"]
|
31419
31276
|
}, /* @__PURE__ */ React__default.createElement("a", {
|
31420
31277
|
title: "Preview",
|
31421
31278
|
onClick: () => setPreview(true)
|
@@ -31431,9 +31288,9 @@ function ImageUploader(props) {
|
|
31431
31288
|
});
|
31432
31289
|
}
|
31433
31290
|
return /* @__PURE__ */ React__default.createElement("div", {
|
31434
|
-
className: styles$
|
31291
|
+
className: styles$4.wrap
|
31435
31292
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
31436
|
-
className: styles$
|
31293
|
+
className: styles$4["container"]
|
31437
31294
|
}, content, /* @__PURE__ */ React__default.createElement(Input$5, {
|
31438
31295
|
onPaste,
|
31439
31296
|
value: props.value,
|
@@ -38385,7 +38242,7 @@ function ColorPicker(props) {
|
|
38385
38242
|
height: 32,
|
38386
38243
|
width: 32,
|
38387
38244
|
padding: 4,
|
38388
|
-
border: "1px solid
|
38245
|
+
border: "1px solid var(--color-neutral-3, rgb(229, 230, 235))",
|
38389
38246
|
borderRadius: showInput ? void 0 : 4,
|
38390
38247
|
fontSize: 0,
|
38391
38248
|
borderRight: showInput ? "none" : void 0,
|
@@ -38396,7 +38253,7 @@ function ColorPicker(props) {
|
|
38396
38253
|
style: {
|
38397
38254
|
position: "relative",
|
38398
38255
|
display: "block",
|
38399
|
-
border: "1px solid
|
38256
|
+
border: "1px solid var(--color-neutral-3, rgb(229, 230, 235))",
|
38400
38257
|
borderRadius: 2,
|
38401
38258
|
width: "100%",
|
38402
38259
|
height: "100%",
|
@@ -38443,7 +38300,7 @@ function RadioGroup(props) {
|
|
38443
38300
|
const helperText = "_helperText_cmm2s_1";
|
38444
38301
|
const labelHidden = "_label-hidden_cmm2s_9";
|
38445
38302
|
const editTab = "_editTab_cmm2s_20";
|
38446
|
-
var styles$
|
38303
|
+
var styles$3 = {
|
38447
38304
|
helperText,
|
38448
38305
|
"label-hidden": "_label-hidden_cmm2s_9",
|
38449
38306
|
labelHidden,
|
@@ -38532,7 +38389,7 @@ function enhancer(Component2, changeAdapter) {
|
|
38532
38389
|
alignment: alignment ? alignment : inline ? "center" : void 0,
|
38533
38390
|
distribution
|
38534
38391
|
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, null, /* @__PURE__ */ React__default.createElement("label", {
|
38535
|
-
className: labelHidden2 ? styles$
|
38392
|
+
className: labelHidden2 ? styles$3["label-hidden"] : void 0,
|
38536
38393
|
htmlFor: id
|
38537
38394
|
}, /* @__PURE__ */ React__default.createElement("span", {
|
38538
38395
|
style: { whiteSpace: "pre" }
|
@@ -38551,7 +38408,7 @@ function enhancer(Component2, changeAdapter) {
|
|
38551
38408
|
value: valueAdapter ? valueAdapter(currentValue) : currentValue,
|
38552
38409
|
onChange: onFieldChange
|
38553
38410
|
})))), /* @__PURE__ */ React__default.createElement("div", {
|
38554
|
-
className: styles$
|
38411
|
+
className: styles$3.helperText
|
38555
38412
|
}, /* @__PURE__ */ React__default.createElement("small", null, helpText))));
|
38556
38413
|
});
|
38557
38414
|
};
|
@@ -38603,7 +38460,10 @@ function CheckBoxGroup(props) {
|
|
38603
38460
|
value: item2.value
|
38604
38461
|
}, item2.label))));
|
38605
38462
|
}
|
38606
|
-
|
38463
|
+
function classnames(...rest) {
|
38464
|
+
return rest.filter((item2) => typeof item2 === "string").join(" ");
|
38465
|
+
}
|
38466
|
+
const { TabPane } = Tabs$1;
|
38607
38467
|
function EditTab(props) {
|
38608
38468
|
const { value, additionItem } = props;
|
38609
38469
|
const onAddTab = () => {
|
@@ -38613,14 +38473,14 @@ function EditTab(props) {
|
|
38613
38473
|
props.onChange(value.filter((_, vIndex) => Number(index2) !== vIndex));
|
38614
38474
|
};
|
38615
38475
|
return /* @__PURE__ */ React__default.createElement(Tabs$1, {
|
38616
|
-
className: classnames
|
38476
|
+
className: classnames(styles$3.editTab),
|
38617
38477
|
style: { border: "none" },
|
38618
38478
|
type: "card",
|
38619
38479
|
tabPosition: props.tabPosition,
|
38620
38480
|
editable: true,
|
38621
38481
|
onAddTab,
|
38622
38482
|
onDeleteTab
|
38623
|
-
}, (Array.isArray(value) ? value : []).map((item2, index2) => /* @__PURE__ */ React__default.createElement(TabPane
|
38483
|
+
}, (Array.isArray(value) ? value : []).map((item2, index2) => /* @__PURE__ */ React__default.createElement(TabPane, {
|
38624
38484
|
style: { paddingLeft: 12 },
|
38625
38485
|
title: `${props.label || "Tab"} ${index2 + 1}`,
|
38626
38486
|
key: index2
|
@@ -38905,26 +38765,220 @@ function FontFamily$1(props) {
|
|
38905
38765
|
key: item2.value
|
38906
38766
|
}, item2.label))));
|
38907
38767
|
}
|
38908
|
-
|
38909
|
-
|
38768
|
+
var styleText$1 = ".easy-email-extensions-Tools-Popover .arco-popover-content{padding:0}.easy-email-extensions-Tools-Popover .arco-popover-content-inner *::-webkit-scrollbar{-webkit-appearance:none;width:5px}.easy-email-extensions-Tools-Popover .arco-popover-content-inner *::-webkit-scrollbar-thumb{border-radius:5px;background-color:#00000080;box-shadow:0 0 1px #ffffff80;-webkit-box-shadow:0 0 1px rgba(255,255,255,.5)}\n";
|
38769
|
+
function Help(props) {
|
38770
|
+
return /* @__PURE__ */ React__default.createElement(Tooltip$1, __spreadProps(__spreadValues({}, __spreadProps(__spreadValues({}, props), { style: void 0 })), {
|
38771
|
+
content: props.title
|
38772
|
+
}), /* @__PURE__ */ React__default.createElement("span", {
|
38773
|
+
style: { cursor: "pointer" }
|
38774
|
+
}, /* @__PURE__ */ React__default.createElement(IconQuestionCircle$1, {
|
38775
|
+
style: props.style
|
38776
|
+
})));
|
38777
|
+
}
|
38778
|
+
var ARRAY_ERROR = "FINAL_FORM/array-error";
|
38779
|
+
var fieldSubscriptionItems = ["active", "data", "dirty", "dirtySinceLastSubmit", "error", "initial", "invalid", "length", "modified", "modifiedSinceLastSubmit", "pristine", "submitError", "submitFailed", "submitSucceeded", "submitting", "touched", "valid", "value", "visited", "validating"];
|
38780
|
+
var version$1 = "4.20.4";
|
38781
|
+
function renderComponent(props, name) {
|
38782
|
+
var render3 = props.render, children = props.children, component = props.component, rest = _objectWithoutPropertiesLoose(props, ["render", "children", "component"]);
|
38783
|
+
if (component) {
|
38784
|
+
return /* @__PURE__ */ createElement(component, _extends$f({}, rest, {
|
38785
|
+
children,
|
38786
|
+
render: render3
|
38787
|
+
}));
|
38788
|
+
}
|
38789
|
+
if (render3) {
|
38790
|
+
return render3(children === void 0 ? rest : _extends$f({}, rest, {
|
38791
|
+
children
|
38792
|
+
}));
|
38793
|
+
}
|
38794
|
+
if (typeof children !== "function") {
|
38795
|
+
throw new Error("Must specify either a render prop, a render function as children, or a component prop to " + name);
|
38796
|
+
}
|
38797
|
+
return children(rest);
|
38798
|
+
}
|
38799
|
+
var defaultIsEqual = function defaultIsEqual2(aArray, bArray) {
|
38800
|
+
return aArray === bArray || Array.isArray(aArray) && Array.isArray(bArray) && aArray.length === bArray.length && !aArray.some(function(a, index2) {
|
38801
|
+
return a !== bArray[index2];
|
38802
|
+
});
|
38803
|
+
};
|
38804
|
+
function useConstant(init) {
|
38805
|
+
var ref = React__default.useRef();
|
38806
|
+
if (!ref.current) {
|
38807
|
+
ref.current = init();
|
38808
|
+
}
|
38809
|
+
return ref.current;
|
38810
|
+
}
|
38811
|
+
var all = fieldSubscriptionItems.reduce(function(result, key) {
|
38812
|
+
result[key] = true;
|
38813
|
+
return result;
|
38814
|
+
}, {});
|
38815
|
+
var useFieldArray = function useFieldArray2(name, _temp) {
|
38816
|
+
var _ref2 = _temp === void 0 ? {} : _temp, _ref$subscription = _ref2.subscription, subscription = _ref$subscription === void 0 ? all : _ref$subscription, defaultValue = _ref2.defaultValue, initialValue = _ref2.initialValue, _ref$isEqual = _ref2.isEqual, isEqual2 = _ref$isEqual === void 0 ? defaultIsEqual : _ref$isEqual, validateProp = _ref2.validate;
|
38817
|
+
var form = useForm$1("useFieldArray");
|
38818
|
+
var formMutators = form.mutators;
|
38819
|
+
var hasMutators = !!(formMutators && formMutators.push && formMutators.pop);
|
38820
|
+
if (!hasMutators) {
|
38821
|
+
throw new Error("Array mutators not found. You need to provide the mutators from final-form-arrays to your form");
|
38822
|
+
}
|
38823
|
+
var mutators = useConstant(function() {
|
38824
|
+
return Object.keys(formMutators).reduce(function(result, key) {
|
38825
|
+
result[key] = function() {
|
38826
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
38827
|
+
args[_key] = arguments[_key];
|
38828
|
+
}
|
38829
|
+
return formMutators[key].apply(formMutators, [name].concat(args));
|
38830
|
+
};
|
38831
|
+
return result;
|
38832
|
+
}, {});
|
38833
|
+
});
|
38834
|
+
var validate3 = useConstant(function() {
|
38835
|
+
return function(value, allValues, meta2) {
|
38836
|
+
if (!validateProp)
|
38837
|
+
return void 0;
|
38838
|
+
var error2 = validateProp(value, allValues, meta2);
|
38839
|
+
if (!error2 || Array.isArray(error2)) {
|
38840
|
+
return error2;
|
38841
|
+
} else {
|
38842
|
+
var arrayError = [];
|
38843
|
+
arrayError[ARRAY_ERROR] = error2;
|
38844
|
+
return arrayError;
|
38845
|
+
}
|
38846
|
+
};
|
38847
|
+
});
|
38848
|
+
var _useField = useField(name, {
|
38849
|
+
subscription: _extends$f({}, subscription, {
|
38850
|
+
length: true
|
38851
|
+
}),
|
38852
|
+
defaultValue,
|
38853
|
+
initialValue,
|
38854
|
+
isEqual: isEqual2,
|
38855
|
+
validate: validate3,
|
38856
|
+
format: function format(v) {
|
38857
|
+
return v;
|
38858
|
+
}
|
38859
|
+
}), _useField$meta = _useField.meta, length = _useField$meta.length, meta = _objectWithoutPropertiesLoose(_useField$meta, ["length"]), input = _useField.input, fieldState = _objectWithoutPropertiesLoose(_useField, ["meta", "input"]);
|
38860
|
+
var forEach2 = function forEach3(iterator) {
|
38861
|
+
var len = length || 0;
|
38862
|
+
for (var i2 = 0; i2 < len; i2++) {
|
38863
|
+
iterator(name + "[" + i2 + "]", i2);
|
38864
|
+
}
|
38865
|
+
};
|
38866
|
+
var map2 = function map3(iterator) {
|
38867
|
+
var len = length || 0;
|
38868
|
+
var results = [];
|
38869
|
+
for (var i2 = 0; i2 < len; i2++) {
|
38870
|
+
results.push(iterator(name + "[" + i2 + "]", i2));
|
38871
|
+
}
|
38872
|
+
return results;
|
38873
|
+
};
|
38874
|
+
return {
|
38875
|
+
fields: _extends$f({
|
38876
|
+
name,
|
38877
|
+
forEach: forEach2,
|
38878
|
+
length: length || 0,
|
38879
|
+
map: map2
|
38880
|
+
}, mutators, fieldState, {
|
38881
|
+
value: input.value
|
38882
|
+
}),
|
38883
|
+
meta
|
38884
|
+
};
|
38885
|
+
};
|
38886
|
+
var version = "3.1.2";
|
38887
|
+
var versions = {
|
38888
|
+
"final-form": version$1,
|
38889
|
+
"react-final-form": version$2,
|
38890
|
+
"react-final-form-arrays": version
|
38891
|
+
};
|
38892
|
+
var FieldArray = function FieldArray2(_ref2) {
|
38893
|
+
var name = _ref2.name, subscription = _ref2.subscription, defaultValue = _ref2.defaultValue, initialValue = _ref2.initialValue, isEqual2 = _ref2.isEqual, validate3 = _ref2.validate, rest = _objectWithoutPropertiesLoose(_ref2, ["name", "subscription", "defaultValue", "initialValue", "isEqual", "validate"]);
|
38894
|
+
var _useFieldArray = useFieldArray(name, {
|
38895
|
+
subscription,
|
38896
|
+
defaultValue,
|
38897
|
+
initialValue,
|
38898
|
+
isEqual: isEqual2,
|
38899
|
+
validate: validate3
|
38900
|
+
}), fields = _useFieldArray.fields, meta = _useFieldArray.meta;
|
38901
|
+
return renderComponent(_extends$f({
|
38902
|
+
fields,
|
38903
|
+
meta: _extends$f({}, meta, {
|
38904
|
+
__versions: versions
|
38905
|
+
})
|
38906
|
+
}, rest), "FieldArray(" + name + ")");
|
38907
|
+
};
|
38908
|
+
function AddFont() {
|
38909
|
+
const { focusBlock: focusBlock2 } = useBlock();
|
38910
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
38911
|
+
const value = focusBlock2 == null ? void 0 : focusBlock2.data.value;
|
38912
|
+
return /* @__PURE__ */ React__default.createElement(FieldArray, {
|
38913
|
+
name: `${focusIdx2}.data.value.fonts`,
|
38914
|
+
render: (arrayHelpers) => {
|
38915
|
+
var _a;
|
38916
|
+
return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38917
|
+
vertical: true,
|
38918
|
+
spacing: "tight"
|
38919
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38920
|
+
distribution: "equalSpacing"
|
38921
|
+
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
38922
|
+
variation: "strong"
|
38923
|
+
}, "Import font ", /* @__PURE__ */ React__default.createElement(Help, {
|
38924
|
+
title: "Points to a hosted css file"
|
38925
|
+
})), /* @__PURE__ */ React__default.createElement(Stack$6, null, /* @__PURE__ */ React__default.createElement(Button$4, {
|
38926
|
+
size: "small",
|
38927
|
+
icon: /* @__PURE__ */ React__default.createElement(IconPlus$1, null),
|
38928
|
+
onClick: () => arrayHelpers.fields.push({ name: "", href: "" })
|
38929
|
+
}))), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38930
|
+
vertical: true,
|
38931
|
+
spacing: "extraTight"
|
38932
|
+
}, (_a = value.fonts) == null ? void 0 : _a.map((item2, index2) => {
|
38933
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
38934
|
+
key: index2
|
38935
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38936
|
+
alignment: "center",
|
38937
|
+
wrap: false
|
38938
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
38939
|
+
fill: true
|
38940
|
+
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
38941
|
+
inline: true,
|
38942
|
+
name: `${focusIdx2}.data.value.fonts.${index2}.name`,
|
38943
|
+
label: "Name"
|
38944
|
+
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
38945
|
+
fill: true
|
38946
|
+
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
38947
|
+
inline: true,
|
38948
|
+
name: `${focusIdx2}.data.value.fonts.${index2}.href`,
|
38949
|
+
label: "Href"
|
38950
|
+
})), /* @__PURE__ */ React__default.createElement(Button$4, {
|
38951
|
+
icon: /* @__PURE__ */ React__default.createElement(IconDelete$1, null),
|
38952
|
+
onClick: () => arrayHelpers.fields.remove(index2)
|
38953
|
+
})));
|
38954
|
+
}))));
|
38955
|
+
}
|
38956
|
+
});
|
38957
|
+
}
|
38958
|
+
const MergeTags = React__default.memo((props) => {
|
38959
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
38960
|
+
const { mergeTags: mergeTags2 = {}, mergeTagGenerate } = useEditorProps();
|
38961
|
+
const { values: values2 } = useBlock();
|
38962
|
+
const contextMergeTags = useMemo(() => getContextMergeTags(mergeTags2, values2, focusIdx2), [mergeTags2, values2, focusIdx2]);
|
38910
38963
|
const treeOptions = useMemo(() => {
|
38911
38964
|
const treeData = [];
|
38912
38965
|
const deep = (key, title2, parent2, mapData = []) => {
|
38913
38966
|
const currentMapData = {
|
38914
|
-
key:
|
38915
|
-
value:
|
38967
|
+
key: mergeTagGenerate(key),
|
38968
|
+
value: mergeTagGenerate(key),
|
38916
38969
|
title: title2,
|
38970
|
+
disabled: lodash.exports.isObject(parent2[key]) || !parent2[title2],
|
38917
38971
|
children: []
|
38918
38972
|
};
|
38919
38973
|
mapData.push(currentMapData);
|
38920
|
-
const current = parent2[
|
38921
|
-
if (
|
38974
|
+
const current = parent2[title2];
|
38975
|
+
if (current && typeof current === "object") {
|
38922
38976
|
Object.keys(current).map((childKey) => deep(key + "." + childKey, childKey, current, currentMapData.children));
|
38923
38977
|
}
|
38924
38978
|
};
|
38925
|
-
Object.keys(
|
38979
|
+
Object.keys(contextMergeTags).map((key) => deep(key, key, contextMergeTags, treeData));
|
38926
38980
|
return treeData;
|
38927
|
-
}, [
|
38981
|
+
}, [contextMergeTags]);
|
38928
38982
|
const onSelect = useCallback((value) => {
|
38929
38983
|
return props.onChange(value);
|
38930
38984
|
}, [props]);
|
@@ -38933,911 +38987,34 @@ const MergeTags$1 = React__default.memo((props) => {
|
|
38933
38987
|
}, props.isSelect ? /* @__PURE__ */ React__default.createElement(TreeSelect$1, {
|
38934
38988
|
value: props.value,
|
38935
38989
|
size: "small",
|
38936
|
-
style: { width: 120 },
|
38937
38990
|
dropdownMenuStyle: { maxHeight: 400, overflow: "auto" },
|
38938
38991
|
placeholder: "Please select",
|
38939
38992
|
treeData: treeOptions,
|
38940
|
-
onChange: onSelect
|
38993
|
+
onChange: (val) => onSelect(val)
|
38941
38994
|
}) : /* @__PURE__ */ React__default.createElement(Tree$1, {
|
38942
|
-
|
38995
|
+
defaultExpandedKeys: [],
|
38943
38996
|
selectedKeys: [],
|
38944
38997
|
treeData: treeOptions,
|
38945
38998
|
onSelect: (vals) => onSelect(vals[0])
|
38946
38999
|
}));
|
38947
39000
|
});
|
38948
|
-
|
38949
|
-
|
38950
|
-
const {
|
38951
|
-
const
|
38952
|
-
const
|
38953
|
-
|
38954
|
-
const onSelectionChange = () => {
|
38955
|
-
try {
|
38956
|
-
const range2 = getShadowRoot().getSelection().getRangeAt(0);
|
38957
|
-
if (range2) {
|
38958
|
-
setSelectionRange(range2);
|
38959
|
-
}
|
38960
|
-
} catch (error2) {
|
38961
|
-
}
|
38962
|
-
};
|
38963
|
-
document.addEventListener("selectionchange", onSelectionChange);
|
38964
|
-
return () => {
|
38965
|
-
document.removeEventListener("selectionchange", onSelectionChange);
|
38966
|
-
};
|
38967
|
-
}, []);
|
38968
|
-
const restoreRange = useCallback((range2) => {
|
38969
|
-
const selection = getShadowRoot().getSelection();
|
38970
|
-
selection.removeAllRanges();
|
38971
|
-
const newRange = document.createRange();
|
38972
|
-
newRange.setStart(range2.startContainer, range2.startOffset);
|
38973
|
-
newRange.setEnd(range2.endContainer, range2.endOffset);
|
38974
|
-
selection.addRange(newRange);
|
38975
|
-
}, []);
|
38976
|
-
const execCommand = (cmd, val) => {
|
38977
|
-
if (!container2) {
|
38978
|
-
console.error("No container");
|
38979
|
-
return;
|
38980
|
-
}
|
38981
|
-
if (!selectionRange) {
|
38982
|
-
console.error("No selectionRange");
|
38983
|
-
return;
|
38984
|
-
}
|
38985
|
-
if (!(container2 == null ? void 0 : container2.contains(selectionRange == null ? void 0 : selectionRange.commonAncestorContainer)) && container2 !== (selectionRange == null ? void 0 : selectionRange.commonAncestorContainer)) {
|
38986
|
-
console.error("Not commonAncestorContainer");
|
39001
|
+
const AttributesPanelWrapper = (props) => {
|
39002
|
+
const { focusBlock: focusBlock2, setFocusBlock } = useBlock();
|
39003
|
+
const { mergeTags: mergeTags2 } = useEditorProps();
|
39004
|
+
const block2 = focusBlock2 && BlockManager.getBlockByType(focusBlock2.type);
|
39005
|
+
const onChangeHidden = useCallback((val) => {
|
39006
|
+
if (!focusBlock2)
|
38987
39007
|
return;
|
38988
|
-
|
38989
|
-
|
38990
|
-
|
38991
|
-
|
38992
|
-
|
38993
|
-
|
38994
|
-
if (linkData.linkNode) {
|
38995
|
-
link = linkData.linkNode;
|
38996
|
-
} else {
|
38997
|
-
const uuid2 = (+new Date()).toString();
|
38998
|
-
document.execCommand(cmd, false, uuid2);
|
38999
|
-
link = getShadowRoot().querySelector(`a[href="${uuid2}"`);
|
39000
|
-
}
|
39001
|
-
if (target2) {
|
39002
|
-
link.setAttribute("target", target2);
|
39003
|
-
}
|
39004
|
-
link.style.color = "inherit";
|
39005
|
-
link.style.textDecoration = linkData.underline ? "underline" : "none";
|
39006
|
-
link.setAttribute("href", linkData.link);
|
39007
|
-
} else {
|
39008
|
-
document.execCommand(cmd, false, val);
|
39009
|
-
}
|
39010
|
-
const html = container2.innerHTML;
|
39011
|
-
props.onChange(html);
|
39012
|
-
};
|
39013
|
-
const getPopoverMountNode = () => document.getElementById(FIXED_CONTAINER_ID);
|
39014
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
39015
|
-
id: "Tools",
|
39016
|
-
style: { display: "flex", flexWrap: "nowrap" }
|
39017
|
-
}, /* @__PURE__ */ React__default.createElement("div", {
|
39008
|
+
focusBlock2.data.hidden = val;
|
39009
|
+
setFocusBlock(__spreadValues({}, focusBlock2));
|
39010
|
+
}, [focusBlock2, setFocusBlock]);
|
39011
|
+
if (!focusBlock2 || !block2)
|
39012
|
+
return null;
|
39013
|
+
return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", {
|
39018
39014
|
style: {
|
39019
|
-
|
39020
|
-
|
39021
|
-
|
39022
|
-
}, /* @__PURE__ */ React__default.createElement("div", {
|
39023
|
-
className: "easy-email-extensions-divider"
|
39024
|
-
}), /* @__PURE__ */ React__default.createElement(Popover$1, {
|
39025
|
-
className: "easy-email-extensions-Tools-Popover",
|
39026
|
-
trigger: "click",
|
39027
|
-
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$1), /* @__PURE__ */ React__default.createElement(FontFamily$1, {
|
39028
|
-
onChange: (val) => execCommand("fontName", val)
|
39029
|
-
})),
|
39030
|
-
getPopupContainer: getPopoverMountNode
|
39031
|
-
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39032
|
-
title: "font family",
|
39033
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39034
|
-
iconName: "icon-font-family"
|
39035
|
-
})
|
39036
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
39037
|
-
className: "easy-email-extensions-divider"
|
39038
|
-
}), /* @__PURE__ */ React__default.createElement(Popover$1, {
|
39039
|
-
className: "easy-email-extensions-Tools-Popover",
|
39040
|
-
color: "#fff",
|
39041
|
-
trigger: "click",
|
39042
|
-
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$1), /* @__PURE__ */ React__default.createElement(FontSizeList, {
|
39043
|
-
onChange: (val) => execCommand("fontSize", val)
|
39044
|
-
})),
|
39045
|
-
getPopupContainer: getPopoverMountNode
|
39046
|
-
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39047
|
-
title: "line-height",
|
39048
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39049
|
-
iconName: "icon-line-height"
|
39050
|
-
})
|
39051
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
39052
|
-
className: "easy-email-extensions-divider"
|
39053
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39054
|
-
onClick: () => execCommand("bold"),
|
39055
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39056
|
-
iconName: "icon-bold"
|
39057
|
-
}),
|
39058
|
-
title: "Bold"
|
39059
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39060
|
-
className: "easy-email-extensions-divider"
|
39061
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39062
|
-
onClick: () => execCommand("italic"),
|
39063
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39064
|
-
iconName: "icon-italic"
|
39065
|
-
}),
|
39066
|
-
title: "Italic"
|
39067
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39068
|
-
className: "easy-email-extensions-divider"
|
39069
|
-
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
39070
|
-
label: "",
|
39071
|
-
position: "tl",
|
39072
|
-
onChange: (color) => execCommand("foreColor", color),
|
39073
|
-
getPopupContainer: getPopoverMountNode,
|
39074
|
-
showInput: false
|
39075
|
-
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39076
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39077
|
-
iconName: "icon-font-color"
|
39078
|
-
}),
|
39079
|
-
title: "Text color"
|
39080
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
39081
|
-
className: "easy-email-extensions-divider"
|
39082
|
-
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
39083
|
-
label: "",
|
39084
|
-
showInput: false,
|
39085
|
-
position: "tl",
|
39086
|
-
onChange: (color) => execCommand("hiliteColor", color),
|
39087
|
-
getPopupContainer: getPopoverMountNode
|
39088
|
-
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39089
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39090
|
-
iconName: "icon-bg-colors"
|
39091
|
-
}),
|
39092
|
-
title: "Background color"
|
39093
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
39094
|
-
className: "easy-email-extensions-divider"
|
39095
|
-
}), /* @__PURE__ */ React__default.createElement(Link$1, {
|
39096
|
-
currentRange: selectionRange,
|
39097
|
-
onChange: (values2) => execCommand("createLink", values2),
|
39098
|
-
getPopupContainer: getPopoverMountNode
|
39099
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39100
|
-
className: "easy-email-extensions-divider"
|
39101
|
-
}), mergeTags && /* @__PURE__ */ React__default.createElement(Tooltip$1, {
|
39102
|
-
color: "#fff",
|
39103
|
-
position: "bottom",
|
39104
|
-
content: /* @__PURE__ */ React__default.createElement(MergeTags$1, {
|
39105
|
-
value: "",
|
39106
|
-
onChange: (val) => execCommand("insertHTML", val)
|
39107
|
-
}),
|
39108
|
-
getPopupContainer: getPopoverMountNode
|
39109
|
-
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39110
|
-
title: "Merge tag",
|
39111
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39112
|
-
iconName: "icon-merge-tags"
|
39113
|
-
})
|
39114
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
39115
|
-
className: "easy-email-extensions-divider"
|
39116
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39117
|
-
onClick: () => execCommand("justifyLeft"),
|
39118
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39119
|
-
iconName: "icon-align-left"
|
39120
|
-
}),
|
39121
|
-
title: "Align left"
|
39122
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39123
|
-
onClick: () => execCommand("justifyCenter"),
|
39124
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39125
|
-
iconName: "icon-align-center"
|
39126
|
-
}),
|
39127
|
-
title: "Align center"
|
39128
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39129
|
-
onClick: () => execCommand("justifyRight"),
|
39130
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39131
|
-
iconName: "icon-align-right"
|
39132
|
-
}),
|
39133
|
-
title: "Align right"
|
39134
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39135
|
-
className: "easy-email-extensions-divider"
|
39136
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39137
|
-
onClick: () => execCommand("insertOrderedList"),
|
39138
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39139
|
-
iconName: "icon-list-ol"
|
39140
|
-
}),
|
39141
|
-
title: "Orderlist"
|
39142
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39143
|
-
onClick: () => execCommand("insertUnorderedList"),
|
39144
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39145
|
-
iconName: "icon-list-ul"
|
39146
|
-
}),
|
39147
|
-
title: "Unorderlist"
|
39148
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39149
|
-
className: "easy-email-extensions-divider"
|
39150
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39151
|
-
onClick: () => execCommand("strikeThrough"),
|
39152
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39153
|
-
iconName: "icon-strikethrough"
|
39154
|
-
}),
|
39155
|
-
title: "StrikethroughOutlined"
|
39156
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39157
|
-
onClick: () => execCommand("underline"),
|
39158
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39159
|
-
iconName: "icon-underline"
|
39160
|
-
}),
|
39161
|
-
title: "UnderlineOutlined"
|
39162
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39163
|
-
onClick: () => execCommand("insertHorizontalRule"),
|
39164
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39165
|
-
iconName: "icon-line"
|
39166
|
-
}),
|
39167
|
-
title: "Line"
|
39168
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39169
|
-
className: "easy-email-extensions-divider"
|
39170
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39171
|
-
onClick: () => execCommand("removeFormat"),
|
39172
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39173
|
-
iconName: "icon-close"
|
39174
|
-
}),
|
39175
|
-
title: "Remove format"
|
39176
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39177
|
-
className: "easy-email-extensions-divider"
|
39178
|
-
})));
|
39179
|
-
}
|
39180
|
-
var styleText = ".easy-email-extensions-emailToolItem{display:inline-flex;position:relative;outline:none;font-weight:400;appearance:none;cursor:pointer!important;white-space:nowrap;transition:all .1s linear;box-sizing:border-box;line-height:1.5715;border:none;background-color:transparent;color:#fff}.easy-email-extensions-divider{position:relative;display:inline-flex;width:1px;height:16px;background-color:#808080e6}\n";
|
39181
|
-
function RichTextToolBar() {
|
39182
|
-
const [direction, setDirection] = useState("top");
|
39183
|
-
const [blockNode, setBlockNode] = useState(null);
|
39184
|
-
const [offsetX, setOffsetX] = useState(0);
|
39185
|
-
const { focusBlock: focusBlock2 } = useBlock();
|
39186
|
-
const { pageData: pageData2 } = useEditorContext();
|
39187
|
-
const { focusIdx: focusIdx2 } = useFocusIdx();
|
39188
|
-
const pageWidth = +(pageData2.attributes.width || "600").replace("px", "");
|
39189
|
-
useEffect(() => {
|
39190
|
-
const promiseObj = awaitForElement(focusIdx2);
|
39191
|
-
promiseObj.promise.then((blockNode2) => {
|
39192
|
-
setBlockNode(blockNode2);
|
39193
|
-
});
|
39194
|
-
return () => {
|
39195
|
-
promiseObj.cancel();
|
39196
|
-
};
|
39197
|
-
}, [focusIdx2, focusBlock2]);
|
39198
|
-
useEffect(() => {
|
39199
|
-
if (blockNode) {
|
39200
|
-
const options2 = {
|
39201
|
-
rootMargin: "-84px 0px 0px 0px",
|
39202
|
-
root: getShadowRoot().firstChild,
|
39203
|
-
threshold: [0, 1e-3, 0.1, 0.999, 0.8, 0.9, 1]
|
39204
|
-
};
|
39205
|
-
const checkDirection = (ev) => {
|
39206
|
-
const [current] = ev;
|
39207
|
-
const { top } = current.intersectionRect;
|
39208
|
-
const boundingClientRect = current.boundingClientRect;
|
39209
|
-
const rootBounds = current.rootBounds;
|
39210
|
-
const intersectionRatio = current.intersectionRatio;
|
39211
|
-
if (!rootBounds)
|
39212
|
-
return;
|
39213
|
-
const paddingLeft = (rootBounds.width - pageWidth) / 2;
|
39214
|
-
const offsetLeft = boundingClientRect.left - rootBounds.left;
|
39215
|
-
setOffsetX(paddingLeft - offsetLeft);
|
39216
|
-
if (intersectionRatio === 1) {
|
39217
|
-
setDirection("top");
|
39218
|
-
} else {
|
39219
|
-
if (top) {
|
39220
|
-
if (top > rootBounds.top) {
|
39221
|
-
setDirection("top");
|
39222
|
-
} else {
|
39223
|
-
setDirection("bottom");
|
39224
|
-
}
|
39225
|
-
}
|
39226
|
-
}
|
39227
|
-
};
|
39228
|
-
const observer = new IntersectionObserver(checkDirection, options2);
|
39229
|
-
observer.observe(blockNode);
|
39230
|
-
return () => {
|
39231
|
-
observer.unobserve(blockNode);
|
39232
|
-
};
|
39233
|
-
}
|
39234
|
-
}, [blockNode, pageWidth]);
|
39235
|
-
if (!blockNode)
|
39236
|
-
return null;
|
39237
|
-
const editorContainer = blockNode && getEditNode(blockNode);
|
39238
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, createPortal(/* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", {
|
39239
|
-
dangerouslySetInnerHTML: { __html: styleText }
|
39240
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39241
|
-
style: {
|
39242
|
-
transform: direction === "top" ? "translate(0,-100%)" : void 0,
|
39243
|
-
padding: "4px 8px",
|
39244
|
-
boxSizing: "border-box",
|
39245
|
-
position: "absolute",
|
39246
|
-
zIndex: 100,
|
39247
|
-
top: direction === "top" ? -40 : "calc(100% + 40px)",
|
39248
|
-
left: offsetX,
|
39249
|
-
width: pageWidth
|
39250
|
-
}
|
39251
|
-
}, /* @__PURE__ */ React__default.createElement("div", {
|
39252
|
-
style: {
|
39253
|
-
position: "absolute",
|
39254
|
-
backgroundColor: "#41444d",
|
39255
|
-
height: "100%",
|
39256
|
-
width: "100%",
|
39257
|
-
left: 0,
|
39258
|
-
top: 0
|
39259
|
-
}
|
39260
|
-
}), /* @__PURE__ */ React__default.createElement(Tools, {
|
39261
|
-
container: editorContainer,
|
39262
|
-
onChange: () => {
|
39263
|
-
}
|
39264
|
-
}))), blockNode));
|
39265
|
-
}
|
39266
|
-
const RichTextField = (props) => {
|
39267
|
-
const { focusBlock: focusBlock2 } = useBlock();
|
39268
|
-
const { focusIdx: focusIdx2 } = useFocusIdx();
|
39269
|
-
if ((focusBlock2 == null ? void 0 : focusBlock2.type) !== BasicType.TEXT)
|
39270
|
-
return null;
|
39271
|
-
const name = `${focusIdx2}.data.value.content`;
|
39272
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(RichTextToolBar, null), /* @__PURE__ */ React__default.createElement(Field, {
|
39273
|
-
name,
|
39274
|
-
parse: (v) => v
|
39275
|
-
}, ({ input }) => /* @__PURE__ */ React__default.createElement(FieldWrapper, __spreadProps(__spreadValues({}, props), {
|
39276
|
-
input
|
39277
|
-
}))));
|
39278
|
-
};
|
39279
|
-
function FieldWrapper(props) {
|
39280
|
-
const _a = props, { input } = _a, rest = __objRest(_a, ["input"]);
|
39281
|
-
const debounceCallbackChange = useCallback(lodash.exports.debounce((val) => {
|
39282
|
-
input.onChange(val);
|
39283
|
-
}, 500), [input]);
|
39284
|
-
return /* @__PURE__ */ React__default.createElement(InlineText, __spreadProps(__spreadValues({}, rest), {
|
39285
|
-
onChange: debounceCallbackChange
|
39286
|
-
}));
|
39287
|
-
}
|
39288
|
-
const TextField = enhancer(Input, (value) => value);
|
39289
|
-
const SearchField = enhancer(Input$5.Search, (val) => val);
|
39290
|
-
const TextAreaField = enhancer(Input$5.TextArea, (val) => val);
|
39291
|
-
const NumberField = enhancer(InputNumber$1, (e) => e);
|
39292
|
-
const SliderField = enhancer(Slider$2, (e) => e);
|
39293
|
-
const ColorPickerField = enhancer(ColorPicker, (e) => e);
|
39294
|
-
const UploadField = enhancer(UploadField$1, (val) => val);
|
39295
|
-
const ImageUploaderField = enhancer(ImageUploader, (url) => url);
|
39296
|
-
const SelectField = enhancer(Select, (e) => e);
|
39297
|
-
const AutoCompleteField = enhancer(AutoComplete, (e) => e);
|
39298
|
-
const RadioGroupField = enhancer(RadioGroup, (value) => value);
|
39299
|
-
const SwitchField = enhancer(Switch$1, (e) => e);
|
39300
|
-
const DatePickerField = enhancer(DatePicker$1, (date) => date);
|
39301
|
-
const CheckboxField = enhancer(CheckBoxGroup, (e) => e);
|
39302
|
-
const EditTabField = enhancer(EditTab, (e) => e);
|
39303
|
-
const InlineTextField = enhancer(InlineText, (value) => value);
|
39304
|
-
const AddToCollection = ({ visible, setVisible }) => {
|
39305
|
-
const { focusBlock: focusBlockData } = useBlock();
|
39306
|
-
const { onAddCollection, onUploadImage } = useEditorProps();
|
39307
|
-
const onSubmit = (values2) => {
|
39308
|
-
if (!values2.label)
|
39309
|
-
return;
|
39310
|
-
const uuid2 = uuid_1.v4();
|
39311
|
-
onAddCollection == null ? void 0 : onAddCollection({
|
39312
|
-
label: values2.label,
|
39313
|
-
helpText: values2.helpText,
|
39314
|
-
data: focusBlockData,
|
39315
|
-
thumbnail: values2.thumbnail,
|
39316
|
-
id: uuid2
|
39317
|
-
});
|
39318
|
-
setVisible(false);
|
39319
|
-
};
|
39320
|
-
return /* @__PURE__ */ React__default.createElement(Form$3, {
|
39321
|
-
initialValues: { label: "", helpText: "", thumbnail: "" },
|
39322
|
-
onSubmit
|
39323
|
-
}, ({ handleSubmit }) => /* @__PURE__ */ React__default.createElement(Modal$1, {
|
39324
|
-
maskClosable: false,
|
39325
|
-
style: { zIndex: 2e3 },
|
39326
|
-
visible,
|
39327
|
-
title: "Add to collection",
|
39328
|
-
onOk: () => handleSubmit(),
|
39329
|
-
onCancel: () => setVisible(false)
|
39330
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39331
|
-
vertical: true
|
39332
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, null), /* @__PURE__ */ React__default.createElement(TextField, {
|
39333
|
-
label: "Title",
|
39334
|
-
name: "label",
|
39335
|
-
validate: (val) => {
|
39336
|
-
if (!val)
|
39337
|
-
return "Title required!";
|
39338
|
-
return void 0;
|
39339
|
-
}
|
39340
|
-
}), /* @__PURE__ */ React__default.createElement(TextAreaField, {
|
39341
|
-
label: "Description",
|
39342
|
-
name: "helpText"
|
39343
|
-
}), /* @__PURE__ */ React__default.createElement(ImageUploaderField, {
|
39344
|
-
label: "Thumbnail",
|
39345
|
-
name: "thumbnail",
|
39346
|
-
uploadHandler: onUploadImage,
|
39347
|
-
validate: (val) => {
|
39348
|
-
if (!val)
|
39349
|
-
return "Thumbnail required!";
|
39350
|
-
return void 0;
|
39351
|
-
}
|
39352
|
-
}))));
|
39353
|
-
};
|
39354
|
-
function useAddToCollection() {
|
39355
|
-
const [modalVisible, setModalVisible] = useState(false);
|
39356
|
-
const modal = useMemo(() => /* @__PURE__ */ React__default.createElement(AddToCollection, {
|
39357
|
-
visible: modalVisible,
|
39358
|
-
setVisible: setModalVisible
|
39359
|
-
}), [modalVisible]);
|
39360
|
-
return {
|
39361
|
-
modal,
|
39362
|
-
modalVisible,
|
39363
|
-
setModalVisible
|
39364
|
-
};
|
39365
|
-
}
|
39366
|
-
function ContextMenu({
|
39367
|
-
moveBlock,
|
39368
|
-
copyBlock,
|
39369
|
-
removeBlock,
|
39370
|
-
contextMenuData,
|
39371
|
-
onClose
|
39372
|
-
}) {
|
39373
|
-
const { blockData, left, top } = contextMenuData;
|
39374
|
-
const idx = blockData.id;
|
39375
|
-
const { modal, modalVisible, setModalVisible } = useAddToCollection();
|
39376
|
-
const ref = useRef(null);
|
39377
|
-
const handleMoveUp = () => {
|
39378
|
-
moveBlock(idx, getSiblingIdx(idx, -1));
|
39379
|
-
scrollBlockEleIntoView({
|
39380
|
-
idx: getSiblingIdx(idx, -1)
|
39381
|
-
});
|
39382
|
-
onClose();
|
39383
|
-
};
|
39384
|
-
const handleMoveDown = () => {
|
39385
|
-
moveBlock(idx, getSiblingIdx(idx, 1));
|
39386
|
-
scrollBlockEleIntoView({
|
39387
|
-
idx: getSiblingIdx(idx, 1)
|
39388
|
-
});
|
39389
|
-
onClose();
|
39390
|
-
};
|
39391
|
-
const handleCopy = (ev) => {
|
39392
|
-
copyBlock(idx);
|
39393
|
-
scrollBlockEleIntoView({
|
39394
|
-
idx: getSiblingIdx(idx, 1)
|
39395
|
-
});
|
39396
|
-
onClose();
|
39397
|
-
};
|
39398
|
-
const handleAddToCollection = () => {
|
39399
|
-
setModalVisible(true);
|
39400
|
-
};
|
39401
|
-
const handleDelete = () => {
|
39402
|
-
removeBlock(idx);
|
39403
|
-
onClose();
|
39404
|
-
};
|
39405
|
-
const isFirst = getIndexByIdx(idx) === 0;
|
39406
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
39407
|
-
ref,
|
39408
|
-
style: { visibility: modalVisible ? "hidden" : void 0 }
|
39409
|
-
}, /* @__PURE__ */ React__default.createElement("div", {
|
39410
|
-
style: {
|
39411
|
-
left,
|
39412
|
-
top
|
39413
|
-
},
|
39414
|
-
className: styles$7.wrap,
|
39415
|
-
onClick: (e) => e.stopPropagation()
|
39416
|
-
}, !isFirst && /* @__PURE__ */ React__default.createElement("div", {
|
39417
|
-
className: styles$7.listItem,
|
39418
|
-
onClick: handleMoveUp
|
39419
|
-
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
39420
|
-
iconName: "icon-top",
|
39421
|
-
style: { marginRight: 10 }
|
39422
|
-
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Move up")), /* @__PURE__ */ React__default.createElement("div", {
|
39423
|
-
className: styles$7.listItem,
|
39424
|
-
onClick: handleMoveDown
|
39425
|
-
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
39426
|
-
iconName: "icon-bottom",
|
39427
|
-
style: { marginRight: 10 }
|
39428
|
-
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Move down")), /* @__PURE__ */ React__default.createElement("div", {
|
39429
|
-
className: styles$7.listItem,
|
39430
|
-
onClick: handleCopy
|
39431
|
-
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
39432
|
-
iconName: "icon-copy",
|
39433
|
-
style: { marginRight: 10 }
|
39434
|
-
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Copy")), /* @__PURE__ */ React__default.createElement("div", {
|
39435
|
-
className: styles$7.listItem,
|
39436
|
-
onClick: handleAddToCollection
|
39437
|
-
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
39438
|
-
iconName: "icon-start",
|
39439
|
-
style: { marginRight: 10 }
|
39440
|
-
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Add to collection")), /* @__PURE__ */ React__default.createElement("div", {
|
39441
|
-
className: styles$7.listItem,
|
39442
|
-
onClick: handleDelete
|
39443
|
-
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
39444
|
-
iconName: "icon-delete",
|
39445
|
-
style: { marginRight: 10 }
|
39446
|
-
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Delete")), /* @__PURE__ */ React__default.createElement("div", {
|
39447
|
-
className: styles$7.listItem,
|
39448
|
-
onClick: handleAddToCollection
|
39449
|
-
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
39450
|
-
iconName: "icon-start",
|
39451
|
-
style: { marginRight: 10 }
|
39452
|
-
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Add to collection"))), /* @__PURE__ */ React__default.createElement("div", {
|
39453
|
-
className: styles$7.contextmenuMark,
|
39454
|
-
onClick: onClose,
|
39455
|
-
onContextMenu: (e) => {
|
39456
|
-
e.preventDefault();
|
39457
|
-
onClose(e);
|
39458
|
-
}
|
39459
|
-
}), modal);
|
39460
|
-
}
|
39461
|
-
function BlockLayer() {
|
39462
|
-
const {
|
39463
|
-
pageData: pageData2,
|
39464
|
-
formState: { values: values2 }
|
39465
|
-
} = useEditorContext();
|
39466
|
-
const { onUploadImage, onAddCollection } = useEditorProps();
|
39467
|
-
const { focusIdx: focusIdx2, setFocusIdx } = useFocusIdx();
|
39468
|
-
const { setHoverIdx } = useHoverIdx();
|
39469
|
-
const { moveBlock, setValueByIdx: setValueByIdx2, copyBlock, removeBlock } = useBlock();
|
39470
|
-
const [contextMenuData, setContextMenuData] = useState(null);
|
39471
|
-
const onToggleVisible = useCallback(({ id }, e) => {
|
39472
|
-
e.stopPropagation();
|
39473
|
-
const blockData = lodash.exports.get(values2, id);
|
39474
|
-
if (blockData) {
|
39475
|
-
blockData.data.hidden = !Boolean(blockData.data.hidden);
|
39476
|
-
setValueByIdx2(id, blockData);
|
39477
|
-
}
|
39478
|
-
}, [setValueByIdx2, values2]);
|
39479
|
-
const renderTitle = useCallback((data) => {
|
39480
|
-
const block2 = BlockManager.getBlockByType(data.type);
|
39481
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
39482
|
-
className: styles$9.title
|
39483
|
-
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
39484
|
-
size: "smallest"
|
39485
|
-
}, block2 == null ? void 0 : block2.name), /* @__PURE__ */ React__default.createElement("div", {
|
39486
|
-
className: styles$9.eyeIcon
|
39487
|
-
}, /* @__PURE__ */ React__default.createElement(EyeIcon$1, {
|
39488
|
-
blockData: data,
|
39489
|
-
onToggleVisible
|
39490
|
-
})));
|
39491
|
-
}, [onToggleVisible]);
|
39492
|
-
const treeData = useMemo(() => {
|
39493
|
-
const copyData = lodash.exports.cloneDeep(pageData2);
|
39494
|
-
const loop2 = (item2, id, parent2) => {
|
39495
|
-
item2.id = id;
|
39496
|
-
item2.parent = parent2;
|
39497
|
-
item2.children.map((child, index2) => loop2(child, getChildIdx(id, index2), item2));
|
39498
|
-
};
|
39499
|
-
loop2(copyData, getPageIdx(), null);
|
39500
|
-
return [copyData];
|
39501
|
-
}, [pageData2]);
|
39502
|
-
const onSelect = useCallback((selectedId) => {
|
39503
|
-
setFocusIdx(selectedId);
|
39504
|
-
scrollBlockEleIntoView({ idx: selectedId });
|
39505
|
-
}, [setFocusIdx]);
|
39506
|
-
const onContextMenu = useCallback((blockData, ev) => {
|
39507
|
-
ev.preventDefault();
|
39508
|
-
setContextMenuData({ blockData, left: ev.clientX, top: ev.clientY });
|
39509
|
-
}, []);
|
39510
|
-
const onCloseContextMenu = useCallback((ev) => {
|
39511
|
-
setContextMenuData(null);
|
39512
|
-
}, []);
|
39513
|
-
const onMouseEnter = useCallback((id) => {
|
39514
|
-
setHoverIdx(id);
|
39515
|
-
}, [setHoverIdx]);
|
39516
|
-
const onMouseLeave = useCallback(() => {
|
39517
|
-
setHoverIdx("");
|
39518
|
-
}, [setHoverIdx]);
|
39519
|
-
const allowDrop = useCallback((params) => {
|
39520
|
-
const { dragNode, dropNode, willInsertAfter } = params;
|
39521
|
-
const dragBlock = BlockManager.getBlockByType(dragNode.type);
|
39522
|
-
if (!dragBlock)
|
39523
|
-
return false;
|
39524
|
-
if (dragBlock.validParentType.includes(dropNode.type) && willInsertAfter) {
|
39525
|
-
return true;
|
39526
|
-
}
|
39527
|
-
if (dropNode.parent && dragBlock.validParentType.includes(dropNode.parent.type)) {
|
39528
|
-
return true;
|
39529
|
-
}
|
39530
|
-
return false;
|
39531
|
-
}, []);
|
39532
|
-
const onDrop = useCallback((params) => {
|
39533
|
-
const { dragNode, dropNode, willInsertAfter } = params;
|
39534
|
-
const dragBlock = BlockManager.getBlockByType(dragNode.type);
|
39535
|
-
if (!dragBlock)
|
39536
|
-
return;
|
39537
|
-
if (dragBlock.validParentType.includes(dropNode.type) && willInsertAfter) {
|
39538
|
-
moveBlock(dragNode.id, getChildIdx(dropNode.id, 0));
|
39539
|
-
} else {
|
39540
|
-
moveBlock(dragNode.id, willInsertAfter ? getSiblingIdx(dropNode.id, 1) : dropNode.id);
|
39541
|
-
}
|
39542
|
-
}, [moveBlock]);
|
39543
|
-
const hasFocus = Boolean(focusIdx2);
|
39544
|
-
return useMemo(() => {
|
39545
|
-
if (!hasFocus)
|
39546
|
-
return null;
|
39547
|
-
return /* @__PURE__ */ React__default.createElement("div", __spreadValues({
|
39548
|
-
id: "BlockLayerManager"
|
39549
|
-
}, {
|
39550
|
-
[DATA_ATTRIBUTE_DROP_CONTAINER]: "true"
|
39551
|
-
}), /* @__PURE__ */ React__default.createElement(BlockTree, {
|
39552
|
-
selectedId: focusIdx2,
|
39553
|
-
defaultExpandAll: true,
|
39554
|
-
treeData,
|
39555
|
-
renderTitle,
|
39556
|
-
allowDrop,
|
39557
|
-
onContextMenu,
|
39558
|
-
onDrop,
|
39559
|
-
onSelect,
|
39560
|
-
onMouseEnter,
|
39561
|
-
onMouseLeave
|
39562
|
-
}), contextMenuData && /* @__PURE__ */ React__default.createElement(ContextMenu, {
|
39563
|
-
onClose: onCloseContextMenu,
|
39564
|
-
moveBlock,
|
39565
|
-
copyBlock,
|
39566
|
-
removeBlock,
|
39567
|
-
contextMenuData
|
39568
|
-
}));
|
39569
|
-
}, [
|
39570
|
-
hasFocus,
|
39571
|
-
focusIdx2,
|
39572
|
-
treeData,
|
39573
|
-
renderTitle,
|
39574
|
-
allowDrop,
|
39575
|
-
onContextMenu,
|
39576
|
-
onDrop,
|
39577
|
-
onSelect,
|
39578
|
-
onMouseEnter,
|
39579
|
-
onMouseLeave,
|
39580
|
-
contextMenuData,
|
39581
|
-
onCloseContextMenu,
|
39582
|
-
onUploadImage,
|
39583
|
-
onAddCollection,
|
39584
|
-
moveBlock,
|
39585
|
-
copyBlock,
|
39586
|
-
removeBlock
|
39587
|
-
]);
|
39588
|
-
}
|
39589
|
-
function Help(props) {
|
39590
|
-
return /* @__PURE__ */ React__default.createElement(Tooltip$1, __spreadProps(__spreadValues({}, __spreadProps(__spreadValues({}, props), { style: void 0 })), {
|
39591
|
-
content: props.title
|
39592
|
-
}), /* @__PURE__ */ React__default.createElement("span", {
|
39593
|
-
style: { cursor: "pointer" }
|
39594
|
-
}, /* @__PURE__ */ React__default.createElement(IconQuestionCircle$1, {
|
39595
|
-
style: props.style
|
39596
|
-
})));
|
39597
|
-
}
|
39598
|
-
var ARRAY_ERROR = "FINAL_FORM/array-error";
|
39599
|
-
var fieldSubscriptionItems = ["active", "data", "dirty", "dirtySinceLastSubmit", "error", "initial", "invalid", "length", "modified", "modifiedSinceLastSubmit", "pristine", "submitError", "submitFailed", "submitSucceeded", "submitting", "touched", "valid", "value", "visited", "validating"];
|
39600
|
-
var version$1 = "4.20.4";
|
39601
|
-
function renderComponent(props, name) {
|
39602
|
-
var render3 = props.render, children = props.children, component = props.component, rest = _objectWithoutPropertiesLoose(props, ["render", "children", "component"]);
|
39603
|
-
if (component) {
|
39604
|
-
return /* @__PURE__ */ createElement(component, _extends$f({}, rest, {
|
39605
|
-
children,
|
39606
|
-
render: render3
|
39607
|
-
}));
|
39608
|
-
}
|
39609
|
-
if (render3) {
|
39610
|
-
return render3(children === void 0 ? rest : _extends$f({}, rest, {
|
39611
|
-
children
|
39612
|
-
}));
|
39613
|
-
}
|
39614
|
-
if (typeof children !== "function") {
|
39615
|
-
throw new Error("Must specify either a render prop, a render function as children, or a component prop to " + name);
|
39616
|
-
}
|
39617
|
-
return children(rest);
|
39618
|
-
}
|
39619
|
-
var defaultIsEqual = function defaultIsEqual2(aArray, bArray) {
|
39620
|
-
return aArray === bArray || Array.isArray(aArray) && Array.isArray(bArray) && aArray.length === bArray.length && !aArray.some(function(a, index2) {
|
39621
|
-
return a !== bArray[index2];
|
39622
|
-
});
|
39623
|
-
};
|
39624
|
-
function useConstant(init) {
|
39625
|
-
var ref = React__default.useRef();
|
39626
|
-
if (!ref.current) {
|
39627
|
-
ref.current = init();
|
39628
|
-
}
|
39629
|
-
return ref.current;
|
39630
|
-
}
|
39631
|
-
var all = fieldSubscriptionItems.reduce(function(result, key) {
|
39632
|
-
result[key] = true;
|
39633
|
-
return result;
|
39634
|
-
}, {});
|
39635
|
-
var useFieldArray = function useFieldArray2(name, _temp) {
|
39636
|
-
var _ref2 = _temp === void 0 ? {} : _temp, _ref$subscription = _ref2.subscription, subscription = _ref$subscription === void 0 ? all : _ref$subscription, defaultValue = _ref2.defaultValue, initialValue = _ref2.initialValue, _ref$isEqual = _ref2.isEqual, isEqual2 = _ref$isEqual === void 0 ? defaultIsEqual : _ref$isEqual, validateProp = _ref2.validate;
|
39637
|
-
var form = useForm$1("useFieldArray");
|
39638
|
-
var formMutators = form.mutators;
|
39639
|
-
var hasMutators = !!(formMutators && formMutators.push && formMutators.pop);
|
39640
|
-
if (!hasMutators) {
|
39641
|
-
throw new Error("Array mutators not found. You need to provide the mutators from final-form-arrays to your form");
|
39642
|
-
}
|
39643
|
-
var mutators = useConstant(function() {
|
39644
|
-
return Object.keys(formMutators).reduce(function(result, key) {
|
39645
|
-
result[key] = function() {
|
39646
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
39647
|
-
args[_key] = arguments[_key];
|
39648
|
-
}
|
39649
|
-
return formMutators[key].apply(formMutators, [name].concat(args));
|
39650
|
-
};
|
39651
|
-
return result;
|
39652
|
-
}, {});
|
39653
|
-
});
|
39654
|
-
var validate3 = useConstant(function() {
|
39655
|
-
return function(value, allValues, meta2) {
|
39656
|
-
if (!validateProp)
|
39657
|
-
return void 0;
|
39658
|
-
var error2 = validateProp(value, allValues, meta2);
|
39659
|
-
if (!error2 || Array.isArray(error2)) {
|
39660
|
-
return error2;
|
39661
|
-
} else {
|
39662
|
-
var arrayError = [];
|
39663
|
-
arrayError[ARRAY_ERROR] = error2;
|
39664
|
-
return arrayError;
|
39665
|
-
}
|
39666
|
-
};
|
39667
|
-
});
|
39668
|
-
var _useField = useField(name, {
|
39669
|
-
subscription: _extends$f({}, subscription, {
|
39670
|
-
length: true
|
39671
|
-
}),
|
39672
|
-
defaultValue,
|
39673
|
-
initialValue,
|
39674
|
-
isEqual: isEqual2,
|
39675
|
-
validate: validate3,
|
39676
|
-
format: function format(v) {
|
39677
|
-
return v;
|
39678
|
-
}
|
39679
|
-
}), _useField$meta = _useField.meta, length = _useField$meta.length, meta = _objectWithoutPropertiesLoose(_useField$meta, ["length"]), input = _useField.input, fieldState = _objectWithoutPropertiesLoose(_useField, ["meta", "input"]);
|
39680
|
-
var forEach2 = function forEach3(iterator) {
|
39681
|
-
var len = length || 0;
|
39682
|
-
for (var i2 = 0; i2 < len; i2++) {
|
39683
|
-
iterator(name + "[" + i2 + "]", i2);
|
39684
|
-
}
|
39685
|
-
};
|
39686
|
-
var map2 = function map3(iterator) {
|
39687
|
-
var len = length || 0;
|
39688
|
-
var results = [];
|
39689
|
-
for (var i2 = 0; i2 < len; i2++) {
|
39690
|
-
results.push(iterator(name + "[" + i2 + "]", i2));
|
39691
|
-
}
|
39692
|
-
return results;
|
39693
|
-
};
|
39694
|
-
return {
|
39695
|
-
fields: _extends$f({
|
39696
|
-
name,
|
39697
|
-
forEach: forEach2,
|
39698
|
-
length: length || 0,
|
39699
|
-
map: map2
|
39700
|
-
}, mutators, fieldState, {
|
39701
|
-
value: input.value
|
39702
|
-
}),
|
39703
|
-
meta
|
39704
|
-
};
|
39705
|
-
};
|
39706
|
-
var version = "3.1.2";
|
39707
|
-
var versions = {
|
39708
|
-
"final-form": version$1,
|
39709
|
-
"react-final-form": version$2,
|
39710
|
-
"react-final-form-arrays": version
|
39711
|
-
};
|
39712
|
-
var FieldArray = function FieldArray2(_ref2) {
|
39713
|
-
var name = _ref2.name, subscription = _ref2.subscription, defaultValue = _ref2.defaultValue, initialValue = _ref2.initialValue, isEqual2 = _ref2.isEqual, validate3 = _ref2.validate, rest = _objectWithoutPropertiesLoose(_ref2, ["name", "subscription", "defaultValue", "initialValue", "isEqual", "validate"]);
|
39714
|
-
var _useFieldArray = useFieldArray(name, {
|
39715
|
-
subscription,
|
39716
|
-
defaultValue,
|
39717
|
-
initialValue,
|
39718
|
-
isEqual: isEqual2,
|
39719
|
-
validate: validate3
|
39720
|
-
}), fields = _useFieldArray.fields, meta = _useFieldArray.meta;
|
39721
|
-
return renderComponent(_extends$f({
|
39722
|
-
fields,
|
39723
|
-
meta: _extends$f({}, meta, {
|
39724
|
-
__versions: versions
|
39725
|
-
})
|
39726
|
-
}, rest), "FieldArray(" + name + ")");
|
39727
|
-
};
|
39728
|
-
function AddFont() {
|
39729
|
-
const { focusBlock: focusBlock2 } = useBlock();
|
39730
|
-
const { focusIdx: focusIdx2 } = useFocusIdx();
|
39731
|
-
const value = focusBlock2 == null ? void 0 : focusBlock2.data.value;
|
39732
|
-
return /* @__PURE__ */ React__default.createElement(FieldArray, {
|
39733
|
-
name: `${focusIdx2}.data.value.fonts`,
|
39734
|
-
render: (arrayHelpers) => {
|
39735
|
-
var _a;
|
39736
|
-
return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39737
|
-
vertical: true,
|
39738
|
-
spacing: "tight"
|
39739
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39740
|
-
distribution: "equalSpacing"
|
39741
|
-
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
39742
|
-
variation: "strong"
|
39743
|
-
}, "Import font ", /* @__PURE__ */ React__default.createElement(Help, {
|
39744
|
-
title: "Points to a hosted css file"
|
39745
|
-
})), /* @__PURE__ */ React__default.createElement(Stack$6, null, /* @__PURE__ */ React__default.createElement(Button$4, {
|
39746
|
-
size: "small",
|
39747
|
-
icon: /* @__PURE__ */ React__default.createElement(IconPlus$1, null),
|
39748
|
-
onClick: () => arrayHelpers.fields.push({ name: "", href: "" })
|
39749
|
-
}))), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39750
|
-
vertical: true,
|
39751
|
-
spacing: "extraTight"
|
39752
|
-
}, (_a = value.fonts) == null ? void 0 : _a.map((item2, index2) => {
|
39753
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
39754
|
-
key: index2
|
39755
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39756
|
-
alignment: "center",
|
39757
|
-
wrap: false
|
39758
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
39759
|
-
fill: true
|
39760
|
-
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
39761
|
-
inline: true,
|
39762
|
-
name: `${focusIdx2}.data.value.fonts.${index2}.name`,
|
39763
|
-
label: "Name"
|
39764
|
-
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
39765
|
-
fill: true
|
39766
|
-
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
39767
|
-
inline: true,
|
39768
|
-
name: `${focusIdx2}.data.value.fonts.${index2}.href`,
|
39769
|
-
label: "Href"
|
39770
|
-
})), /* @__PURE__ */ React__default.createElement(Button$4, {
|
39771
|
-
icon: /* @__PURE__ */ React__default.createElement(IconDelete$1, null),
|
39772
|
-
onClick: () => arrayHelpers.fields.remove(index2)
|
39773
|
-
})));
|
39774
|
-
}))));
|
39775
|
-
}
|
39776
|
-
});
|
39777
|
-
}
|
39778
|
-
const MergeTags = React__default.memo((props) => {
|
39779
|
-
const { mergeTags = {} } = useEditorProps();
|
39780
|
-
const treeOptions = useMemo(() => {
|
39781
|
-
const treeData = [];
|
39782
|
-
const deep = (key, title2, parent2, mapData = []) => {
|
39783
|
-
const currentMapData = {
|
39784
|
-
key: `{{${key}}}`,
|
39785
|
-
value: `{{${key}}}`,
|
39786
|
-
title: title2,
|
39787
|
-
children: []
|
39788
|
-
};
|
39789
|
-
mapData.push(currentMapData);
|
39790
|
-
const current = parent2[key];
|
39791
|
-
if (lodash.exports.isObject(current)) {
|
39792
|
-
Object.keys(current).map((childKey) => deep(key + "." + childKey, childKey, current, currentMapData.children));
|
39793
|
-
}
|
39794
|
-
};
|
39795
|
-
Object.keys(mergeTags).map((key) => deep(key, key, mergeTags, treeData));
|
39796
|
-
return treeData;
|
39797
|
-
}, [mergeTags]);
|
39798
|
-
const onSelect = useCallback((value) => {
|
39799
|
-
return props.onChange(value);
|
39800
|
-
}, [props]);
|
39801
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
39802
|
-
style: { color: "#333" }
|
39803
|
-
}, props.isSelect ? /* @__PURE__ */ React__default.createElement(TreeSelect$1, {
|
39804
|
-
value: props.value,
|
39805
|
-
size: "small",
|
39806
|
-
style: { width: 120 },
|
39807
|
-
dropdownMenuStyle: { maxHeight: 400, overflow: "auto" },
|
39808
|
-
placeholder: "Please select",
|
39809
|
-
treeData: treeOptions,
|
39810
|
-
onChange: (val) => onSelect(val)
|
39811
|
-
}) : /* @__PURE__ */ React__default.createElement(Tree$1, {
|
39812
|
-
style: { width: 120 },
|
39813
|
-
selectedKeys: [],
|
39814
|
-
treeData: treeOptions,
|
39815
|
-
onSelect: (vals) => onSelect(vals[0])
|
39816
|
-
}));
|
39817
|
-
});
|
39818
|
-
const wrapper = "_wrapper_j840r_1";
|
39819
|
-
var styles$4 = {
|
39820
|
-
wrapper
|
39821
|
-
};
|
39822
|
-
const AttributesPanelWrapper = (props) => {
|
39823
|
-
const { focusBlock: focusBlock2, setFocusBlock } = useBlock();
|
39824
|
-
const { mergeTags } = useEditorProps();
|
39825
|
-
const block2 = focusBlock2 && BlockManager.getBlockByType(focusBlock2.type);
|
39826
|
-
const onChangeHidden = useCallback((val) => {
|
39827
|
-
if (!focusBlock2)
|
39828
|
-
return;
|
39829
|
-
focusBlock2.data.hidden = val;
|
39830
|
-
setFocusBlock(__spreadValues({}, focusBlock2));
|
39831
|
-
}, [focusBlock2, setFocusBlock]);
|
39832
|
-
if (!focusBlock2 || !block2)
|
39833
|
-
return null;
|
39834
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
39835
|
-
className: styles$4.wrapper
|
39836
|
-
}, /* @__PURE__ */ React__default.createElement("div", {
|
39837
|
-
style: {
|
39838
|
-
border: "1px solid #f0f0f0",
|
39839
|
-
borderBottom: "none",
|
39840
|
-
padding: "12px 24px"
|
39015
|
+
border: "1px solid var(--color-neutral-3, rgb(229, 230, 235))",
|
39016
|
+
borderBottom: "none",
|
39017
|
+
padding: "12px 24px"
|
39841
39018
|
}
|
39842
39019
|
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39843
39020
|
vertical: true
|
@@ -39850,7 +39027,10 @@ const AttributesPanelWrapper = (props) => {
|
|
39850
39027
|
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39851
39028
|
spacing: "extraTight",
|
39852
39029
|
alignment: "center"
|
39853
|
-
}, /* @__PURE__ */ React__default.createElement(EyeIcon, null), /* @__PURE__ */ React__default.createElement(TextStyle,
|
39030
|
+
}, /* @__PURE__ */ React__default.createElement(EyeIcon, null), /* @__PURE__ */ React__default.createElement(TextStyle, {
|
39031
|
+
variation: "strong",
|
39032
|
+
size: "large"
|
39033
|
+
}, `${block2.name} attributes`)), /* @__PURE__ */ React__default.createElement(Stack$6.Item, null, props.extra))), Boolean(focusBlock2.data.hidden) && mergeTags2 && /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39854
39034
|
spacing: "extraTight"
|
39855
39035
|
}, /* @__PURE__ */ React__default.createElement(TextStyle, null, "Hide if"), /* @__PURE__ */ React__default.createElement(MergeTags, {
|
39856
39036
|
isSelect: true,
|
@@ -39877,8 +39057,10 @@ function EyeIcon() {
|
|
39877
39057
|
if (focusBlock2.type === BasicType.PAGE)
|
39878
39058
|
return null;
|
39879
39059
|
return focusBlock2.data.hidden ? /* @__PURE__ */ React__default.createElement(IconEyeInvisible$1, {
|
39060
|
+
style: { cursor: "pointer", fontSize: 18 },
|
39880
39061
|
onClick: onToggleVisible
|
39881
39062
|
}) : /* @__PURE__ */ React__default.createElement(IconEye$1, {
|
39063
|
+
style: { cursor: "pointer", fontSize: 18 },
|
39882
39064
|
onClick: onToggleVisible
|
39883
39065
|
});
|
39884
39066
|
}
|
@@ -40005,10 +39187,10 @@ function Padding(props = {}) {
|
|
40005
39187
|
bottom,
|
40006
39188
|
right
|
40007
39189
|
};
|
40008
|
-
}, [paddingList, defaultPaddingList]);
|
39190
|
+
}, [paddingList, defaultPaddingList, defaultPaddingValue, paddingValue]);
|
40009
39191
|
const onChancePadding = useCallback((val) => {
|
40010
39192
|
change(focusIdx2 + `.attributes[${attributeName}]`, val);
|
40011
|
-
}, [focusIdx2, attributeName]);
|
39193
|
+
}, [focusIdx2, attributeName, change]);
|
40012
39194
|
return /* @__PURE__ */ React__default.createElement(Form$3, {
|
40013
39195
|
initialValues: paddingFormValues,
|
40014
39196
|
subscription: { submitting: true, pristine: true },
|
@@ -41663,165 +40845,1011 @@ function Table() {
|
|
41663
40845
|
setVisible
|
41664
40846
|
}));
|
41665
40847
|
}
|
41666
|
-
const blocks = {
|
41667
|
-
[BasicType.PAGE]: Page,
|
41668
|
-
[BasicType.SECTION]: Section,
|
41669
|
-
[BasicType.COLUMN]: Column,
|
41670
|
-
[BasicType.TEXT]: Text,
|
41671
|
-
[BasicType.IMAGE]: Image$1,
|
41672
|
-
[BasicType.GROUP]: Group,
|
41673
|
-
[BasicType.BUTTON]: Button,
|
41674
|
-
[BasicType.DIVIDER]: Divider,
|
41675
|
-
[BasicType.WRAPPER]: Wrapper,
|
41676
|
-
[BasicType.SPACER]: Spacer,
|
41677
|
-
[BasicType.RAW]: Raw,
|
41678
|
-
[BasicType.ACCORDION]: Accordion,
|
41679
|
-
[BasicType.ACCORDION_ELEMENT]: AccordionElement,
|
41680
|
-
[BasicType.ACCORDION_TITLE]: AccordionTitle,
|
41681
|
-
[BasicType.ACCORDION_TEXT]: AccordionText,
|
41682
|
-
[BasicType.CAROUSEL]: Carousel,
|
41683
|
-
[BasicType.HERO]: Hero,
|
41684
|
-
[BasicType.NAVBAR]: Navbar,
|
41685
|
-
[BasicType.SOCIAL]: Social,
|
41686
|
-
[BasicType.TABLE]: Table
|
40848
|
+
const blocks = {
|
40849
|
+
[BasicType.PAGE]: Page,
|
40850
|
+
[BasicType.SECTION]: Section,
|
40851
|
+
[BasicType.COLUMN]: Column,
|
40852
|
+
[BasicType.TEXT]: Text,
|
40853
|
+
[BasicType.IMAGE]: Image$1,
|
40854
|
+
[BasicType.GROUP]: Group,
|
40855
|
+
[BasicType.BUTTON]: Button,
|
40856
|
+
[BasicType.DIVIDER]: Divider,
|
40857
|
+
[BasicType.WRAPPER]: Wrapper,
|
40858
|
+
[BasicType.SPACER]: Spacer,
|
40859
|
+
[BasicType.RAW]: Raw,
|
40860
|
+
[BasicType.ACCORDION]: Accordion,
|
40861
|
+
[BasicType.ACCORDION_ELEMENT]: AccordionElement,
|
40862
|
+
[BasicType.ACCORDION_TITLE]: AccordionTitle,
|
40863
|
+
[BasicType.ACCORDION_TEXT]: AccordionText,
|
40864
|
+
[BasicType.CAROUSEL]: Carousel,
|
40865
|
+
[BasicType.HERO]: Hero,
|
40866
|
+
[BasicType.NAVBAR]: Navbar,
|
40867
|
+
[BasicType.SOCIAL]: Social,
|
40868
|
+
[BasicType.TABLE]: Table
|
40869
|
+
};
|
40870
|
+
class BlockAttributeConfigurationManager {
|
40871
|
+
static add(componentMap) {
|
40872
|
+
Object.keys(componentMap).forEach((name) => {
|
40873
|
+
this.map[name] = componentMap[name];
|
40874
|
+
});
|
40875
|
+
}
|
40876
|
+
static get(name) {
|
40877
|
+
return this.map[name];
|
40878
|
+
}
|
40879
|
+
static getMap() {
|
40880
|
+
return this.map;
|
40881
|
+
}
|
40882
|
+
}
|
40883
|
+
__publicField(BlockAttributeConfigurationManager, "map", __spreadValues({}, blocks));
|
40884
|
+
function AttributePanel() {
|
40885
|
+
const { values: values2, focusBlock: focusBlock2 } = useBlock();
|
40886
|
+
const { initialized } = useEditorContext();
|
40887
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
40888
|
+
const value = getValueByIdx(values2, focusIdx2);
|
40889
|
+
const Com = focusBlock2 && BlockAttributeConfigurationManager.get(focusBlock2.type);
|
40890
|
+
const shadowRoot = getShadowRoot();
|
40891
|
+
if (!value || !initialized)
|
40892
|
+
return null;
|
40893
|
+
return /* @__PURE__ */ React__default.createElement(PresetColorsProvider, null, Com ? /* @__PURE__ */ React__default.createElement(Com, null) : /* @__PURE__ */ React__default.createElement("div", {
|
40894
|
+
style: { marginTop: 200, padding: "0 50px" }
|
40895
|
+
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
40896
|
+
size: "extraLarge"
|
40897
|
+
}, "No matching components")), /* @__PURE__ */ React__default.createElement("div", {
|
40898
|
+
style: { position: "absolute" }
|
40899
|
+
}, /* @__PURE__ */ React__default.createElement(RichTextField, {
|
40900
|
+
idx: focusIdx2
|
40901
|
+
})), shadowRoot && ReactDOM.createPortal(/* @__PURE__ */ React__default.createElement("style", null, `
|
40902
|
+
.email-block [contentEditable="true"],
|
40903
|
+
.email-block [contentEditable="true"] * {
|
40904
|
+
outline: none;
|
40905
|
+
cursor: text;
|
40906
|
+
}
|
40907
|
+
`), shadowRoot));
|
40908
|
+
}
|
40909
|
+
function Decoration() {
|
40910
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
40911
|
+
return useMemo(() => {
|
40912
|
+
return /* @__PURE__ */ React__default.createElement(Stack$6, {
|
40913
|
+
key: focusIdx2,
|
40914
|
+
vertical: true,
|
40915
|
+
spacing: "extraTight"
|
40916
|
+
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
40917
|
+
variation: "strong",
|
40918
|
+
size: "large"
|
40919
|
+
}, "Decoration"), /* @__PURE__ */ React__default.createElement(TextField, {
|
40920
|
+
label: "Border radius",
|
40921
|
+
name: `${focusIdx2}.attributes.borderRadius`,
|
40922
|
+
inline: true
|
40923
|
+
}), /* @__PURE__ */ React__default.createElement(TextField, {
|
40924
|
+
label: "Border",
|
40925
|
+
name: `${focusIdx2}.attributes.border`,
|
40926
|
+
inline: true,
|
40927
|
+
alignment: "center"
|
40928
|
+
}), /* @__PURE__ */ React__default.createElement(NumberField, {
|
40929
|
+
label: "Opacity",
|
40930
|
+
max: 1,
|
40931
|
+
min: 0,
|
40932
|
+
step: 0.1,
|
40933
|
+
name: `${focusIdx2}.attributes.opacity`,
|
40934
|
+
inline: true,
|
40935
|
+
alignment: "center"
|
40936
|
+
}));
|
40937
|
+
}, [focusIdx2]);
|
40938
|
+
}
|
40939
|
+
const options = [
|
40940
|
+
{
|
40941
|
+
value: "ltr",
|
40942
|
+
label: "ltr"
|
40943
|
+
},
|
40944
|
+
{
|
40945
|
+
value: "rtl",
|
40946
|
+
label: "rtl"
|
40947
|
+
}
|
40948
|
+
];
|
40949
|
+
function Direction() {
|
40950
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
40951
|
+
return useMemo(() => {
|
40952
|
+
return /* @__PURE__ */ React__default.createElement(Stack$6, null, /* @__PURE__ */ React__default.createElement(RadioGroupField, {
|
40953
|
+
label: "Direction",
|
40954
|
+
name: `${focusIdx2}.attributes.direction`,
|
40955
|
+
options,
|
40956
|
+
inline: true
|
40957
|
+
}));
|
40958
|
+
}, [focusIdx2]);
|
40959
|
+
}
|
40960
|
+
function Margin() {
|
40961
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
40962
|
+
return useMemo(() => {
|
40963
|
+
return /* @__PURE__ */ React__default.createElement(Stack$6, {
|
40964
|
+
vertical: true,
|
40965
|
+
spacing: "extraTight"
|
40966
|
+
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
40967
|
+
size: "large"
|
40968
|
+
}, "Margin"), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
40969
|
+
wrap: false
|
40970
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
40971
|
+
fill: true
|
40972
|
+
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40973
|
+
label: "Top",
|
40974
|
+
quickchange: true,
|
40975
|
+
name: `${focusIdx2}.attributes.marginTop`,
|
40976
|
+
inline: true
|
40977
|
+
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
40978
|
+
fill: true
|
40979
|
+
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40980
|
+
label: "Bottom",
|
40981
|
+
quickchange: true,
|
40982
|
+
name: `${focusIdx2}.attributes.marginBottom`,
|
40983
|
+
inline: true
|
40984
|
+
}))), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
40985
|
+
wrap: false
|
40986
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
40987
|
+
fill: true
|
40988
|
+
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40989
|
+
label: "Left",
|
40990
|
+
quickchange: true,
|
40991
|
+
name: `${focusIdx2}.attributes.marginLeft`,
|
40992
|
+
inline: true
|
40993
|
+
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
40994
|
+
fill: true
|
40995
|
+
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40996
|
+
label: "Right",
|
40997
|
+
quickchange: true,
|
40998
|
+
name: `${focusIdx2}.attributes.marginRight`,
|
40999
|
+
inline: true
|
41000
|
+
}))));
|
41001
|
+
}, [focusIdx2]);
|
41002
|
+
}
|
41003
|
+
function Tools(props) {
|
41004
|
+
const { container: container2 } = props;
|
41005
|
+
const { mergeTags: mergeTags2 } = useEditorProps();
|
41006
|
+
const [selectionRange, setSelectionRange] = useState(null);
|
41007
|
+
useEffect(() => {
|
41008
|
+
const onSelectionChange = () => {
|
41009
|
+
try {
|
41010
|
+
const range2 = getShadowRoot().getSelection().getRangeAt(0);
|
41011
|
+
if (range2) {
|
41012
|
+
setSelectionRange(range2);
|
41013
|
+
}
|
41014
|
+
} catch (error2) {
|
41015
|
+
}
|
41016
|
+
};
|
41017
|
+
document.addEventListener("selectionchange", onSelectionChange);
|
41018
|
+
return () => {
|
41019
|
+
document.removeEventListener("selectionchange", onSelectionChange);
|
41020
|
+
};
|
41021
|
+
}, []);
|
41022
|
+
const restoreRange = useCallback((range2) => {
|
41023
|
+
const selection = getShadowRoot().getSelection();
|
41024
|
+
selection.removeAllRanges();
|
41025
|
+
const newRange = document.createRange();
|
41026
|
+
newRange.setStart(range2.startContainer, range2.startOffset);
|
41027
|
+
newRange.setEnd(range2.endContainer, range2.endOffset);
|
41028
|
+
selection.addRange(newRange);
|
41029
|
+
}, []);
|
41030
|
+
const execCommand = (cmd, val) => {
|
41031
|
+
if (!container2) {
|
41032
|
+
console.error("No container");
|
41033
|
+
return;
|
41034
|
+
}
|
41035
|
+
if (!selectionRange) {
|
41036
|
+
console.error("No selectionRange");
|
41037
|
+
return;
|
41038
|
+
}
|
41039
|
+
if (!(container2 == null ? void 0 : container2.contains(selectionRange == null ? void 0 : selectionRange.commonAncestorContainer)) && container2 !== (selectionRange == null ? void 0 : selectionRange.commonAncestorContainer)) {
|
41040
|
+
console.error("Not commonAncestorContainer");
|
41041
|
+
return;
|
41042
|
+
}
|
41043
|
+
restoreRange(selectionRange);
|
41044
|
+
if (cmd === "createLink") {
|
41045
|
+
const linkData = val;
|
41046
|
+
const target2 = linkData.blank ? "_blank" : "";
|
41047
|
+
let link;
|
41048
|
+
if (linkData.linkNode) {
|
41049
|
+
link = linkData.linkNode;
|
41050
|
+
} else {
|
41051
|
+
const uuid2 = (+new Date()).toString();
|
41052
|
+
document.execCommand(cmd, false, uuid2);
|
41053
|
+
link = getShadowRoot().querySelector(`a[href="${uuid2}"`);
|
41054
|
+
}
|
41055
|
+
if (target2) {
|
41056
|
+
link.setAttribute("target", target2);
|
41057
|
+
}
|
41058
|
+
link.style.color = "inherit";
|
41059
|
+
link.style.textDecoration = linkData.underline ? "underline" : "none";
|
41060
|
+
link.setAttribute("href", linkData.link);
|
41061
|
+
} else {
|
41062
|
+
document.execCommand(cmd, false, val);
|
41063
|
+
}
|
41064
|
+
const html = container2.innerHTML;
|
41065
|
+
props.onChange(html);
|
41066
|
+
};
|
41067
|
+
const getPopoverMountNode = () => document.getElementById(FIXED_CONTAINER_ID);
|
41068
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
41069
|
+
id: "Tools",
|
41070
|
+
style: { display: "flex", flexWrap: "nowrap" }
|
41071
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
41072
|
+
style: {
|
41073
|
+
display: "flex",
|
41074
|
+
alignItems: "center"
|
41075
|
+
}
|
41076
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
41077
|
+
className: "easy-email-extensions-divider"
|
41078
|
+
}), /* @__PURE__ */ React__default.createElement(Popover$1, {
|
41079
|
+
className: "easy-email-extensions-Tools-Popover",
|
41080
|
+
trigger: "click",
|
41081
|
+
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$1), /* @__PURE__ */ React__default.createElement(FontFamily$1, {
|
41082
|
+
onChange: (val) => execCommand("fontName", val)
|
41083
|
+
})),
|
41084
|
+
getPopupContainer: getPopoverMountNode
|
41085
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41086
|
+
title: "font family",
|
41087
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41088
|
+
iconName: "icon-font-family"
|
41089
|
+
})
|
41090
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
41091
|
+
className: "easy-email-extensions-divider"
|
41092
|
+
}), /* @__PURE__ */ React__default.createElement(Popover$1, {
|
41093
|
+
className: "easy-email-extensions-Tools-Popover",
|
41094
|
+
color: "#fff",
|
41095
|
+
trigger: "click",
|
41096
|
+
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$1), /* @__PURE__ */ React__default.createElement(FontSizeList, {
|
41097
|
+
onChange: (val) => execCommand("fontSize", val)
|
41098
|
+
})),
|
41099
|
+
getPopupContainer: getPopoverMountNode
|
41100
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41101
|
+
title: "line-height",
|
41102
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41103
|
+
iconName: "icon-line-height"
|
41104
|
+
})
|
41105
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
41106
|
+
className: "easy-email-extensions-divider"
|
41107
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41108
|
+
onClick: () => execCommand("bold"),
|
41109
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41110
|
+
iconName: "icon-bold"
|
41111
|
+
}),
|
41112
|
+
title: "Bold"
|
41113
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41114
|
+
className: "easy-email-extensions-divider"
|
41115
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41116
|
+
onClick: () => execCommand("italic"),
|
41117
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41118
|
+
iconName: "icon-italic"
|
41119
|
+
}),
|
41120
|
+
title: "Italic"
|
41121
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41122
|
+
className: "easy-email-extensions-divider"
|
41123
|
+
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
41124
|
+
label: "",
|
41125
|
+
position: "tl",
|
41126
|
+
onChange: (color) => execCommand("foreColor", color),
|
41127
|
+
getPopupContainer: getPopoverMountNode,
|
41128
|
+
showInput: false
|
41129
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41130
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41131
|
+
iconName: "icon-font-color"
|
41132
|
+
}),
|
41133
|
+
title: "Text color"
|
41134
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
41135
|
+
className: "easy-email-extensions-divider"
|
41136
|
+
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
41137
|
+
label: "",
|
41138
|
+
showInput: false,
|
41139
|
+
position: "tl",
|
41140
|
+
onChange: (color) => execCommand("hiliteColor", color),
|
41141
|
+
getPopupContainer: getPopoverMountNode
|
41142
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41143
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41144
|
+
iconName: "icon-bg-colors"
|
41145
|
+
}),
|
41146
|
+
title: "Background color"
|
41147
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
41148
|
+
className: "easy-email-extensions-divider"
|
41149
|
+
}), /* @__PURE__ */ React__default.createElement(Link$1, {
|
41150
|
+
currentRange: selectionRange,
|
41151
|
+
onChange: (values2) => execCommand("createLink", values2),
|
41152
|
+
getPopupContainer: getPopoverMountNode
|
41153
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41154
|
+
className: "easy-email-extensions-divider"
|
41155
|
+
}), mergeTags2 && /* @__PURE__ */ React__default.createElement(Popover$1, {
|
41156
|
+
trigger: "click",
|
41157
|
+
color: "#fff",
|
41158
|
+
position: "bottom",
|
41159
|
+
content: /* @__PURE__ */ React__default.createElement(MergeTags, {
|
41160
|
+
value: "",
|
41161
|
+
onChange: (val) => execCommand("insertHTML", val)
|
41162
|
+
}),
|
41163
|
+
getPopupContainer: getPopoverMountNode
|
41164
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41165
|
+
title: "Merge tag",
|
41166
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41167
|
+
iconName: "icon-merge-tags"
|
41168
|
+
})
|
41169
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
41170
|
+
className: "easy-email-extensions-divider"
|
41171
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41172
|
+
onClick: () => execCommand("justifyLeft"),
|
41173
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41174
|
+
iconName: "icon-align-left"
|
41175
|
+
}),
|
41176
|
+
title: "Align left"
|
41177
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41178
|
+
onClick: () => execCommand("justifyCenter"),
|
41179
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41180
|
+
iconName: "icon-align-center"
|
41181
|
+
}),
|
41182
|
+
title: "Align center"
|
41183
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41184
|
+
onClick: () => execCommand("justifyRight"),
|
41185
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41186
|
+
iconName: "icon-align-right"
|
41187
|
+
}),
|
41188
|
+
title: "Align right"
|
41189
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41190
|
+
className: "easy-email-extensions-divider"
|
41191
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41192
|
+
onClick: () => execCommand("insertOrderedList"),
|
41193
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41194
|
+
iconName: "icon-list-ol"
|
41195
|
+
}),
|
41196
|
+
title: "Orderlist"
|
41197
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41198
|
+
onClick: () => execCommand("insertUnorderedList"),
|
41199
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41200
|
+
iconName: "icon-list-ul"
|
41201
|
+
}),
|
41202
|
+
title: "Unorderlist"
|
41203
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41204
|
+
className: "easy-email-extensions-divider"
|
41205
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41206
|
+
onClick: () => execCommand("strikeThrough"),
|
41207
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41208
|
+
iconName: "icon-strikethrough"
|
41209
|
+
}),
|
41210
|
+
title: "StrikethroughOutlined"
|
41211
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41212
|
+
onClick: () => execCommand("underline"),
|
41213
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41214
|
+
iconName: "icon-underline"
|
41215
|
+
}),
|
41216
|
+
title: "UnderlineOutlined"
|
41217
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41218
|
+
onClick: () => execCommand("insertHorizontalRule"),
|
41219
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41220
|
+
iconName: "icon-line"
|
41221
|
+
}),
|
41222
|
+
title: "Line"
|
41223
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41224
|
+
className: "easy-email-extensions-divider"
|
41225
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41226
|
+
onClick: () => execCommand("removeFormat"),
|
41227
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41228
|
+
iconName: "icon-close"
|
41229
|
+
}),
|
41230
|
+
title: "Remove format"
|
41231
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41232
|
+
className: "easy-email-extensions-divider"
|
41233
|
+
})));
|
41234
|
+
}
|
41235
|
+
var styleText = ".easy-email-extensions-emailToolItem{display:inline-flex;position:relative;outline:none;font-weight:400;appearance:none;cursor:pointer!important;white-space:nowrap;transition:all .1s linear;box-sizing:border-box;line-height:1.5715;border:none;background-color:transparent;color:#fff}.easy-email-extensions-divider{position:relative;display:inline-flex;width:1px;height:16px;background-color:#808080e6}\n";
|
41236
|
+
function RichTextToolBar() {
|
41237
|
+
const [direction, setDirection] = useState("top");
|
41238
|
+
const [blockNode, setBlockNode] = useState(null);
|
41239
|
+
const [offsetX, setOffsetX] = useState(0);
|
41240
|
+
const { focusBlock: focusBlock2 } = useBlock();
|
41241
|
+
const { pageData: pageData2 } = useEditorContext();
|
41242
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
41243
|
+
const pageWidth = +(pageData2.attributes.width || "600").replace("px", "");
|
41244
|
+
useEffect(() => {
|
41245
|
+
const promiseObj = awaitForElement(focusIdx2);
|
41246
|
+
promiseObj.promise.then((blockNode2) => {
|
41247
|
+
setBlockNode(blockNode2);
|
41248
|
+
});
|
41249
|
+
return () => {
|
41250
|
+
promiseObj.cancel();
|
41251
|
+
};
|
41252
|
+
}, [focusIdx2, focusBlock2]);
|
41253
|
+
useEffect(() => {
|
41254
|
+
if (blockNode) {
|
41255
|
+
const options2 = {
|
41256
|
+
rootMargin: "-84px 0px 0px 0px",
|
41257
|
+
root: getShadowRoot().firstChild,
|
41258
|
+
threshold: [0, 1e-3, 0.1, 0.999, 0.8, 0.9, 1]
|
41259
|
+
};
|
41260
|
+
const checkDirection = (ev) => {
|
41261
|
+
const [current] = ev;
|
41262
|
+
const { top } = current.intersectionRect;
|
41263
|
+
const boundingClientRect = current.boundingClientRect;
|
41264
|
+
const rootBounds = current.rootBounds;
|
41265
|
+
const intersectionRatio = current.intersectionRatio;
|
41266
|
+
if (!rootBounds)
|
41267
|
+
return;
|
41268
|
+
const paddingLeft = (rootBounds.width - pageWidth) / 2;
|
41269
|
+
const offsetLeft = boundingClientRect.left - rootBounds.left;
|
41270
|
+
setOffsetX(paddingLeft - offsetLeft);
|
41271
|
+
if (intersectionRatio === 1) {
|
41272
|
+
setDirection("top");
|
41273
|
+
} else {
|
41274
|
+
if (top) {
|
41275
|
+
if (top > rootBounds.top) {
|
41276
|
+
setDirection("top");
|
41277
|
+
} else {
|
41278
|
+
setDirection("bottom");
|
41279
|
+
}
|
41280
|
+
} else {
|
41281
|
+
setDirection("bottom");
|
41282
|
+
}
|
41283
|
+
}
|
41284
|
+
};
|
41285
|
+
const observer = new IntersectionObserver(checkDirection, options2);
|
41286
|
+
observer.observe(blockNode);
|
41287
|
+
return () => {
|
41288
|
+
observer.unobserve(blockNode);
|
41289
|
+
};
|
41290
|
+
}
|
41291
|
+
}, [blockNode, pageWidth]);
|
41292
|
+
if (!blockNode)
|
41293
|
+
return null;
|
41294
|
+
const editorContainer = blockNode && getEditNode(blockNode);
|
41295
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, createPortal(/* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", {
|
41296
|
+
dangerouslySetInnerHTML: { __html: styleText }
|
41297
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41298
|
+
style: {
|
41299
|
+
transform: direction === "top" ? "translate(0,-100%)" : void 0,
|
41300
|
+
padding: "4px 8px",
|
41301
|
+
boxSizing: "border-box",
|
41302
|
+
position: "absolute",
|
41303
|
+
zIndex: 100,
|
41304
|
+
top: direction === "top" ? -40 : "calc(100% + 40px)",
|
41305
|
+
left: offsetX,
|
41306
|
+
width: pageWidth
|
41307
|
+
}
|
41308
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
41309
|
+
style: {
|
41310
|
+
position: "absolute",
|
41311
|
+
backgroundColor: "#41444d",
|
41312
|
+
height: "100%",
|
41313
|
+
width: "100%",
|
41314
|
+
left: 0,
|
41315
|
+
top: 0
|
41316
|
+
}
|
41317
|
+
}), /* @__PURE__ */ React__default.createElement(Tools, {
|
41318
|
+
container: editorContainer,
|
41319
|
+
onChange: () => {
|
41320
|
+
}
|
41321
|
+
}))), blockNode));
|
41322
|
+
}
|
41323
|
+
const RichTextField = (props) => {
|
41324
|
+
const { focusBlock: focusBlock2 } = useBlock();
|
41325
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
41326
|
+
if ((focusBlock2 == null ? void 0 : focusBlock2.type) !== BasicType.TEXT)
|
41327
|
+
return null;
|
41328
|
+
const name = `${focusIdx2}.data.value.content`;
|
41329
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(RichTextToolBar, null), /* @__PURE__ */ React__default.createElement(Field, {
|
41330
|
+
name,
|
41331
|
+
parse: (v) => v
|
41332
|
+
}, ({ input }) => /* @__PURE__ */ React__default.createElement(FieldWrapper, __spreadProps(__spreadValues({}, props), {
|
41333
|
+
input
|
41334
|
+
}))));
|
41335
|
+
};
|
41336
|
+
function FieldWrapper(props) {
|
41337
|
+
const _a = props, { input } = _a, rest = __objRest(_a, ["input"]);
|
41338
|
+
const debounceCallbackChange = useCallback(lodash.exports.debounce((val) => {
|
41339
|
+
input.onChange(val);
|
41340
|
+
}, 500), [input]);
|
41341
|
+
return /* @__PURE__ */ React__default.createElement(InlineText, __spreadProps(__spreadValues({}, rest), {
|
41342
|
+
onChange: debounceCallbackChange
|
41343
|
+
}));
|
41344
|
+
}
|
41345
|
+
const TextField = enhancer(Input, (value) => value);
|
41346
|
+
const SearchField = enhancer(Input$5.Search, (val) => val);
|
41347
|
+
const TextAreaField = enhancer(Input$5.TextArea, (val) => val);
|
41348
|
+
const NumberField = enhancer(InputNumber$1, (e) => e);
|
41349
|
+
const SliderField = enhancer(Slider$2, (e) => e);
|
41350
|
+
const ColorPickerField = enhancer(ColorPicker, (e) => e);
|
41351
|
+
const UploadField = enhancer(UploadField$1, (val) => val);
|
41352
|
+
const ImageUploaderField = enhancer(ImageUploader, (url) => url);
|
41353
|
+
const SelectField = enhancer(Select, (e) => e);
|
41354
|
+
const TreeSelectField = enhancer(TreeSelect$1, (e) => e);
|
41355
|
+
const AutoCompleteField = enhancer(AutoComplete, (e) => e);
|
41356
|
+
const RadioGroupField = enhancer(RadioGroup, (value) => value);
|
41357
|
+
const SwitchField = enhancer(Switch$1, (e) => e);
|
41358
|
+
const DatePickerField = enhancer(DatePicker$1, (date) => date);
|
41359
|
+
const CheckboxField = enhancer(CheckBoxGroup, (e) => e);
|
41360
|
+
const EditTabField = enhancer(EditTab, (e) => e);
|
41361
|
+
const InlineTextField = enhancer(InlineText, (value) => value);
|
41362
|
+
const AddToCollection = ({ visible, setVisible }) => {
|
41363
|
+
const { focusBlock: focusBlockData } = useBlock();
|
41364
|
+
const { onAddCollection, onUploadImage } = useEditorProps();
|
41365
|
+
const onSubmit = (values2) => {
|
41366
|
+
if (!values2.label)
|
41367
|
+
return;
|
41368
|
+
const uuid2 = uuid_1.v4();
|
41369
|
+
onAddCollection == null ? void 0 : onAddCollection({
|
41370
|
+
label: values2.label,
|
41371
|
+
helpText: values2.helpText,
|
41372
|
+
data: focusBlockData,
|
41373
|
+
thumbnail: values2.thumbnail,
|
41374
|
+
id: uuid2
|
41375
|
+
});
|
41376
|
+
setVisible(false);
|
41377
|
+
};
|
41378
|
+
return /* @__PURE__ */ React__default.createElement(Form$3, {
|
41379
|
+
initialValues: { label: "", helpText: "", thumbnail: "" },
|
41380
|
+
onSubmit
|
41381
|
+
}, ({ handleSubmit }) => /* @__PURE__ */ React__default.createElement(Modal$1, {
|
41382
|
+
maskClosable: false,
|
41383
|
+
style: { zIndex: 2e3 },
|
41384
|
+
visible,
|
41385
|
+
title: "Add to collection",
|
41386
|
+
onOk: () => handleSubmit(),
|
41387
|
+
onCancel: () => setVisible(false)
|
41388
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
41389
|
+
vertical: true
|
41390
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, null), /* @__PURE__ */ React__default.createElement(TextField, {
|
41391
|
+
label: "Title",
|
41392
|
+
name: "label",
|
41393
|
+
validate: (val) => {
|
41394
|
+
if (!val)
|
41395
|
+
return "Title required!";
|
41396
|
+
return void 0;
|
41397
|
+
}
|
41398
|
+
}), /* @__PURE__ */ React__default.createElement(TextAreaField, {
|
41399
|
+
label: "Description",
|
41400
|
+
name: "helpText"
|
41401
|
+
}), /* @__PURE__ */ React__default.createElement(ImageUploaderField, {
|
41402
|
+
label: "Thumbnail",
|
41403
|
+
name: "thumbnail",
|
41404
|
+
uploadHandler: onUploadImage,
|
41405
|
+
validate: (val) => {
|
41406
|
+
if (!val)
|
41407
|
+
return "Thumbnail required!";
|
41408
|
+
return void 0;
|
41409
|
+
}
|
41410
|
+
}))));
|
41687
41411
|
};
|
41688
|
-
|
41689
|
-
|
41690
|
-
|
41691
|
-
|
41412
|
+
function useAddToCollection() {
|
41413
|
+
const [modalVisible, setModalVisible] = useState(false);
|
41414
|
+
const modal = useMemo(() => /* @__PURE__ */ React__default.createElement(AddToCollection, {
|
41415
|
+
visible: modalVisible,
|
41416
|
+
setVisible: setModalVisible
|
41417
|
+
}), [modalVisible]);
|
41418
|
+
return {
|
41419
|
+
modal,
|
41420
|
+
modalVisible,
|
41421
|
+
setModalVisible
|
41422
|
+
};
|
41423
|
+
}
|
41424
|
+
function ContextMenu({
|
41425
|
+
moveBlock,
|
41426
|
+
copyBlock,
|
41427
|
+
removeBlock,
|
41428
|
+
contextMenuData,
|
41429
|
+
onClose
|
41430
|
+
}) {
|
41431
|
+
const { blockData, left, top } = contextMenuData;
|
41432
|
+
const idx = blockData.id;
|
41433
|
+
const { modal, modalVisible, setModalVisible } = useAddToCollection();
|
41434
|
+
const ref = useRef(null);
|
41435
|
+
const handleMoveUp = () => {
|
41436
|
+
moveBlock(idx, getSiblingIdx(idx, -1));
|
41437
|
+
scrollBlockEleIntoView({
|
41438
|
+
idx: getSiblingIdx(idx, -1)
|
41692
41439
|
});
|
41440
|
+
onClose();
|
41441
|
+
};
|
41442
|
+
const handleMoveDown = () => {
|
41443
|
+
moveBlock(idx, getSiblingIdx(idx, 1));
|
41444
|
+
scrollBlockEleIntoView({
|
41445
|
+
idx: getSiblingIdx(idx, 1)
|
41446
|
+
});
|
41447
|
+
onClose();
|
41448
|
+
};
|
41449
|
+
const handleCopy = (ev) => {
|
41450
|
+
copyBlock(idx);
|
41451
|
+
scrollBlockEleIntoView({
|
41452
|
+
idx: getSiblingIdx(idx, 1)
|
41453
|
+
});
|
41454
|
+
onClose();
|
41455
|
+
};
|
41456
|
+
const handleAddToCollection = () => {
|
41457
|
+
setModalVisible(true);
|
41458
|
+
};
|
41459
|
+
const handleDelete = () => {
|
41460
|
+
removeBlock(idx);
|
41461
|
+
onClose();
|
41462
|
+
};
|
41463
|
+
const isFirst = getIndexByIdx(idx) === 0;
|
41464
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
41465
|
+
ref,
|
41466
|
+
style: { visibility: modalVisible ? "hidden" : void 0 }
|
41467
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
41468
|
+
style: {
|
41469
|
+
left,
|
41470
|
+
top
|
41471
|
+
},
|
41472
|
+
className: styles$5.wrap,
|
41473
|
+
onClick: (e) => e.stopPropagation()
|
41474
|
+
}, !isFirst && /* @__PURE__ */ React__default.createElement("div", {
|
41475
|
+
className: styles$5.listItem,
|
41476
|
+
onClick: handleMoveUp
|
41477
|
+
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
41478
|
+
iconName: "icon-top",
|
41479
|
+
style: { marginRight: 10 }
|
41480
|
+
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Move up")), /* @__PURE__ */ React__default.createElement("div", {
|
41481
|
+
className: styles$5.listItem,
|
41482
|
+
onClick: handleMoveDown
|
41483
|
+
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
41484
|
+
iconName: "icon-bottom",
|
41485
|
+
style: { marginRight: 10 }
|
41486
|
+
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Move down")), /* @__PURE__ */ React__default.createElement("div", {
|
41487
|
+
className: styles$5.listItem,
|
41488
|
+
onClick: handleCopy
|
41489
|
+
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
41490
|
+
iconName: "icon-copy",
|
41491
|
+
style: { marginRight: 10 }
|
41492
|
+
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Copy")), /* @__PURE__ */ React__default.createElement("div", {
|
41493
|
+
className: styles$5.listItem,
|
41494
|
+
onClick: handleAddToCollection
|
41495
|
+
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
41496
|
+
iconName: "icon-start",
|
41497
|
+
style: { marginRight: 10 }
|
41498
|
+
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Add to collection")), /* @__PURE__ */ React__default.createElement("div", {
|
41499
|
+
className: styles$5.listItem,
|
41500
|
+
onClick: handleDelete
|
41501
|
+
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
41502
|
+
iconName: "icon-delete",
|
41503
|
+
style: { marginRight: 10 }
|
41504
|
+
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Delete")), /* @__PURE__ */ React__default.createElement("div", {
|
41505
|
+
className: styles$5.listItem,
|
41506
|
+
onClick: handleAddToCollection
|
41507
|
+
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
41508
|
+
iconName: "icon-start",
|
41509
|
+
style: { marginRight: 10 }
|
41510
|
+
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Add to collection"))), /* @__PURE__ */ React__default.createElement("div", {
|
41511
|
+
className: styles$5.contextmenuMark,
|
41512
|
+
onClick: onClose,
|
41513
|
+
onContextMenu: (e) => {
|
41514
|
+
e.preventDefault();
|
41515
|
+
onClose(e);
|
41516
|
+
}
|
41517
|
+
}), modal);
|
41518
|
+
}
|
41519
|
+
function useAvatarWrapperDrop() {
|
41520
|
+
const [blockLayerRef, setBlockLayerRef] = useState(null);
|
41521
|
+
const { setHoverIdx, setDirection } = useHoverIdx();
|
41522
|
+
const { dataTransfer, setDataTransfer } = useDataTransfer();
|
41523
|
+
const {
|
41524
|
+
formState: { values: values2 }
|
41525
|
+
} = useEditorContext();
|
41526
|
+
const valuesRef = useRef(values2);
|
41527
|
+
const dataTransferRef = useRef(dataTransfer);
|
41528
|
+
useEffect(() => {
|
41529
|
+
valuesRef.current = values2;
|
41530
|
+
}, [values2]);
|
41531
|
+
useEffect(() => {
|
41532
|
+
dataTransferRef.current = dataTransfer;
|
41533
|
+
}, [dataTransfer]);
|
41534
|
+
function isKeyObject(o) {
|
41535
|
+
return o.key !== void 0;
|
41693
41536
|
}
|
41694
|
-
|
41695
|
-
|
41696
|
-
|
41697
|
-
|
41698
|
-
|
41699
|
-
|
41537
|
+
const removeHightLightClassName = useCallback(() => {
|
41538
|
+
if (!blockLayerRef)
|
41539
|
+
return;
|
41540
|
+
blockLayerRef.querySelectorAll(".arco-tree-node-title-gap-top, .arco-tree-node-title-gap-bottom, .arco-tree-node-title-highlight").forEach((item2) => {
|
41541
|
+
item2.classList.remove("arco-tree-node-title-gap-top", "arco-tree-node-title-gap-bottom", "arco-tree-node-title-highlight");
|
41542
|
+
});
|
41543
|
+
}, [blockLayerRef]);
|
41544
|
+
const allowDrop = useCallback((params) => {
|
41545
|
+
const { dragNode, dropNode, dropPosition } = params;
|
41546
|
+
let dragType;
|
41547
|
+
if (isKeyObject(dragNode)) {
|
41548
|
+
const blockData = lodash.exports.get(valuesRef.current, dragNode.key);
|
41549
|
+
if (!blockData)
|
41550
|
+
return false;
|
41551
|
+
dragType = blockData.type;
|
41552
|
+
} else {
|
41553
|
+
dragType = dragNode.type;
|
41554
|
+
}
|
41555
|
+
const dragBlock = BlockManager.getBlockByType(dragType);
|
41556
|
+
if (!dragBlock)
|
41557
|
+
return false;
|
41558
|
+
if (dropPosition === 0) {
|
41559
|
+
if (dragBlock.validParentType.includes(dropNode.dataRef.type) && dropNode.dataRef.children.length === 0) {
|
41560
|
+
return {
|
41561
|
+
position: 0,
|
41562
|
+
key: dropNode.key
|
41563
|
+
};
|
41564
|
+
} else if (dropNode.parent && dragBlock.validParentType.includes(dropNode.parent.type)) {
|
41565
|
+
return {
|
41566
|
+
position: -1,
|
41567
|
+
key: dropNode.key
|
41568
|
+
};
|
41569
|
+
}
|
41570
|
+
} else {
|
41571
|
+
if (dropNode.parent && dragBlock.validParentType.includes(dropNode.parent.type)) {
|
41572
|
+
return {
|
41573
|
+
position: dropPosition,
|
41574
|
+
key: dropNode.key
|
41575
|
+
};
|
41576
|
+
}
|
41577
|
+
}
|
41578
|
+
setDirection("");
|
41579
|
+
setHoverIdx("");
|
41580
|
+
return false;
|
41581
|
+
}, [setDirection, setHoverIdx, removeHightLightClassName]);
|
41582
|
+
useEffect(() => {
|
41583
|
+
if (blockLayerRef) {
|
41584
|
+
const onDragOver = lodash.exports.debounce((ev) => {
|
41585
|
+
var _a, _b, _c, _d;
|
41586
|
+
if (!dataTransferRef.current)
|
41587
|
+
return;
|
41588
|
+
const blockNode = getBlockNodeByChildEle(ev.target);
|
41589
|
+
if (!blockNode || !ev.target)
|
41590
|
+
return;
|
41591
|
+
const directionPosition = getDirectionPosition(ev, 5);
|
41592
|
+
const treeNodeEle = (_b = (_a = blockNode.parentNode) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.parentNode;
|
41593
|
+
if (!treeNodeEle)
|
41594
|
+
return;
|
41595
|
+
removeHightLightClassName();
|
41596
|
+
const dropIdx = getNodeIdxFromClassName(blockNode.classList);
|
41597
|
+
if (!dropIdx)
|
41598
|
+
return;
|
41599
|
+
const dropParentIdx = getParentIdx(dropIdx);
|
41600
|
+
const dropBlockData = lodash.exports.get(valuesRef.current, dropIdx);
|
41601
|
+
const dropParentBlockData = dropParentIdx ? lodash.exports.get(valuesRef.current, dropParentIdx) : null;
|
41602
|
+
let dropPosition = 0;
|
41603
|
+
if (directionPosition.vertical.direction === "top" && directionPosition.vertical.isEdge) {
|
41604
|
+
dropPosition = -1;
|
41605
|
+
} else if (directionPosition.vertical.direction === "bottom" && directionPosition.vertical.isEdge) {
|
41606
|
+
dropPosition = 1;
|
41607
|
+
}
|
41608
|
+
const dropResult = allowDrop({
|
41609
|
+
dragNode: {
|
41610
|
+
type: dataTransferRef.current.type
|
41611
|
+
},
|
41612
|
+
dropNode: {
|
41613
|
+
dataRef: dropBlockData,
|
41614
|
+
key: dropIdx,
|
41615
|
+
parent: dropParentBlockData
|
41616
|
+
},
|
41617
|
+
dropPosition
|
41618
|
+
});
|
41619
|
+
if (!dropResult)
|
41620
|
+
return;
|
41621
|
+
const node = (_d = (_c = document.querySelector(`[data-tree-idx="${dropResult.key}"]`)) == null ? void 0 : _c.parentNode) == null ? void 0 : _d.parentNode;
|
41622
|
+
if (node instanceof HTMLElement) {
|
41623
|
+
removeHightLightClassName();
|
41624
|
+
node.classList.add("arco-tree-node-title-gap-bottom");
|
41625
|
+
}
|
41626
|
+
setDirection(getDirectionFormDropPosition(dropResult.position));
|
41627
|
+
setHoverIdx(dropResult.key);
|
41628
|
+
if (dropResult.position === -1) {
|
41629
|
+
treeNodeEle.classList.add("arco-tree-node-title-gap-top");
|
41630
|
+
setDataTransfer((dataTransfer2) => {
|
41631
|
+
return __spreadProps(__spreadValues({}, dataTransfer2), {
|
41632
|
+
parentIdx: dropParentIdx,
|
41633
|
+
positionIndex: getIndexByIdx(dropIdx)
|
41634
|
+
});
|
41635
|
+
});
|
41636
|
+
} else if (dropResult.position === 1) {
|
41637
|
+
setDataTransfer((dataTransfer2) => {
|
41638
|
+
return __spreadProps(__spreadValues({}, dataTransfer2), {
|
41639
|
+
parentIdx: dropParentIdx,
|
41640
|
+
positionIndex: getIndexByIdx(dropIdx) + 1
|
41641
|
+
});
|
41642
|
+
});
|
41643
|
+
treeNodeEle.classList.add("arco-tree-node-title-gap-bottom");
|
41644
|
+
} else {
|
41645
|
+
treeNodeEle.classList.add("arco-tree-node-title-highlight");
|
41646
|
+
setDataTransfer((dataTransfer2) => {
|
41647
|
+
return __spreadProps(__spreadValues({}, dataTransfer2), {
|
41648
|
+
parentIdx: getIndexByIdx(dropIdx),
|
41649
|
+
positionIndex: 0
|
41650
|
+
});
|
41651
|
+
});
|
41652
|
+
}
|
41653
|
+
});
|
41654
|
+
const onDragend = (ev) => {
|
41655
|
+
removeHightLightClassName();
|
41656
|
+
};
|
41657
|
+
const onDrop = (ev) => {
|
41658
|
+
setTimeout(() => {
|
41659
|
+
removeHightLightClassName();
|
41660
|
+
}, 0);
|
41661
|
+
};
|
41662
|
+
blockLayerRef.addEventListener("dragover", onDragOver);
|
41663
|
+
blockLayerRef.addEventListener("drop", onDrop);
|
41664
|
+
blockLayerRef.addEventListener("dragleave", onDragend);
|
41665
|
+
return () => {
|
41666
|
+
blockLayerRef.removeEventListener("dragover", onDragOver);
|
41667
|
+
blockLayerRef.removeEventListener("drop", onDrop);
|
41668
|
+
blockLayerRef.removeEventListener("dragleave", onDragend);
|
41669
|
+
};
|
41670
|
+
}
|
41671
|
+
}, [blockLayerRef, dataTransferRef, valuesRef, removeHightLightClassName]);
|
41672
|
+
return {
|
41673
|
+
setBlockLayerRef,
|
41674
|
+
blockLayerRef,
|
41675
|
+
allowDrop,
|
41676
|
+
removeHightLightClassName
|
41677
|
+
};
|
41700
41678
|
}
|
41701
|
-
|
41702
|
-
|
41703
|
-
|
41704
|
-
|
41705
|
-
|
41706
|
-
|
41707
|
-
const Com = focusBlock2 && BlockAttributeConfigurationManager.get(focusBlock2.type);
|
41708
|
-
const shadowRoot = getShadowRoot();
|
41709
|
-
if (!value || !initialized)
|
41710
|
-
return null;
|
41711
|
-
return /* @__PURE__ */ React__default.createElement(PresetColorsProvider, null, Com ? /* @__PURE__ */ React__default.createElement(Com, null) : /* @__PURE__ */ React__default.createElement("div", {
|
41712
|
-
style: { marginTop: 200, padding: "0 50px" }
|
41713
|
-
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
41714
|
-
size: "extraLarge"
|
41715
|
-
}, "No matching components")), /* @__PURE__ */ React__default.createElement("div", {
|
41716
|
-
style: { position: "absolute" }
|
41717
|
-
}, /* @__PURE__ */ React__default.createElement(RichTextField, {
|
41718
|
-
idx: focusIdx2
|
41719
|
-
})), shadowRoot && ReactDOM.createPortal(/* @__PURE__ */ React__default.createElement("style", null, `
|
41720
|
-
.email-block [contentEditable="true"],
|
41721
|
-
.email-block [contentEditable="true"] * {
|
41722
|
-
outline: none;
|
41723
|
-
cursor: text;
|
41724
|
-
}
|
41725
|
-
`), shadowRoot));
|
41679
|
+
function getDirectionFormDropPosition(position) {
|
41680
|
+
if (position === -1)
|
41681
|
+
return "top";
|
41682
|
+
if (position === 1)
|
41683
|
+
return "bottom";
|
41684
|
+
return "";
|
41726
41685
|
}
|
41727
|
-
function
|
41728
|
-
const {
|
41729
|
-
|
41730
|
-
|
41731
|
-
|
41732
|
-
|
41733
|
-
|
41686
|
+
function BlockLayer() {
|
41687
|
+
const { pageData: pageData2 } = useEditorContext();
|
41688
|
+
const { focusIdx: focusIdx2, setFocusIdx } = useFocusIdx();
|
41689
|
+
const { setHoverIdx, setIsDragging, setDirection } = useHoverIdx();
|
41690
|
+
const { moveBlock, setValueByIdx: setValueByIdx2, copyBlock, removeBlock, values: values2 } = useBlock();
|
41691
|
+
const {
|
41692
|
+
setBlockLayerRef,
|
41693
|
+
allowDrop,
|
41694
|
+
blockLayerRef,
|
41695
|
+
removeHightLightClassName
|
41696
|
+
} = useAvatarWrapperDrop();
|
41697
|
+
const valueRef = useRef(values2);
|
41698
|
+
useEffect(() => {
|
41699
|
+
valueRef.current = values2;
|
41700
|
+
}, [values2]);
|
41701
|
+
const [contextMenuData, setContextMenuData] = useState(null);
|
41702
|
+
const onToggleVisible = useCallback(({ id }, e) => {
|
41703
|
+
e.stopPropagation();
|
41704
|
+
const blockData = lodash.exports.get(valueRef.current, id);
|
41705
|
+
if (blockData) {
|
41706
|
+
blockData.data.hidden = !Boolean(blockData.data.hidden);
|
41707
|
+
setValueByIdx2(id, blockData);
|
41708
|
+
}
|
41709
|
+
}, [setValueByIdx2]);
|
41710
|
+
const renderTitle = useCallback((data) => {
|
41711
|
+
const block2 = BlockManager.getBlockByType(data.type);
|
41712
|
+
const isPage = data.type === BasicType.PAGE;
|
41713
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
41714
|
+
"data-tree-idx": data.id,
|
41715
|
+
className: classnames(styles$6.title, !isPage && getNodeIdxClassName(data.id), !isPage && "email-block")
|
41734
41716
|
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
41735
|
-
|
41736
|
-
|
41737
|
-
|
41738
|
-
|
41739
|
-
|
41740
|
-
|
41741
|
-
})
|
41742
|
-
|
41743
|
-
|
41744
|
-
|
41745
|
-
|
41746
|
-
|
41747
|
-
|
41748
|
-
|
41749
|
-
|
41750
|
-
|
41751
|
-
|
41752
|
-
|
41753
|
-
|
41754
|
-
|
41755
|
-
|
41756
|
-
}
|
41757
|
-
const
|
41758
|
-
|
41759
|
-
|
41760
|
-
|
41761
|
-
|
41762
|
-
|
41763
|
-
|
41764
|
-
|
41765
|
-
|
41766
|
-
];
|
41767
|
-
|
41768
|
-
|
41769
|
-
|
41770
|
-
|
41771
|
-
|
41772
|
-
|
41773
|
-
|
41774
|
-
|
41775
|
-
|
41717
|
+
size: "smallest"
|
41718
|
+
}, block2 == null ? void 0 : block2.name), /* @__PURE__ */ React__default.createElement("div", {
|
41719
|
+
className: styles$6.eyeIcon
|
41720
|
+
}, /* @__PURE__ */ React__default.createElement(EyeIcon$1, {
|
41721
|
+
blockData: data,
|
41722
|
+
onToggleVisible
|
41723
|
+
})));
|
41724
|
+
}, [onToggleVisible]);
|
41725
|
+
const treeData = useMemo(() => {
|
41726
|
+
const copyData = lodash.exports.cloneDeep(pageData2);
|
41727
|
+
const loop2 = (item2, id, parent2) => {
|
41728
|
+
item2.id = id;
|
41729
|
+
item2.parent = parent2;
|
41730
|
+
item2.children.map((child, index2) => loop2(child, getChildIdx(id, index2), item2));
|
41731
|
+
};
|
41732
|
+
loop2(copyData, getPageIdx(), null);
|
41733
|
+
return [copyData];
|
41734
|
+
}, [pageData2]);
|
41735
|
+
const onSelect = useCallback((selectedId) => {
|
41736
|
+
setFocusIdx(selectedId);
|
41737
|
+
scrollBlockEleIntoView({ idx: selectedId });
|
41738
|
+
}, [setFocusIdx]);
|
41739
|
+
const onContextMenu = useCallback((blockData, ev) => {
|
41740
|
+
ev.preventDefault();
|
41741
|
+
setContextMenuData({ blockData, left: ev.clientX, top: ev.clientY });
|
41742
|
+
}, []);
|
41743
|
+
const onCloseContextMenu = useCallback((ev) => {
|
41744
|
+
setContextMenuData(null);
|
41745
|
+
}, []);
|
41746
|
+
const onMouseEnter = useCallback((id) => {
|
41747
|
+
setHoverIdx(id);
|
41748
|
+
}, [setHoverIdx]);
|
41749
|
+
const onMouseLeave = useCallback(() => {
|
41750
|
+
setHoverIdx("");
|
41751
|
+
}, [setHoverIdx]);
|
41752
|
+
const onDragStart = useCallback(() => {
|
41753
|
+
setIsDragging(true);
|
41754
|
+
}, [setIsDragging]);
|
41755
|
+
const onDragEnd = useCallback(() => {
|
41756
|
+
setIsDragging(false);
|
41757
|
+
}, [setIsDragging]);
|
41758
|
+
const onDrop = useCallback((params) => {
|
41759
|
+
const { dragNode, dropNode, dropPosition } = params;
|
41760
|
+
const dragBlock = BlockManager.getBlockByType(dragNode.dataRef.type);
|
41761
|
+
if (!dragBlock)
|
41762
|
+
return false;
|
41763
|
+
const dropIndex = getIndexByIdx(dropNode.key);
|
41764
|
+
if (dropPosition === 0) {
|
41765
|
+
if (dragBlock.validParentType.includes(dropNode.dataRef.type) && dropNode.dataRef.children.length === 0) {
|
41766
|
+
moveBlock(dragNode.key, getChildIdx(dropNode.key, 0));
|
41767
|
+
} else if (dropNode.parent && dragBlock.validParentType.includes(dropNode.parent.type)) {
|
41768
|
+
moveBlock(dragNode.key, getChildIdx(dropNode.parentKey, dropIndex));
|
41769
|
+
}
|
41770
|
+
} else {
|
41771
|
+
moveBlock(dragNode.key, getChildIdx(dropNode.parentKey, dropPosition > 0 ? dropIndex + 1 : dropIndex));
|
41772
|
+
}
|
41773
|
+
}, [moveBlock]);
|
41774
|
+
useEffect(() => {
|
41775
|
+
if (!blockLayerRef)
|
41776
|
+
return;
|
41777
|
+
if (focusIdx2) {
|
41778
|
+
setTimeout(() => {
|
41779
|
+
const selectedNode = blockLayerRef.querySelector(`[${DATA_ATTRIBUTE_ID}="${focusIdx2}"]`);
|
41780
|
+
if (selectedNode) {
|
41781
|
+
selectedNode.scrollIntoView({
|
41782
|
+
block: "center",
|
41783
|
+
behavior: "smooth"
|
41784
|
+
});
|
41785
|
+
}
|
41786
|
+
}, 50);
|
41787
|
+
}
|
41788
|
+
}, [blockLayerRef, focusIdx2]);
|
41789
|
+
const blockTreeAllowDrop = useCallback((data) => {
|
41790
|
+
var _a, _b;
|
41791
|
+
const dropResult = allowDrop(data);
|
41792
|
+
if (dropResult) {
|
41793
|
+
const node = (_b = (_a = document.querySelector(`[data-tree-idx="${dropResult.key}"]`)) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.parentNode;
|
41794
|
+
if (node instanceof HTMLElement) {
|
41795
|
+
removeHightLightClassName();
|
41796
|
+
node.classList.add("arco-tree-node-title-gap-bottom");
|
41797
|
+
}
|
41798
|
+
setDirection(getDirectionFormDropPosition(dropResult.position));
|
41799
|
+
setHoverIdx(dropResult.key);
|
41800
|
+
}
|
41801
|
+
return dropResult;
|
41802
|
+
}, [allowDrop]);
|
41803
|
+
const selectedKeys = useMemo(() => {
|
41804
|
+
if (!focusIdx2)
|
41805
|
+
return [];
|
41806
|
+
return [focusIdx2];
|
41776
41807
|
}, [focusIdx2]);
|
41777
|
-
|
41778
|
-
|
41779
|
-
|
41780
|
-
|
41781
|
-
|
41782
|
-
|
41783
|
-
|
41784
|
-
|
41785
|
-
|
41786
|
-
|
41787
|
-
wrap: false
|
41788
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
41789
|
-
fill: true
|
41790
|
-
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
41791
|
-
label: "Top",
|
41792
|
-
quickchange: true,
|
41793
|
-
name: `${focusIdx2}.attributes.marginTop`,
|
41794
|
-
inline: true
|
41795
|
-
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
41796
|
-
fill: true
|
41797
|
-
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
41798
|
-
label: "Bottom",
|
41799
|
-
quickchange: true,
|
41800
|
-
name: `${focusIdx2}.attributes.marginBottom`,
|
41801
|
-
inline: true
|
41802
|
-
}))), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
41803
|
-
wrap: false
|
41804
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
41805
|
-
fill: true
|
41806
|
-
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
41807
|
-
label: "Left",
|
41808
|
-
quickchange: true,
|
41809
|
-
name: `${focusIdx2}.attributes.marginLeft`,
|
41810
|
-
inline: true
|
41811
|
-
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
41812
|
-
fill: true
|
41813
|
-
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
41814
|
-
label: "Right",
|
41815
|
-
quickchange: true,
|
41816
|
-
name: `${focusIdx2}.attributes.marginRight`,
|
41817
|
-
inline: true
|
41818
|
-
}))));
|
41808
|
+
const expandedKeys = useMemo(() => {
|
41809
|
+
if (!focusIdx2)
|
41810
|
+
return [];
|
41811
|
+
let currentIdx = getParentIdx(focusIdx2);
|
41812
|
+
const keys2 = [];
|
41813
|
+
while (currentIdx) {
|
41814
|
+
keys2.push(currentIdx);
|
41815
|
+
currentIdx = getParentIdx(currentIdx);
|
41816
|
+
}
|
41817
|
+
return keys2;
|
41819
41818
|
}, [focusIdx2]);
|
41819
|
+
const hasFocus = Boolean(focusIdx2);
|
41820
|
+
if (!hasFocus)
|
41821
|
+
return null;
|
41822
|
+
return /* @__PURE__ */ React__default.createElement("div", __spreadValues({
|
41823
|
+
ref: setBlockLayerRef,
|
41824
|
+
id: "BlockLayerManager"
|
41825
|
+
}, {
|
41826
|
+
[DATA_ATTRIBUTE_DROP_CONTAINER]: "true"
|
41827
|
+
}), /* @__PURE__ */ React__default.createElement(BlockTree, {
|
41828
|
+
selectedKeys,
|
41829
|
+
expandedKeys,
|
41830
|
+
defaultExpandAll: true,
|
41831
|
+
treeData,
|
41832
|
+
renderTitle,
|
41833
|
+
allowDrop: blockTreeAllowDrop,
|
41834
|
+
onContextMenu,
|
41835
|
+
onDrop,
|
41836
|
+
onDragStart,
|
41837
|
+
onDragEnd,
|
41838
|
+
onSelect,
|
41839
|
+
onMouseEnter,
|
41840
|
+
onMouseLeave
|
41841
|
+
}), contextMenuData && /* @__PURE__ */ React__default.createElement(ContextMenu, {
|
41842
|
+
onClose: onCloseContextMenu,
|
41843
|
+
moveBlock,
|
41844
|
+
copyBlock,
|
41845
|
+
removeBlock,
|
41846
|
+
contextMenuData
|
41847
|
+
}));
|
41820
41848
|
}
|
41821
41849
|
const BlocksPanel$1 = "_BlocksPanel_15fho_1";
|
41822
41850
|
const blockItem = "_blockItem_15fho_5";
|
41823
41851
|
const closeBtn = "_closeBtn_15fho_12";
|
41824
|
-
var styles$
|
41852
|
+
var styles$2 = {
|
41825
41853
|
BlocksPanel: BlocksPanel$1,
|
41826
41854
|
blockItem,
|
41827
41855
|
closeBtn
|
@@ -41879,7 +41907,7 @@ __publicField(BlockMarketManager, "category", []);
|
|
41879
41907
|
__publicField(BlockMarketManager, "subscriptHandles", []);
|
41880
41908
|
const mask = "_mask_1a0xw_1";
|
41881
41909
|
const drag = "_drag_1a0xw_12";
|
41882
|
-
var styles$
|
41910
|
+
var styles$1 = {
|
41883
41911
|
mask,
|
41884
41912
|
drag
|
41885
41913
|
};
|
@@ -41889,7 +41917,7 @@ const BlockMaskWrapper = (props) => {
|
|
41889
41917
|
const { type, payload } = props;
|
41890
41918
|
const onMouseDown = useCallback(() => {
|
41891
41919
|
if (ref.current) {
|
41892
|
-
ref.current.classList.add(styles$
|
41920
|
+
ref.current.classList.add(styles$1.drag);
|
41893
41921
|
}
|
41894
41922
|
}, []);
|
41895
41923
|
const onMaskMouseDown = useCallback((ev) => {
|
@@ -41901,7 +41929,7 @@ const BlockMaskWrapper = (props) => {
|
|
41901
41929
|
useEffect(() => {
|
41902
41930
|
const mouseup = () => {
|
41903
41931
|
if (ref.current) {
|
41904
|
-
ref.current.classList.remove(styles$
|
41932
|
+
ref.current.classList.remove(styles$1.drag);
|
41905
41933
|
}
|
41906
41934
|
};
|
41907
41935
|
document.addEventListener("mouseup", mouseup);
|
@@ -41912,7 +41940,7 @@ const BlockMaskWrapper = (props) => {
|
|
41912
41940
|
return /* @__PURE__ */ React__default.createElement("div", {
|
41913
41941
|
style: { position: "relative" }
|
41914
41942
|
}, props.children, /* @__PURE__ */ React__default.createElement("div", {
|
41915
|
-
className: styles$
|
41943
|
+
className: styles$1.wrapper,
|
41916
41944
|
style: {
|
41917
41945
|
position: "absolute",
|
41918
41946
|
height: "100%",
|
@@ -41927,7 +41955,7 @@ const BlockMaskWrapper = (props) => {
|
|
41927
41955
|
payload
|
41928
41956
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
41929
41957
|
ref,
|
41930
|
-
className: styles$
|
41958
|
+
className: styles$1.mask,
|
41931
41959
|
onMouseDown: onMaskMouseDown
|
41932
41960
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
41933
41961
|
ref: dragRef,
|
@@ -43973,13 +44001,13 @@ const BlocksPanel = (props) => {
|
|
43973
44001
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
43974
44002
|
onClick: toggleVisible
|
43975
44003
|
}, props.children), ele && visible && createPortal(/* @__PURE__ */ React__default.createElement("div", {
|
43976
|
-
className: styles$
|
44004
|
+
className: styles$2.BlocksPanel,
|
43977
44005
|
style: {
|
43978
44006
|
pointerEvents: isDragging ? "none" : void 0,
|
43979
44007
|
position: "fixed",
|
43980
44008
|
width: isDragging ? 0 : 650,
|
44009
|
+
backgroundColor: "var(--color-bg-2)",
|
43981
44010
|
zIndex: 200,
|
43982
|
-
top: 0,
|
43983
44011
|
left: 60,
|
43984
44012
|
maxHeight: "85vh",
|
43985
44013
|
transition: "width .5s",
|
@@ -43989,7 +44017,7 @@ const BlocksPanel = (props) => {
|
|
43989
44017
|
bodyStyle: { padding: 0 },
|
43990
44018
|
title: "Drag block",
|
43991
44019
|
extra: /* @__PURE__ */ React__default.createElement("div", {
|
43992
|
-
className: styles$
|
44020
|
+
className: styles$2.closeBtn
|
43993
44021
|
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
43994
44022
|
iconName: "icon-close",
|
43995
44023
|
onClick: toggleVisible
|
@@ -44000,7 +44028,8 @@ const BlocksPanel = (props) => {
|
|
44000
44028
|
}, filterCategories.map((category, index2) => /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
|
44001
44029
|
style: {
|
44002
44030
|
padding: 0,
|
44003
|
-
overflow: "auto"
|
44031
|
+
overflow: "auto",
|
44032
|
+
height: 500
|
44004
44033
|
},
|
44005
44034
|
key: category.title,
|
44006
44035
|
title: /* @__PURE__ */ React__default.createElement("div", {
|
@@ -44015,17 +44044,16 @@ const BlocksPanel = (props) => {
|
|
44015
44044
|
};
|
44016
44045
|
const BlockPanelItem = React__default.memo((props) => {
|
44017
44046
|
return /* @__PURE__ */ React__default.createElement(Tabs$1, {
|
44018
|
-
style: { padding: "20px 0" },
|
44019
44047
|
tabPosition: "left"
|
44020
44048
|
}, props.category.blocks.map((block2, index2) => {
|
44021
44049
|
return /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
|
44022
|
-
style: { padding: 0 },
|
44050
|
+
style: { padding: 0, height: 500 },
|
44023
44051
|
key: block2.title,
|
44024
44052
|
title: /* @__PURE__ */ React__default.createElement(Stack$6, {
|
44025
44053
|
alignment: "center",
|
44026
44054
|
spacing: "extraTight"
|
44027
44055
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
44028
|
-
className: styles$
|
44056
|
+
className: styles$2.blockItem
|
44029
44057
|
}, block2.title), block2.description && /* @__PURE__ */ React__default.createElement(Help, {
|
44030
44058
|
title: block2.description
|
44031
44059
|
}))
|
@@ -44042,11 +44070,14 @@ const BlockPanelItem = React__default.memo((props) => {
|
|
44042
44070
|
}));
|
44043
44071
|
});
|
44044
44072
|
function ShortcutToolbar() {
|
44073
|
+
const blocksPanelRef = useRef(null);
|
44045
44074
|
return /* @__PURE__ */ React__default.createElement(Stack$6, {
|
44046
44075
|
vertical: true,
|
44047
44076
|
alignment: "center",
|
44048
44077
|
distribution: "center"
|
44049
|
-
}, /* @__PURE__ */ React__default.createElement(
|
44078
|
+
}, /* @__PURE__ */ React__default.createElement(BlocksPanel, null, /* @__PURE__ */ React__default.createElement("div", {
|
44079
|
+
ref: blocksPanelRef
|
44080
|
+
})), /* @__PURE__ */ React__default.createElement(BlockAvatarWrapper, {
|
44050
44081
|
type: BasicType.TEXT
|
44051
44082
|
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
44052
44083
|
title: "Text",
|
@@ -44090,33 +44121,37 @@ function ShortcutToolbar() {
|
|
44090
44121
|
cursor: "move",
|
44091
44122
|
color: "#e5afe5"
|
44092
44123
|
}
|
44093
|
-
})), /* @__PURE__ */ React__default.createElement(
|
44124
|
+
})), /* @__PURE__ */ React__default.createElement(IconFont, {
|
44125
|
+
onClick: () => {
|
44126
|
+
var _a;
|
44127
|
+
return (_a = blocksPanelRef.current) == null ? void 0 : _a.click();
|
44128
|
+
},
|
44094
44129
|
iconName: "icon-more",
|
44095
44130
|
style: {
|
44096
44131
|
display: "flex",
|
44097
44132
|
alignItems: "center",
|
44098
44133
|
justifyContent: "center",
|
44099
|
-
color: "#000",
|
44100
44134
|
width: 30,
|
44101
44135
|
height: 30,
|
44102
44136
|
borderRadius: "50%",
|
44103
|
-
|
44137
|
+
color: "var(--color-text-2)",
|
44138
|
+
boxShadow: "0 0 12px -3px var(--color-text-2)",
|
44104
44139
|
fontSize: 18
|
44105
44140
|
}
|
44106
|
-
}))
|
44141
|
+
}));
|
44107
44142
|
}
|
44108
|
-
var styles$1 = {};
|
44109
44143
|
function SourceCodePanel() {
|
44110
44144
|
const { setValueByIdx, focusBlock, values } = useBlock();
|
44111
44145
|
const { focusIdx } = useFocusIdx();
|
44112
44146
|
const [mjmlText, setMjmlText] = useState("");
|
44113
44147
|
const { pageData } = useEditorContext();
|
44148
|
+
const { mergeTags } = useEditorProps();
|
44114
44149
|
const code = useMemo(() => {
|
44115
44150
|
if (!focusBlock)
|
44116
44151
|
return "";
|
44117
44152
|
return JSON.stringify(focusBlock, null, 2) || "";
|
44118
44153
|
}, [focusBlock]);
|
44119
|
-
const
|
44154
|
+
const onChangeCode = useCallback((event) => {
|
44120
44155
|
try {
|
44121
44156
|
const parseValue = JSON.parse(JSON.stringify(eval("(" + event.target.value + ")")));
|
44122
44157
|
const block = BlockManager.getBlockByType(parseValue.type);
|
@@ -44156,14 +44191,13 @@ function SourceCodePanel() {
|
|
44156
44191
|
idx: focusIdx,
|
44157
44192
|
data: focusBlock,
|
44158
44193
|
context: pageData,
|
44159
|
-
mode: "production"
|
44194
|
+
mode: "production",
|
44195
|
+
dataSource: mergeTags
|
44160
44196
|
}));
|
44161
|
-
}, [focusBlock, focusIdx, pageData]);
|
44197
|
+
}, [focusBlock, focusIdx, pageData, mergeTags]);
|
44162
44198
|
if (!focusBlock)
|
44163
44199
|
return null;
|
44164
|
-
return /* @__PURE__ */ React__default.createElement(Collapse$1, {
|
44165
|
-
className: styles$1.wrapper
|
44166
|
-
}, /* @__PURE__ */ React__default.createElement(Collapse$1.Item, {
|
44200
|
+
return /* @__PURE__ */ React__default.createElement(Collapse$1, null, /* @__PURE__ */ React__default.createElement(Collapse$1.Item, {
|
44167
44201
|
name: "json",
|
44168
44202
|
header: "Json source",
|
44169
44203
|
contentStyle: { padding: "8px 13px" }
|
@@ -44171,7 +44205,7 @@ function SourceCodePanel() {
|
|
44171
44205
|
key: code,
|
44172
44206
|
defaultValue: code,
|
44173
44207
|
autoSize: { maxRows: 25 },
|
44174
|
-
onBlur:
|
44208
|
+
onBlur: onChangeCode
|
44175
44209
|
})), /* @__PURE__ */ React__default.createElement(Collapse$1.Item, {
|
44176
44210
|
name: "mjml",
|
44177
44211
|
header: "MJML source",
|
@@ -44199,25 +44233,29 @@ function Toolbar({
|
|
44199
44233
|
copyBlock(focusIdx2);
|
44200
44234
|
};
|
44201
44235
|
const handleDelete = () => {
|
44236
|
+
if (document.activeElement instanceof HTMLElement) {
|
44237
|
+
document.activeElement.blur();
|
44238
|
+
}
|
44202
44239
|
removeBlock(focusIdx2);
|
44203
44240
|
};
|
44204
44241
|
const handleSelectParent = () => {
|
44205
44242
|
setFocusIdx(getParentIdx(focusIdx2));
|
44206
44243
|
};
|
44207
44244
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
|
44245
|
+
id: "easy-email-extensions-InteractivePrompt-Toolbar",
|
44208
44246
|
style: {
|
44209
44247
|
position: "absolute",
|
44210
44248
|
left: 0,
|
44249
|
+
height: 0,
|
44211
44250
|
top: direction === "top" || isPage ? 0 : "100%",
|
44212
|
-
fontSize: 14,
|
44213
44251
|
zIndex: 3,
|
44214
|
-
|
44215
|
-
width: "100%",
|
44216
|
-
pointerEvents: "none",
|
44217
|
-
lineHeight: "22px"
|
44252
|
+
width: "100%"
|
44218
44253
|
}
|
44219
44254
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
44220
44255
|
style: {
|
44256
|
+
fontSize: 14,
|
44257
|
+
lineHeight: "22px",
|
44258
|
+
pointerEvents: "auto",
|
44221
44259
|
color: "#ffffff",
|
44222
44260
|
transform: direction !== "top" || isPage ? void 0 : "translateY(-100%)",
|
44223
44261
|
display: "flex"
|
@@ -44225,7 +44263,7 @@ function Toolbar({
|
|
44225
44263
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
44226
44264
|
style: {
|
44227
44265
|
color: "#ffffff",
|
44228
|
-
backgroundColor: "
|
44266
|
+
backgroundColor: "var(--selected-color)",
|
44229
44267
|
height: "22px",
|
44230
44268
|
display: "inline-flex",
|
44231
44269
|
padding: "1px 5px",
|
@@ -44265,7 +44303,7 @@ function ToolItem(props) {
|
|
44265
44303
|
onClick: props.onClick,
|
44266
44304
|
style: {
|
44267
44305
|
color: "#ffffff",
|
44268
|
-
backgroundColor: "
|
44306
|
+
backgroundColor: "var(--selected-color)",
|
44269
44307
|
height: 22,
|
44270
44308
|
fontSize: props.width || 14,
|
44271
44309
|
lineHeight: "22px",
|
@@ -44275,7 +44313,7 @@ function ToolItem(props) {
|
|
44275
44313
|
cursor: "pointer",
|
44276
44314
|
justifyContent: "center"
|
44277
44315
|
},
|
44278
|
-
className: classnames
|
44316
|
+
className: classnames("iconfont", props.iconName)
|
44279
44317
|
});
|
44280
44318
|
}
|
44281
44319
|
function FocusTooltip() {
|
@@ -44334,6 +44372,7 @@ function FocusTooltip() {
|
|
44334
44372
|
if (!block2 || !blockNode)
|
44335
44373
|
return null;
|
44336
44374
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, createPortal(/* @__PURE__ */ React__default.createElement("div", {
|
44375
|
+
id: "easy-email-extensions-InteractivePrompt-FocusTooltip",
|
44337
44376
|
style: {
|
44338
44377
|
position: "absolute",
|
44339
44378
|
width: "100%",
|
@@ -44436,6 +44475,7 @@ function HoverTooltip() {
|
|
44436
44475
|
if (!block2 || !blockNode)
|
44437
44476
|
return null;
|
44438
44477
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, createPortal(/* @__PURE__ */ React__default.createElement("div", {
|
44478
|
+
id: "easy-email-extensions-InteractivePrompt-HoverTooltip",
|
44439
44479
|
style: {
|
44440
44480
|
position: "absolute",
|
44441
44481
|
height: "100%",
|
@@ -44449,14 +44489,14 @@ function HoverTooltip() {
|
|
44449
44489
|
type: isDragging ? "drag" : "hover",
|
44450
44490
|
lineWidth: 1,
|
44451
44491
|
title: block2.name,
|
44452
|
-
direction: isTop ? "noEnoughTop" : direction,
|
44492
|
+
direction: isTop && direction === "top" ? "noEnoughTop" : direction,
|
44453
44493
|
isDragging
|
44454
44494
|
})), blockNode));
|
44455
44495
|
}
|
44456
44496
|
function TipNode(props) {
|
44457
44497
|
const { direction, title: title2, lineWidth, type } = props;
|
44458
44498
|
const dragTitle = useMemo(() => {
|
44459
|
-
if (direction === "top") {
|
44499
|
+
if (direction === "top" || direction === "noEnoughTop") {
|
44460
44500
|
return `Insert before ${title2}`;
|
44461
44501
|
} else if (direction === "bottom") {
|
44462
44502
|
return `Insert after ${title2}`;
|
@@ -44620,10 +44660,9 @@ var styles = {
|
|
44620
44660
|
container,
|
44621
44661
|
customScrollBar
|
44622
44662
|
};
|
44623
|
-
const { TabPane } = Tabs$1;
|
44624
44663
|
const SimpleLayout = (props) => {
|
44625
44664
|
const { height: containerHeight } = useEditorProps();
|
44626
|
-
return /* @__PURE__ */ React__default.createElement(Layout$1,
|
44665
|
+
return /* @__PURE__ */ React__default.createElement(Layout$1, {
|
44627
44666
|
style: {
|
44628
44667
|
display: "flex",
|
44629
44668
|
width: "100vw",
|
@@ -44631,40 +44670,38 @@ const SimpleLayout = (props) => {
|
|
44631
44670
|
minWidth: 1400
|
44632
44671
|
}
|
44633
44672
|
}, /* @__PURE__ */ React__default.createElement(Layout$1.Sider, {
|
44634
|
-
theme: "light",
|
44635
|
-
width: 60,
|
44636
|
-
style: { border: "1px solid #f0f0f0" }
|
44637
|
-
}, /* @__PURE__ */ React__default.createElement(ShortcutToolbar, null)), /* @__PURE__ */ React__default.createElement(Layout$1.Sider, {
|
44638
44673
|
style: {
|
44639
|
-
|
44674
|
+
width: 360
|
44675
|
+
}
|
44676
|
+
}, /* @__PURE__ */ React__default.createElement(Card$1, {
|
44677
|
+
bodyStyle: { padding: 0 },
|
44678
|
+
style: { border: "none" }
|
44679
|
+
}, /* @__PURE__ */ React__default.createElement(Card$1.Grid, {
|
44680
|
+
style: { width: 60 }
|
44681
|
+
}, /* @__PURE__ */ React__default.createElement(ShortcutToolbar, null)), /* @__PURE__ */ React__default.createElement(Card$1.Grid, {
|
44682
|
+
className: styles.customScrollBar,
|
44683
|
+
style: {
|
44684
|
+
width: 300,
|
44685
|
+
paddingBottom: 50,
|
44686
|
+
border: "none",
|
44640
44687
|
height: containerHeight,
|
44641
44688
|
overflow: "auto"
|
44642
|
-
}
|
44643
|
-
className: styles.customScrollBar,
|
44644
|
-
theme: "light",
|
44645
|
-
width: 300
|
44689
|
+
}
|
44646
44690
|
}, /* @__PURE__ */ React__default.createElement(Card$1, {
|
44647
|
-
|
44648
|
-
style: {
|
44649
|
-
}, /* @__PURE__ */ React__default.createElement(Tabs$1, {
|
44650
|
-
style: { borderLeft: "none" },
|
44651
|
-
defaultActiveTab: "Layout"
|
44652
|
-
}, /* @__PURE__ */ React__default.createElement(TabPane, {
|
44653
|
-
style: { paddingTop: 10 },
|
44654
|
-
key: "Layout",
|
44655
|
-
title: "Layout"
|
44691
|
+
title: "Layout",
|
44692
|
+
style: { border: "none" }
|
44656
44693
|
}, /* @__PURE__ */ React__default.createElement(BlockLayer, null))))), /* @__PURE__ */ React__default.createElement(Layout$1, {
|
44657
44694
|
style: { height: containerHeight }
|
44658
44695
|
}, props.children), /* @__PURE__ */ React__default.createElement(Layout$1.Sider, {
|
44659
44696
|
style: { height: containerHeight },
|
44660
|
-
theme: "light",
|
44661
44697
|
width: 350
|
44662
44698
|
}, /* @__PURE__ */ React__default.createElement(Card$1, {
|
44663
44699
|
size: "small",
|
44664
44700
|
id: "rightSide",
|
44665
44701
|
style: {
|
44666
44702
|
maxHeight: "100%",
|
44667
|
-
height: "100%"
|
44703
|
+
height: "100%",
|
44704
|
+
borderLeft: "none"
|
44668
44705
|
},
|
44669
44706
|
bodyStyle: { padding: 0 },
|
44670
44707
|
className: styles.customScrollBar
|
@@ -44675,7 +44712,7 @@ const SimpleLayout = (props) => {
|
|
44675
44712
|
}, /* @__PURE__ */ React__default.createElement(AttributePanel, null)), /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
|
44676
44713
|
key: "Source code",
|
44677
44714
|
title: "Source code"
|
44678
|
-
}, /* @__PURE__ */ React__default.createElement(SourceCodePanel, null)))))
|
44715
|
+
}, /* @__PURE__ */ React__default.createElement(SourceCodePanel, null))))), /* @__PURE__ */ React__default.createElement(InteractivePrompt, null));
|
44679
44716
|
};
|
44680
|
-
export {
|
44717
|
+
export { CheckboxField as $, AttributePanel as A, BlockLayer as B, Color as C, Decoration as D, TextAreaField as E, FontFamily as F, NumberField as G, Height as H, InteractivePrompt as I, SliderField as J, ColorPickerField as K, LetterSpacing as L, Margin as M, NavbarLinkPadding as N, ImageUploaderField as O, Padding as P, SelectField as Q, TreeSelectField as R, ShortcutToolbar as S, TextAlign as T, UploadField as U, VerticalAlign as V, Width as W, AutoCompleteField as X, RadioGroupField as Y, SwitchField as Z, DatePickerField as _, BlockAttributeConfigurationManager as a, EditTabField as a0, InlineTextField as a1, enhancer as a2, RichTextField as a3, Align as b, commonjsGlobal as c, AttributesPanelWrapper as d, ContainerBackgroundColor as e, TextDecoration as f, Background as g, LineHeight as h, TextTransform as i, BackgroundColor as j, Direction as k, Link as l, Border as m, BorderColor as n, FontSize as o, MergeTags as p, BorderStyle as q, FontStyle as r, BorderWidth as s, FontWeight as t, BlockMarketManager as u, BlockMaskWrapper as v, SourceCodePanel as w, SimpleLayout as x, TextField as y, SearchField as z };
|
44681
44718
|
//# sourceMappingURL=index2.js.map
|