easy-email-extensions 3.0.12 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AttributePanel/AttributePanel.d.ts +3 -3
- package/lib/AttributePanel/components/UI/Help/index.d.ts +7 -7
- package/lib/AttributePanel/components/UI/HtmlEditor.d.ts +5 -5
- package/lib/AttributePanel/components/attributes/Align.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/AttributesPanelWrapper/index.d.ts +6 -6
- package/lib/AttributePanel/components/attributes/Background.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/BackgroundColor.d.ts +3 -3
- package/lib/AttributePanel/components/attributes/Border.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/BorderColor.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/BorderStyle.d.ts +5 -5
- package/lib/AttributePanel/components/attributes/BorderWidth.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/Color.d.ts +4 -4
- package/lib/AttributePanel/components/attributes/ContainerBackgroundColor.d.ts +3 -3
- package/lib/AttributePanel/components/attributes/Decoration.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/Direction.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/FontFamily.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/FontSize.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/FontStyle.d.ts +3 -3
- package/lib/AttributePanel/components/attributes/FontWeight.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/Height.d.ts +3 -3
- package/lib/AttributePanel/components/attributes/LetterSpacing.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/LineHeight.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/Link.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/Margin.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/MergeTags.d.ts +6 -6
- package/lib/AttributePanel/components/attributes/NavbarLinkPadding.d.ts +3 -3
- package/lib/AttributePanel/components/attributes/Padding.d.ts +5 -5
- package/lib/AttributePanel/components/attributes/TextAlign.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/TextDecoration.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/TextTransform.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/VerticalAlign.d.ts +3 -3
- package/lib/AttributePanel/components/attributes/Width.d.ts +3 -3
- package/lib/AttributePanel/components/attributes/index.d.ts +29 -29
- package/lib/AttributePanel/components/blocks/Accordion/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/AccordionElement/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/AccordionText/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/AccordionTitle/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Button/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Carousel/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Column/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Divider/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Group/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Hero/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Image/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Navbar/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Page/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Raw/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Section/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Social/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Spacer/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Table/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Text/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/Wrapper/index.d.ts +1 -1
- package/lib/AttributePanel/components/blocks/index.d.ts +42 -42
- package/lib/AttributePanel/components/provider/PresetColorsProvider/index.d.ts +6 -6
- package/lib/AttributePanel/components/provider/SelectionRangeProvider/index.d.ts +6 -6
- package/lib/AttributePanel/hooks/useSelectionRange.d.ts +6 -6
- package/lib/AttributePanel/index.d.ts +3 -3
- package/lib/AttributePanel/utils/BlockAttributeConfigurationManager.d.ts +10 -10
- package/lib/AttributePanel/utils/InputNumberAdapter.d.ts +2 -2
- package/lib/AttributePanel/utils/PromiseEach.d.ts +1 -1
- package/lib/AttributePanel/utils/Uploader.d.ts +35 -35
- package/lib/AttributePanel/utils/awaitForElement.d.ts +4 -4
- package/lib/AttributePanel/utils/classnames.d.ts +1 -1
- package/lib/AttributePanel/utils/getImg.d.ts +8 -8
- package/lib/AttributePanel/utils/onDrag.d.ts +10 -10
- package/lib/AttributePanel/utils/previewLoadImage.d.ts +1 -1
- package/lib/BlockLayer/components/BlockTree/index.d.ts +50 -29
- package/lib/BlockLayer/components/BlockTree/transparentImage.d.ts +1 -0
- package/lib/BlockLayer/components/ContextMenu/index.d.ts +14 -14
- package/lib/BlockLayer/components/EyeIcon/index.d.ts +7 -7
- package/lib/BlockLayer/hooks/useAvatarWrapperDrop.d.ts +24 -0
- package/lib/BlockLayer/index.d.ts +8 -7
- package/lib/InteractivePrompt/components/FocusTooltip.d.ts +1 -1
- package/lib/InteractivePrompt/components/HoverTooltip.d.ts +1 -1
- package/lib/InteractivePrompt/components/Toolbar.d.ts +5 -5
- package/lib/InteractivePrompt/index.d.ts +1 -1
- package/lib/InteractivePrompt/utils/awaitForElement.d.ts +4 -4
- package/lib/ShortcutToolbar/ShortcutToolbar.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlockMaskWrapper/index.d.ts +6 -6
- package/lib/ShortcutToolbar/components/BlocksPanel/index.d.ts +2 -2
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/AccordionBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/ButtonBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/CarouselBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/ColumnBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/DividerBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/GroupBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/HeroBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/ImageBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/NavbarBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/RawBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/SectionBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/SocialBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/SpacerBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/TextBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/WrapperBlockItem/index.d.ts +1 -1
- package/lib/ShortcutToolbar/components/BlocksPanel/presetTemplate/index.d.ts +18 -18
- package/lib/ShortcutToolbar/components/Picture/index.d.ts +7 -7
- package/lib/ShortcutToolbar/index.d.ts +4 -4
- package/lib/ShortcutToolbar/utils/BlockMarketManager.d.ts +32 -32
- package/lib/ShortcutToolbar/utils/getImg.d.ts +68 -68
- package/lib/SimpleLayout/SimpleLayout.d.ts +2 -2
- package/lib/SimpleLayout/index.d.ts +1 -1
- package/lib/SourceCodePanel/index.d.ts +1 -1
- package/lib/components/AddToCollection/index.d.ts +5 -5
- package/lib/components/Form/AddFont.d.ts +1 -1
- package/lib/components/Form/AutoComplete.d.ts +11 -11
- package/lib/components/Form/CheckBoxGroup.d.ts +14 -14
- package/lib/components/Form/CodemirrorEditor/index.d.ts +8 -8
- package/lib/components/Form/ColorPicker.d.ts +10 -10
- package/lib/components/Form/EditTab.d.ts +10 -10
- package/lib/components/Form/ImageUploader/index.d.ts +8 -8
- package/lib/components/Form/InlineTextField/index.d.ts +7 -7
- package/lib/components/Form/Input.d.ts +7 -7
- package/lib/components/Form/RadioGroup.d.ts +13 -13
- package/lib/components/Form/RichTextField/index.d.ts +2 -3
- package/lib/components/Form/RichTextToolBar/RichTextToolBar.d.ts +1 -1
- package/lib/components/Form/RichTextToolBar/components/FontFamily/index.d.ts +3 -3
- package/lib/components/Form/RichTextToolBar/components/FontSizeList/index.d.ts +3 -3
- package/lib/components/Form/RichTextToolBar/components/Heading/index.d.ts +3 -3
- package/lib/components/Form/RichTextToolBar/components/Link/index.d.ts +12 -12
- package/lib/components/Form/RichTextToolBar/components/ToolItem/index.d.ts +7 -7
- package/lib/components/Form/RichTextToolBar/components/Tools/Tools.d.ts +5 -5
- package/lib/components/Form/RichTextToolBar/components/Tools/index.d.ts +1 -1
- package/lib/components/Form/RichTextToolBar/index.d.ts +1 -1
- package/lib/components/Form/Select.d.ts +11 -11
- package/lib/components/Form/UploadField.d.ts +8 -8
- package/lib/components/Form/enhancer.d.ts +20 -20
- package/lib/components/Form/index.d.ts +29 -29
- package/lib/components/RenderCount/index.d.ts +1 -1
- package/lib/components/ShadowDom/index.d.ts +2 -2
- package/lib/hooks/useAddToCollection.d.ts +6 -6
- package/lib/index.d.ts +8 -8
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/index2.js +1445 -1486
- 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/lib/utils/awaitForElement.d.ts +4 -4
- package/lib/utils/classnames.d.ts +1 -1
- package/package.json +4 -8
- package/readme.md +138 -138
- 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, getShadowRoot, FIXED_CONTAINER_ID,
|
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, 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,138 @@ 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
|
+
function BlockTree(props) {
|
30643
|
+
const [blockTreeRef, setBlockTreeRef] = useState(null);
|
30644
|
+
const [selectedId, setSelectedId] = useState(props.selectedId);
|
30645
|
+
const dragNode = useRef(null);
|
30646
|
+
const { treeData, allowDrop, onContextMenu } = props;
|
30647
|
+
useEffect(() => {
|
30648
|
+
setSelectedId(props.selectedId);
|
30649
|
+
}, [props.selectedId]);
|
30650
|
+
const onDragStart = useCallback((e, node) => {
|
30651
|
+
var _a;
|
30652
|
+
e.dataTransfer.dropEffect = "none";
|
30653
|
+
const dragNodeData = node.props.dataRef;
|
30654
|
+
dragNode.current = {
|
30655
|
+
dataRef: dragNodeData,
|
30656
|
+
parent: node.props.parent,
|
30657
|
+
key: node.props._key,
|
30658
|
+
parentKey: node.props.parentKey
|
30659
|
+
};
|
30660
|
+
(_a = props.onDragStart) == null ? void 0 : _a.call(props);
|
30661
|
+
}, [props.onDragStart]);
|
30662
|
+
const onDragMove = useCallback((option) => {
|
30663
|
+
if (!dragNode.current)
|
30664
|
+
return false;
|
30665
|
+
const dropData = option.dropNode.props.dataRef;
|
30666
|
+
const dropId = option.dropNode.props._key;
|
30667
|
+
const currentDropData = {
|
30668
|
+
dragNode: { key: dragNode.current.key },
|
30669
|
+
dropNode: {
|
30670
|
+
dataRef: dropData,
|
30671
|
+
parent: option.dropNode.props.parent,
|
30672
|
+
key: dropId
|
30673
|
+
},
|
30674
|
+
dropPosition: option.dropPosition
|
30675
|
+
};
|
30676
|
+
const isAllowDrop = allowDrop(currentDropData);
|
30677
|
+
if (isAllowDrop) {
|
30678
|
+
return true;
|
30679
|
+
}
|
30680
|
+
return false;
|
30681
|
+
}, [dragNode]);
|
30682
|
+
const onDrop = useCallback((info2) => {
|
30683
|
+
const { dropNode, dropPosition, e } = info2;
|
30684
|
+
e.dataTransfer.dropEffect = "move";
|
30685
|
+
if (!dragNode.current || !dropNode)
|
30686
|
+
return;
|
30687
|
+
const dropData = dropNode.props.dataRef;
|
30688
|
+
const currentDropData = {
|
30689
|
+
dragNode: dragNode.current,
|
30690
|
+
dropNode: {
|
30691
|
+
dataRef: dropData,
|
30692
|
+
parent: dropNode.props.parent,
|
30693
|
+
key: dropNode.props._key,
|
30694
|
+
parentKey: dropNode.props.parentKey
|
30695
|
+
},
|
30696
|
+
dropPosition
|
30697
|
+
};
|
30698
|
+
props.onDrop(currentDropData);
|
30699
|
+
}, []);
|
30700
|
+
const renderTitle = useCallback((nodeData) => {
|
30701
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
30702
|
+
style: { display: "inline-flex", width: "100%" },
|
30703
|
+
onContextMenu: (ev) => onContextMenu && onContextMenu(nodeData, ev)
|
30704
|
+
}, props.renderTitle(nodeData));
|
30705
|
+
}, [onContextMenu]);
|
30706
|
+
const onDragEnd = useCallback(() => {
|
30707
|
+
var _a;
|
30708
|
+
dragNode.current = null;
|
30709
|
+
(_a = props.onDragEnd) == null ? void 0 : _a.call(props);
|
30710
|
+
}, [props.onDragEnd]);
|
30711
|
+
const onSelect = useCallback((selectedKeys2) => {
|
30712
|
+
props.onSelect(selectedKeys2[0]);
|
30713
|
+
}, [props.onSelect]);
|
30714
|
+
useEffect(() => {
|
30715
|
+
if (blockTreeRef) {
|
30716
|
+
blockTreeRef.addEventListener("dragover", (e) => {
|
30717
|
+
if (e.dataTransfer) {
|
30718
|
+
e.dataTransfer.dropEffect = "move";
|
30719
|
+
}
|
30720
|
+
});
|
30721
|
+
}
|
30722
|
+
}, [blockTreeRef]);
|
30723
|
+
const selectedKeys = useMemo(() => selectedId ? [selectedId] : [], [selectedId]);
|
30724
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
30725
|
+
ref: setBlockTreeRef,
|
30726
|
+
onMouseLeave: props.onMouseLeave
|
30727
|
+
}, /* @__PURE__ */ React__default.createElement(CacheTree, {
|
30728
|
+
selectedKeys,
|
30729
|
+
draggable: true,
|
30730
|
+
size: "small",
|
30731
|
+
treeData,
|
30732
|
+
blockNode: true,
|
30733
|
+
fieldNames: {
|
30734
|
+
key: "id"
|
30735
|
+
},
|
30736
|
+
onDragEnd,
|
30737
|
+
onDragStart,
|
30738
|
+
onDrop,
|
30739
|
+
allowDrop: onDragMove,
|
30740
|
+
onSelect,
|
30741
|
+
renderTitle
|
30742
|
+
}));
|
30743
|
+
}
|
30744
|
+
function CacheTree(props) {
|
30745
|
+
const [cacheProps, setCacheProps] = useState(props);
|
30746
|
+
const lastProps = useRef(props);
|
30747
|
+
const debounceCallback = useCallback(lodash.exports.debounce((data) => {
|
30748
|
+
setCacheProps(data);
|
30749
|
+
}, 300), []);
|
30750
|
+
useEffect(() => {
|
30751
|
+
if (lastProps.current.treeData !== props.treeData) {
|
30752
|
+
lastProps.current = props;
|
30753
|
+
debounceCallback(props);
|
30754
|
+
} else {
|
30755
|
+
lastProps.current = props;
|
30756
|
+
setCacheProps(props);
|
30757
|
+
}
|
30758
|
+
}, [props]);
|
30759
|
+
return useMemo(() => /* @__PURE__ */ React__default.createElement(Tree$1, __spreadValues({}, cacheProps)), [cacheProps]);
|
30760
|
+
}
|
30761
|
+
const wrap$1 = "_wrap_aul3a_1";
|
30762
|
+
const listItem = "_listItem_aul3a_13";
|
30763
|
+
const contextmenuMark = "_contextmenuMark_aul3a_23";
|
30764
|
+
var styles$5 = {
|
30765
|
+
wrap: wrap$1,
|
30766
|
+
listItem,
|
30767
|
+
contextmenuMark
|
30768
|
+
};
|
30945
30769
|
var rngBrowser = { exports: {} };
|
30946
30770
|
var getRandomValues = typeof crypto != "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != "undefined" && typeof window.msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto);
|
30947
30771
|
if (getRandomValues) {
|
@@ -31150,7 +30974,7 @@ const btnWrap = "_btn-wrap_jzksr_43";
|
|
31150
30974
|
const upload = "_upload_jzksr_68";
|
31151
30975
|
const wrap = "_wrap_jzksr_80";
|
31152
30976
|
const urlInput = "_urlInput_jzksr_80";
|
31153
|
-
var styles$
|
30977
|
+
var styles$4 = {
|
31154
30978
|
container: container$1,
|
31155
30979
|
error,
|
31156
30980
|
item,
|
@@ -31312,16 +31136,16 @@ class Uploader {
|
|
31312
31136
|
this.handler[event2] = handles.filter((item2) => item2 !== fn);
|
31313
31137
|
}
|
31314
31138
|
}
|
31315
|
-
function classnames(...rest) {
|
31139
|
+
function classnames$1(...rest) {
|
31316
31140
|
return rest.filter((item2) => typeof item2 === "string").join(" ");
|
31317
31141
|
}
|
31318
31142
|
function previewLoadImage(url) {
|
31319
31143
|
return new Promise((resolve) => {
|
31320
|
-
const
|
31321
|
-
|
31322
|
-
|
31323
|
-
|
31324
|
-
|
31144
|
+
const img2 = new Image();
|
31145
|
+
img2.setAttribute("crossOrigin", "Anonymous");
|
31146
|
+
img2.src = url;
|
31147
|
+
img2.onload = () => resolve(img2);
|
31148
|
+
img2.onerror = () => resolve(img2);
|
31325
31149
|
});
|
31326
31150
|
}
|
31327
31151
|
const defaultImagesMap$1 = {
|
@@ -31392,30 +31216,30 @@ function ImageUploader(props) {
|
|
31392
31216
|
const content = useMemo(() => {
|
31393
31217
|
if (isUploading) {
|
31394
31218
|
return /* @__PURE__ */ React__default.createElement("div", {
|
31395
|
-
className: styles$
|
31219
|
+
className: styles$4["item"]
|
31396
31220
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
31397
|
-
className: classnames(styles$
|
31221
|
+
className: classnames$1(styles$4["info"])
|
31398
31222
|
}, /* @__PURE__ */ React__default.createElement("img", {
|
31399
31223
|
src: getImg$1("AttributePanel_03"),
|
31400
31224
|
alt: "Loading..."
|
31401
31225
|
}), /* @__PURE__ */ React__default.createElement("div", {
|
31402
|
-
className: styles$
|
31226
|
+
className: styles$4["btn-wrap"]
|
31403
31227
|
})));
|
31404
31228
|
}
|
31405
31229
|
if (!props.value) {
|
31406
31230
|
return /* @__PURE__ */ React__default.createElement("div", {
|
31407
|
-
className: styles$
|
31231
|
+
className: styles$4["upload"],
|
31408
31232
|
onClick: onUpload
|
31409
31233
|
}, /* @__PURE__ */ React__default.createElement(IconPlus$1, null), /* @__PURE__ */ React__default.createElement("div", null, "Upload"));
|
31410
31234
|
}
|
31411
31235
|
return /* @__PURE__ */ React__default.createElement("div", {
|
31412
|
-
className: styles$
|
31236
|
+
className: styles$4["item"]
|
31413
31237
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
31414
|
-
className: classnames(styles$
|
31238
|
+
className: classnames$1(styles$4["info"])
|
31415
31239
|
}, /* @__PURE__ */ React__default.createElement("img", {
|
31416
31240
|
src: props.value
|
31417
31241
|
}), /* @__PURE__ */ React__default.createElement("div", {
|
31418
|
-
className: styles$
|
31242
|
+
className: styles$4["btn-wrap"]
|
31419
31243
|
}, /* @__PURE__ */ React__default.createElement("a", {
|
31420
31244
|
title: "Preview",
|
31421
31245
|
onClick: () => setPreview(true)
|
@@ -31431,9 +31255,9 @@ function ImageUploader(props) {
|
|
31431
31255
|
});
|
31432
31256
|
}
|
31433
31257
|
return /* @__PURE__ */ React__default.createElement("div", {
|
31434
|
-
className: styles$
|
31258
|
+
className: styles$4.wrap
|
31435
31259
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
31436
|
-
className: styles$
|
31260
|
+
className: styles$4["container"]
|
31437
31261
|
}, content, /* @__PURE__ */ React__default.createElement(Input$5, {
|
31438
31262
|
onPaste,
|
31439
31263
|
value: props.value,
|
@@ -38385,7 +38209,7 @@ function ColorPicker(props) {
|
|
38385
38209
|
height: 32,
|
38386
38210
|
width: 32,
|
38387
38211
|
padding: 4,
|
38388
|
-
border: "1px solid
|
38212
|
+
border: "1px solid var(--color-neutral-3, rgb(229, 230, 235))",
|
38389
38213
|
borderRadius: showInput ? void 0 : 4,
|
38390
38214
|
fontSize: 0,
|
38391
38215
|
borderRight: showInput ? "none" : void 0,
|
@@ -38396,7 +38220,7 @@ function ColorPicker(props) {
|
|
38396
38220
|
style: {
|
38397
38221
|
position: "relative",
|
38398
38222
|
display: "block",
|
38399
|
-
border: "1px solid
|
38223
|
+
border: "1px solid var(--color-neutral-3, rgb(229, 230, 235))",
|
38400
38224
|
borderRadius: 2,
|
38401
38225
|
width: "100%",
|
38402
38226
|
height: "100%",
|
@@ -38443,7 +38267,7 @@ function RadioGroup(props) {
|
|
38443
38267
|
const helperText = "_helperText_cmm2s_1";
|
38444
38268
|
const labelHidden = "_label-hidden_cmm2s_9";
|
38445
38269
|
const editTab = "_editTab_cmm2s_20";
|
38446
|
-
var styles$
|
38270
|
+
var styles$3 = {
|
38447
38271
|
helperText,
|
38448
38272
|
"label-hidden": "_label-hidden_cmm2s_9",
|
38449
38273
|
labelHidden,
|
@@ -38532,7 +38356,7 @@ function enhancer(Component2, changeAdapter) {
|
|
38532
38356
|
alignment: alignment ? alignment : inline ? "center" : void 0,
|
38533
38357
|
distribution
|
38534
38358
|
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, null, /* @__PURE__ */ React__default.createElement("label", {
|
38535
|
-
className: labelHidden2 ? styles$
|
38359
|
+
className: labelHidden2 ? styles$3["label-hidden"] : void 0,
|
38536
38360
|
htmlFor: id
|
38537
38361
|
}, /* @__PURE__ */ React__default.createElement("span", {
|
38538
38362
|
style: { whiteSpace: "pre" }
|
@@ -38551,7 +38375,7 @@ function enhancer(Component2, changeAdapter) {
|
|
38551
38375
|
value: valueAdapter ? valueAdapter(currentValue) : currentValue,
|
38552
38376
|
onChange: onFieldChange
|
38553
38377
|
})))), /* @__PURE__ */ React__default.createElement("div", {
|
38554
|
-
className: styles$
|
38378
|
+
className: styles$3.helperText
|
38555
38379
|
}, /* @__PURE__ */ React__default.createElement("small", null, helpText))));
|
38556
38380
|
});
|
38557
38381
|
};
|
@@ -38603,7 +38427,10 @@ function CheckBoxGroup(props) {
|
|
38603
38427
|
value: item2.value
|
38604
38428
|
}, item2.label))));
|
38605
38429
|
}
|
38606
|
-
|
38430
|
+
function classnames(...rest) {
|
38431
|
+
return rest.filter((item2) => typeof item2 === "string").join(" ");
|
38432
|
+
}
|
38433
|
+
const { TabPane } = Tabs$1;
|
38607
38434
|
function EditTab(props) {
|
38608
38435
|
const { value, additionItem } = props;
|
38609
38436
|
const onAddTab = () => {
|
@@ -38613,14 +38440,14 @@ function EditTab(props) {
|
|
38613
38440
|
props.onChange(value.filter((_, vIndex) => Number(index2) !== vIndex));
|
38614
38441
|
};
|
38615
38442
|
return /* @__PURE__ */ React__default.createElement(Tabs$1, {
|
38616
|
-
className: classnames
|
38443
|
+
className: classnames(styles$3.editTab),
|
38617
38444
|
style: { border: "none" },
|
38618
38445
|
type: "card",
|
38619
38446
|
tabPosition: props.tabPosition,
|
38620
38447
|
editable: true,
|
38621
38448
|
onAddTab,
|
38622
38449
|
onDeleteTab
|
38623
|
-
}, (Array.isArray(value) ? value : []).map((item2, index2) => /* @__PURE__ */ React__default.createElement(TabPane
|
38450
|
+
}, (Array.isArray(value) ? value : []).map((item2, index2) => /* @__PURE__ */ React__default.createElement(TabPane, {
|
38624
38451
|
style: { paddingLeft: 12 },
|
38625
38452
|
title: `${props.label || "Tab"} ${index2 + 1}`,
|
38626
38453
|
key: index2
|
@@ -38655,92 +38482,51 @@ function InlineText({ idx, onChange, children }) {
|
|
38655
38482
|
const {
|
38656
38483
|
mutators: { setFieldTouched }
|
38657
38484
|
} = useForm$1();
|
38658
|
-
const [isFocus, setIsFocus] = useState(false);
|
38659
38485
|
const [textContainer, setTextContainer] = useState(null);
|
38660
38486
|
useField(idx);
|
38661
38487
|
const { focusBlock: focusBlock2 } = useBlock();
|
38662
38488
|
useEffect(() => {
|
38663
|
-
|
38664
|
-
|
38665
|
-
|
38666
|
-
|
38489
|
+
let promiseObj;
|
38490
|
+
const getTextBlock = () => {
|
38491
|
+
promiseObj = awaitForElement$1(idx);
|
38492
|
+
promiseObj.promise.then((blockNode) => {
|
38493
|
+
if (blockNode.querySelector('[contenteditable="true"]')) {
|
38494
|
+
setTextContainer(blockNode);
|
38495
|
+
} else {
|
38496
|
+
setTimeout(() => {
|
38497
|
+
getTextBlock();
|
38498
|
+
}, 50);
|
38499
|
+
}
|
38500
|
+
});
|
38501
|
+
};
|
38502
|
+
getTextBlock();
|
38667
38503
|
return () => {
|
38668
38504
|
promiseObj.cancel();
|
38669
38505
|
};
|
38670
38506
|
}, [idx, focusBlock2]);
|
38671
|
-
const onTextChange = useCallback((text) => {
|
38672
|
-
if ((focusBlock2 == null ? void 0 : focusBlock2.data.value.content) !== text) {
|
38673
|
-
onChange(text);
|
38674
|
-
}
|
38675
|
-
}, [focusBlock2 == null ? void 0 : focusBlock2.data.value.content, onChange]);
|
38676
38507
|
useEffect(() => {
|
38677
38508
|
if (!textContainer)
|
38678
38509
|
return;
|
38679
38510
|
const container2 = getEditNode(textContainer);
|
38680
38511
|
if (container2) {
|
38681
|
-
container2.focus();
|
38682
|
-
let focusTarget = null;
|
38683
|
-
const root2 = getShadowRoot();
|
38684
|
-
const onClick = (ev) => {
|
38685
|
-
ev.stopPropagation();
|
38686
|
-
focusTarget = ev.target;
|
38687
|
-
const fixedContainer = document.getElementById(FIXED_CONTAINER_ID);
|
38688
|
-
if (textContainer == null ? void 0 : textContainer.contains(focusTarget))
|
38689
|
-
return;
|
38690
|
-
if (fixedContainer && fixedContainer.contains(focusTarget))
|
38691
|
-
return;
|
38692
|
-
if (fixedContainer == null ? void 0 : fixedContainer.contains(document.activeElement))
|
38693
|
-
return;
|
38694
|
-
onTextChange(getEditContent(textContainer));
|
38695
|
-
};
|
38696
38512
|
const onPaste = (e) => {
|
38697
38513
|
var _a;
|
38698
38514
|
e.preventDefault();
|
38699
38515
|
const text = ((_a = e.clipboardData) == null ? void 0 : _a.getData("text/plain")) || "";
|
38700
38516
|
document.execCommand("insertHTML", false, text);
|
38701
|
-
|
38702
|
-
const stopDrag = (e) => {
|
38703
|
-
e.preventDefault();
|
38704
|
-
e.stopPropagation();
|
38517
|
+
onChange(getEditContent(textContainer));
|
38705
38518
|
};
|
38706
38519
|
const onInput = () => {
|
38707
|
-
|
38520
|
+
onChange(getEditContent(textContainer));
|
38708
38521
|
};
|
38709
38522
|
container2.addEventListener("paste", onPaste, true);
|
38710
|
-
container2.addEventListener("dragstart", stopDrag);
|
38711
38523
|
container2.addEventListener("input", onInput);
|
38712
|
-
document.addEventListener("mousedown", onClick);
|
38713
|
-
root2.addEventListener("mousedown", onClick);
|
38714
38524
|
return () => {
|
38715
38525
|
container2.removeEventListener("paste", onPaste, true);
|
38716
|
-
container2.removeEventListener("dragstart", stopDrag);
|
38717
38526
|
container2.removeEventListener("input", onInput);
|
38718
|
-
document.removeEventListener("mousedown", onClick);
|
38719
|
-
root2.removeEventListener("mousedown", onClick);
|
38720
38527
|
};
|
38721
38528
|
}
|
38722
|
-
}, [
|
38723
|
-
useEffect(() => {
|
38724
|
-
const onFocus3 = (ev) => {
|
38725
|
-
ev.stopPropagation();
|
38726
|
-
if (document.activeElement === getEditorRoot()) {
|
38727
|
-
setIsFocus(true);
|
38728
|
-
} else {
|
38729
|
-
setIsFocus(false);
|
38730
|
-
}
|
38731
|
-
};
|
38732
|
-
const root2 = getShadowRoot();
|
38733
|
-
root2.addEventListener("click", onFocus3);
|
38734
|
-
root2.addEventListener("focusin", onFocus3);
|
38735
|
-
window.addEventListener("focusin", onFocus3);
|
38736
|
-
return () => {
|
38737
|
-
root2.addEventListener("click", onFocus3);
|
38738
|
-
root2.removeEventListener("focusin", onFocus3);
|
38739
|
-
window.removeEventListener("focusin", onFocus3);
|
38740
|
-
};
|
38741
|
-
}, []);
|
38742
|
-
if (!isFocus)
|
38743
|
-
return null;
|
38529
|
+
}, [onChange, setFieldTouched, textContainer]);
|
38744
38530
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children);
|
38745
38531
|
}
|
38746
38532
|
function AutoComplete(props) {
|
@@ -38946,876 +38732,204 @@ function FontFamily$1(props) {
|
|
38946
38732
|
key: item2.value
|
38947
38733
|
}, item2.label))));
|
38948
38734
|
}
|
38949
|
-
|
38950
|
-
|
38735
|
+
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";
|
38736
|
+
function Help(props) {
|
38737
|
+
return /* @__PURE__ */ React__default.createElement(Tooltip$1, __spreadProps(__spreadValues({}, __spreadProps(__spreadValues({}, props), { style: void 0 })), {
|
38738
|
+
content: props.title
|
38739
|
+
}), /* @__PURE__ */ React__default.createElement("span", {
|
38740
|
+
style: { cursor: "pointer" }
|
38741
|
+
}, /* @__PURE__ */ React__default.createElement(IconQuestionCircle$1, {
|
38742
|
+
style: props.style
|
38743
|
+
})));
|
38744
|
+
}
|
38745
|
+
var ARRAY_ERROR = "FINAL_FORM/array-error";
|
38746
|
+
var fieldSubscriptionItems = ["active", "data", "dirty", "dirtySinceLastSubmit", "error", "initial", "invalid", "length", "modified", "modifiedSinceLastSubmit", "pristine", "submitError", "submitFailed", "submitSucceeded", "submitting", "touched", "valid", "value", "visited", "validating"];
|
38747
|
+
var version$1 = "4.20.4";
|
38748
|
+
function renderComponent(props, name) {
|
38749
|
+
var render3 = props.render, children = props.children, component = props.component, rest = _objectWithoutPropertiesLoose(props, ["render", "children", "component"]);
|
38750
|
+
if (component) {
|
38751
|
+
return /* @__PURE__ */ createElement(component, _extends$f({}, rest, {
|
38752
|
+
children,
|
38753
|
+
render: render3
|
38754
|
+
}));
|
38755
|
+
}
|
38756
|
+
if (render3) {
|
38757
|
+
return render3(children === void 0 ? rest : _extends$f({}, rest, {
|
38758
|
+
children
|
38759
|
+
}));
|
38760
|
+
}
|
38761
|
+
if (typeof children !== "function") {
|
38762
|
+
throw new Error("Must specify either a render prop, a render function as children, or a component prop to " + name);
|
38763
|
+
}
|
38764
|
+
return children(rest);
|
38765
|
+
}
|
38766
|
+
var defaultIsEqual = function defaultIsEqual2(aArray, bArray) {
|
38767
|
+
return aArray === bArray || Array.isArray(aArray) && Array.isArray(bArray) && aArray.length === bArray.length && !aArray.some(function(a, index2) {
|
38768
|
+
return a !== bArray[index2];
|
38769
|
+
});
|
38770
|
+
};
|
38771
|
+
function useConstant(init) {
|
38772
|
+
var ref = React__default.useRef();
|
38773
|
+
if (!ref.current) {
|
38774
|
+
ref.current = init();
|
38775
|
+
}
|
38776
|
+
return ref.current;
|
38777
|
+
}
|
38778
|
+
var all = fieldSubscriptionItems.reduce(function(result, key) {
|
38779
|
+
result[key] = true;
|
38780
|
+
return result;
|
38781
|
+
}, {});
|
38782
|
+
var useFieldArray = function useFieldArray2(name, _temp) {
|
38783
|
+
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;
|
38784
|
+
var form = useForm$1("useFieldArray");
|
38785
|
+
var formMutators = form.mutators;
|
38786
|
+
var hasMutators = !!(formMutators && formMutators.push && formMutators.pop);
|
38787
|
+
if (!hasMutators) {
|
38788
|
+
throw new Error("Array mutators not found. You need to provide the mutators from final-form-arrays to your form");
|
38789
|
+
}
|
38790
|
+
var mutators = useConstant(function() {
|
38791
|
+
return Object.keys(formMutators).reduce(function(result, key) {
|
38792
|
+
result[key] = function() {
|
38793
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
38794
|
+
args[_key] = arguments[_key];
|
38795
|
+
}
|
38796
|
+
return formMutators[key].apply(formMutators, [name].concat(args));
|
38797
|
+
};
|
38798
|
+
return result;
|
38799
|
+
}, {});
|
38800
|
+
});
|
38801
|
+
var validate3 = useConstant(function() {
|
38802
|
+
return function(value, allValues, meta2) {
|
38803
|
+
if (!validateProp)
|
38804
|
+
return void 0;
|
38805
|
+
var error2 = validateProp(value, allValues, meta2);
|
38806
|
+
if (!error2 || Array.isArray(error2)) {
|
38807
|
+
return error2;
|
38808
|
+
} else {
|
38809
|
+
var arrayError = [];
|
38810
|
+
arrayError[ARRAY_ERROR] = error2;
|
38811
|
+
return arrayError;
|
38812
|
+
}
|
38813
|
+
};
|
38814
|
+
});
|
38815
|
+
var _useField = useField(name, {
|
38816
|
+
subscription: _extends$f({}, subscription, {
|
38817
|
+
length: true
|
38818
|
+
}),
|
38819
|
+
defaultValue,
|
38820
|
+
initialValue,
|
38821
|
+
isEqual: isEqual2,
|
38822
|
+
validate: validate3,
|
38823
|
+
format: function format(v) {
|
38824
|
+
return v;
|
38825
|
+
}
|
38826
|
+
}), _useField$meta = _useField.meta, length = _useField$meta.length, meta = _objectWithoutPropertiesLoose(_useField$meta, ["length"]), input = _useField.input, fieldState = _objectWithoutPropertiesLoose(_useField, ["meta", "input"]);
|
38827
|
+
var forEach2 = function forEach3(iterator) {
|
38828
|
+
var len = length || 0;
|
38829
|
+
for (var i2 = 0; i2 < len; i2++) {
|
38830
|
+
iterator(name + "[" + i2 + "]", i2);
|
38831
|
+
}
|
38832
|
+
};
|
38833
|
+
var map2 = function map3(iterator) {
|
38834
|
+
var len = length || 0;
|
38835
|
+
var results = [];
|
38836
|
+
for (var i2 = 0; i2 < len; i2++) {
|
38837
|
+
results.push(iterator(name + "[" + i2 + "]", i2));
|
38838
|
+
}
|
38839
|
+
return results;
|
38840
|
+
};
|
38841
|
+
return {
|
38842
|
+
fields: _extends$f({
|
38843
|
+
name,
|
38844
|
+
forEach: forEach2,
|
38845
|
+
length: length || 0,
|
38846
|
+
map: map2
|
38847
|
+
}, mutators, fieldState, {
|
38848
|
+
value: input.value
|
38849
|
+
}),
|
38850
|
+
meta
|
38851
|
+
};
|
38852
|
+
};
|
38853
|
+
var version = "3.1.2";
|
38854
|
+
var versions = {
|
38855
|
+
"final-form": version$1,
|
38856
|
+
"react-final-form": version$2,
|
38857
|
+
"react-final-form-arrays": version
|
38858
|
+
};
|
38859
|
+
var FieldArray = function FieldArray2(_ref2) {
|
38860
|
+
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"]);
|
38861
|
+
var _useFieldArray = useFieldArray(name, {
|
38862
|
+
subscription,
|
38863
|
+
defaultValue,
|
38864
|
+
initialValue,
|
38865
|
+
isEqual: isEqual2,
|
38866
|
+
validate: validate3
|
38867
|
+
}), fields = _useFieldArray.fields, meta = _useFieldArray.meta;
|
38868
|
+
return renderComponent(_extends$f({
|
38869
|
+
fields,
|
38870
|
+
meta: _extends$f({}, meta, {
|
38871
|
+
__versions: versions
|
38872
|
+
})
|
38873
|
+
}, rest), "FieldArray(" + name + ")");
|
38874
|
+
};
|
38875
|
+
function AddFont() {
|
38876
|
+
const { focusBlock: focusBlock2 } = useBlock();
|
38877
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
38878
|
+
const value = focusBlock2 == null ? void 0 : focusBlock2.data.value;
|
38879
|
+
return /* @__PURE__ */ React__default.createElement(FieldArray, {
|
38880
|
+
name: `${focusIdx2}.data.value.fonts`,
|
38881
|
+
render: (arrayHelpers) => {
|
38882
|
+
var _a;
|
38883
|
+
return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38884
|
+
vertical: true,
|
38885
|
+
spacing: "tight"
|
38886
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38887
|
+
distribution: "equalSpacing"
|
38888
|
+
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
38889
|
+
variation: "strong"
|
38890
|
+
}, "Import font ", /* @__PURE__ */ React__default.createElement(Help, {
|
38891
|
+
title: "Points to a hosted css file"
|
38892
|
+
})), /* @__PURE__ */ React__default.createElement(Stack$6, null, /* @__PURE__ */ React__default.createElement(Button$4, {
|
38893
|
+
size: "small",
|
38894
|
+
icon: /* @__PURE__ */ React__default.createElement(IconPlus$1, null),
|
38895
|
+
onClick: () => arrayHelpers.fields.push({ name: "", href: "" })
|
38896
|
+
}))), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38897
|
+
vertical: true,
|
38898
|
+
spacing: "extraTight"
|
38899
|
+
}, (_a = value.fonts) == null ? void 0 : _a.map((item2, index2) => {
|
38900
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
38901
|
+
key: index2
|
38902
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38903
|
+
alignment: "center",
|
38904
|
+
wrap: false
|
38905
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
38906
|
+
fill: true
|
38907
|
+
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
38908
|
+
inline: true,
|
38909
|
+
name: `${focusIdx2}.data.value.fonts.${index2}.name`,
|
38910
|
+
label: "Name"
|
38911
|
+
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
38912
|
+
fill: true
|
38913
|
+
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
38914
|
+
inline: true,
|
38915
|
+
name: `${focusIdx2}.data.value.fonts.${index2}.href`,
|
38916
|
+
label: "Href"
|
38917
|
+
})), /* @__PURE__ */ React__default.createElement(Button$4, {
|
38918
|
+
icon: /* @__PURE__ */ React__default.createElement(IconDelete$1, null),
|
38919
|
+
onClick: () => arrayHelpers.fields.remove(index2)
|
38920
|
+
})));
|
38921
|
+
}))));
|
38922
|
+
}
|
38923
|
+
});
|
38924
|
+
}
|
38925
|
+
const MergeTags = React__default.memo((props) => {
|
38926
|
+
const { mergeTags = {}, mergeTagGenerate } = useEditorProps();
|
38951
38927
|
const treeOptions = useMemo(() => {
|
38952
38928
|
const treeData = [];
|
38953
38929
|
const deep = (key, title2, parent2, mapData = []) => {
|
38954
38930
|
const currentMapData = {
|
38955
|
-
key:
|
38956
|
-
value:
|
38957
|
-
title: title2,
|
38958
|
-
children: []
|
38959
|
-
};
|
38960
|
-
mapData.push(currentMapData);
|
38961
|
-
const current = parent2[key];
|
38962
|
-
if (lodash.exports.isObject(current)) {
|
38963
|
-
Object.keys(current).map((childKey) => deep(key + "." + childKey, childKey, current, currentMapData.children));
|
38964
|
-
}
|
38965
|
-
};
|
38966
|
-
Object.keys(mergeTags).map((key) => deep(key, key, mergeTags, treeData));
|
38967
|
-
return treeData;
|
38968
|
-
}, [mergeTags]);
|
38969
|
-
const onSelect = useCallback((value) => {
|
38970
|
-
return props.onChange(value);
|
38971
|
-
}, [props]);
|
38972
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
38973
|
-
style: { color: "#333" }
|
38974
|
-
}, props.isSelect ? /* @__PURE__ */ React__default.createElement(TreeSelect$1, {
|
38975
|
-
value: props.value,
|
38976
|
-
size: "small",
|
38977
|
-
style: { width: 120 },
|
38978
|
-
dropdownMenuStyle: { maxHeight: 400, overflow: "auto" },
|
38979
|
-
placeholder: "Please select",
|
38980
|
-
treeData: treeOptions,
|
38981
|
-
onChange: onSelect
|
38982
|
-
}) : /* @__PURE__ */ React__default.createElement(Tree$1, {
|
38983
|
-
style: { width: 120 },
|
38984
|
-
selectedKeys: [],
|
38985
|
-
treeData: treeOptions,
|
38986
|
-
onSelect: (vals) => onSelect(vals[0])
|
38987
|
-
}));
|
38988
|
-
});
|
38989
|
-
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";
|
38990
|
-
function Tools(props) {
|
38991
|
-
const { container: container2 } = props;
|
38992
|
-
const { mergeTags } = useEditorProps();
|
38993
|
-
const [selectionRange, setSelectionRange] = useState(null);
|
38994
|
-
useEffect(() => {
|
38995
|
-
const onSelectionChange = () => {
|
38996
|
-
try {
|
38997
|
-
const range2 = getShadowRoot().getSelection().getRangeAt(0);
|
38998
|
-
if (range2) {
|
38999
|
-
setSelectionRange(range2);
|
39000
|
-
}
|
39001
|
-
} catch (error2) {
|
39002
|
-
}
|
39003
|
-
};
|
39004
|
-
document.addEventListener("selectionchange", onSelectionChange);
|
39005
|
-
return () => {
|
39006
|
-
document.removeEventListener("selectionchange", onSelectionChange);
|
39007
|
-
};
|
39008
|
-
}, []);
|
39009
|
-
const restoreRange = useCallback((range2) => {
|
39010
|
-
const selection = getShadowRoot().getSelection();
|
39011
|
-
selection.removeAllRanges();
|
39012
|
-
const newRange = document.createRange();
|
39013
|
-
newRange.setStart(range2.startContainer, range2.startOffset);
|
39014
|
-
newRange.setEnd(range2.endContainer, range2.endOffset);
|
39015
|
-
selection.addRange(newRange);
|
39016
|
-
}, []);
|
39017
|
-
const execCommand = (cmd, val) => {
|
39018
|
-
if (!container2) {
|
39019
|
-
console.error("No container");
|
39020
|
-
return;
|
39021
|
-
}
|
39022
|
-
if (!selectionRange) {
|
39023
|
-
console.error("No selectionRange");
|
39024
|
-
return;
|
39025
|
-
}
|
39026
|
-
if (!(container2 == null ? void 0 : container2.contains(selectionRange == null ? void 0 : selectionRange.commonAncestorContainer)) && container2 !== (selectionRange == null ? void 0 : selectionRange.commonAncestorContainer)) {
|
39027
|
-
console.error("Not commonAncestorContainer");
|
39028
|
-
return;
|
39029
|
-
}
|
39030
|
-
restoreRange(selectionRange);
|
39031
|
-
if (cmd === "createLink") {
|
39032
|
-
const linkData = val;
|
39033
|
-
const target2 = linkData.blank ? "_blank" : "";
|
39034
|
-
let link;
|
39035
|
-
if (linkData.linkNode) {
|
39036
|
-
link = linkData.linkNode;
|
39037
|
-
} else {
|
39038
|
-
const uuid2 = (+new Date()).toString();
|
39039
|
-
document.execCommand(cmd, false, uuid2);
|
39040
|
-
link = getShadowRoot().querySelector(`a[href="${uuid2}"`);
|
39041
|
-
}
|
39042
|
-
if (target2) {
|
39043
|
-
link.setAttribute("target", target2);
|
39044
|
-
}
|
39045
|
-
link.style.color = "inherit";
|
39046
|
-
link.style.textDecoration = linkData.underline ? "underline" : "none";
|
39047
|
-
link.setAttribute("href", linkData.link);
|
39048
|
-
} else {
|
39049
|
-
document.execCommand(cmd, false, val);
|
39050
|
-
}
|
39051
|
-
const html = container2.innerHTML;
|
39052
|
-
props.onChange(html);
|
39053
|
-
};
|
39054
|
-
const getPopoverMountNode = () => document.getElementById(FIXED_CONTAINER_ID);
|
39055
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
39056
|
-
id: "Tools",
|
39057
|
-
style: { display: "flex", flexWrap: "nowrap" }
|
39058
|
-
}, /* @__PURE__ */ React__default.createElement("div", {
|
39059
|
-
style: {
|
39060
|
-
display: "flex",
|
39061
|
-
alignItems: "center"
|
39062
|
-
}
|
39063
|
-
}, /* @__PURE__ */ React__default.createElement("div", {
|
39064
|
-
className: "easy-email-extensions-divider"
|
39065
|
-
}), /* @__PURE__ */ React__default.createElement(Popover$1, {
|
39066
|
-
className: "easy-email-extensions-Tools-Popover",
|
39067
|
-
trigger: "click",
|
39068
|
-
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$1), /* @__PURE__ */ React__default.createElement(FontFamily$1, {
|
39069
|
-
onChange: (val) => execCommand("fontName", val)
|
39070
|
-
})),
|
39071
|
-
getPopupContainer: getPopoverMountNode
|
39072
|
-
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39073
|
-
title: "font family",
|
39074
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39075
|
-
iconName: "icon-font-family"
|
39076
|
-
})
|
39077
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
39078
|
-
className: "easy-email-extensions-divider"
|
39079
|
-
}), /* @__PURE__ */ React__default.createElement(Popover$1, {
|
39080
|
-
className: "easy-email-extensions-Tools-Popover",
|
39081
|
-
color: "#fff",
|
39082
|
-
trigger: "click",
|
39083
|
-
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$1), /* @__PURE__ */ React__default.createElement(FontSizeList, {
|
39084
|
-
onChange: (val) => execCommand("fontSize", val)
|
39085
|
-
})),
|
39086
|
-
getPopupContainer: getPopoverMountNode
|
39087
|
-
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39088
|
-
title: "line-height",
|
39089
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39090
|
-
iconName: "icon-line-height"
|
39091
|
-
})
|
39092
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
39093
|
-
className: "easy-email-extensions-divider"
|
39094
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39095
|
-
onClick: () => execCommand("bold"),
|
39096
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39097
|
-
iconName: "icon-bold"
|
39098
|
-
}),
|
39099
|
-
title: "Bold"
|
39100
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39101
|
-
className: "easy-email-extensions-divider"
|
39102
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39103
|
-
onClick: () => execCommand("italic"),
|
39104
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39105
|
-
iconName: "icon-italic"
|
39106
|
-
}),
|
39107
|
-
title: "Italic"
|
39108
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39109
|
-
className: "easy-email-extensions-divider"
|
39110
|
-
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
39111
|
-
label: "",
|
39112
|
-
position: "tl",
|
39113
|
-
onChange: (color) => execCommand("foreColor", color),
|
39114
|
-
getPopupContainer: getPopoverMountNode,
|
39115
|
-
showInput: false
|
39116
|
-
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39117
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39118
|
-
iconName: "icon-font-color"
|
39119
|
-
}),
|
39120
|
-
title: "Text color"
|
39121
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
39122
|
-
className: "easy-email-extensions-divider"
|
39123
|
-
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
39124
|
-
label: "",
|
39125
|
-
showInput: false,
|
39126
|
-
position: "tl",
|
39127
|
-
onChange: (color) => execCommand("hiliteColor", color),
|
39128
|
-
getPopupContainer: getPopoverMountNode
|
39129
|
-
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39130
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39131
|
-
iconName: "icon-bg-colors"
|
39132
|
-
}),
|
39133
|
-
title: "Background color"
|
39134
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
39135
|
-
className: "easy-email-extensions-divider"
|
39136
|
-
}), /* @__PURE__ */ React__default.createElement(Link$1, {
|
39137
|
-
currentRange: selectionRange,
|
39138
|
-
onChange: (values2) => execCommand("createLink", values2),
|
39139
|
-
getPopupContainer: getPopoverMountNode
|
39140
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39141
|
-
className: "easy-email-extensions-divider"
|
39142
|
-
}), mergeTags && /* @__PURE__ */ React__default.createElement(Tooltip$1, {
|
39143
|
-
color: "#fff",
|
39144
|
-
position: "bottom",
|
39145
|
-
content: /* @__PURE__ */ React__default.createElement(MergeTags$1, {
|
39146
|
-
value: "",
|
39147
|
-
onChange: (val) => execCommand("insertHTML", val)
|
39148
|
-
}),
|
39149
|
-
getPopupContainer: getPopoverMountNode
|
39150
|
-
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39151
|
-
title: "Merge tag",
|
39152
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39153
|
-
iconName: "icon-merge-tags"
|
39154
|
-
})
|
39155
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
39156
|
-
className: "easy-email-extensions-divider"
|
39157
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39158
|
-
onClick: () => execCommand("justifyLeft"),
|
39159
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39160
|
-
iconName: "icon-align-left"
|
39161
|
-
}),
|
39162
|
-
title: "Align left"
|
39163
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39164
|
-
onClick: () => execCommand("justifyCenter"),
|
39165
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39166
|
-
iconName: "icon-align-center"
|
39167
|
-
}),
|
39168
|
-
title: "Align center"
|
39169
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39170
|
-
onClick: () => execCommand("justifyRight"),
|
39171
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39172
|
-
iconName: "icon-align-right"
|
39173
|
-
}),
|
39174
|
-
title: "Align right"
|
39175
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39176
|
-
className: "easy-email-extensions-divider"
|
39177
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39178
|
-
onClick: () => execCommand("insertOrderedList"),
|
39179
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39180
|
-
iconName: "icon-list-ol"
|
39181
|
-
}),
|
39182
|
-
title: "Orderlist"
|
39183
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39184
|
-
onClick: () => execCommand("insertUnorderedList"),
|
39185
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39186
|
-
iconName: "icon-list-ul"
|
39187
|
-
}),
|
39188
|
-
title: "Unorderlist"
|
39189
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39190
|
-
className: "easy-email-extensions-divider"
|
39191
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39192
|
-
onClick: () => execCommand("strikeThrough"),
|
39193
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39194
|
-
iconName: "icon-strikethrough"
|
39195
|
-
}),
|
39196
|
-
title: "StrikethroughOutlined"
|
39197
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39198
|
-
onClick: () => execCommand("underline"),
|
39199
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39200
|
-
iconName: "icon-underline"
|
39201
|
-
}),
|
39202
|
-
title: "UnderlineOutlined"
|
39203
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39204
|
-
onClick: () => execCommand("insertHorizontalRule"),
|
39205
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39206
|
-
iconName: "icon-line"
|
39207
|
-
}),
|
39208
|
-
title: "Line"
|
39209
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39210
|
-
className: "easy-email-extensions-divider"
|
39211
|
-
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39212
|
-
onClick: () => execCommand("removeFormat"),
|
39213
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39214
|
-
iconName: "icon-close"
|
39215
|
-
}),
|
39216
|
-
title: "Remove format"
|
39217
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39218
|
-
className: "easy-email-extensions-divider"
|
39219
|
-
})));
|
39220
|
-
}
|
39221
|
-
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";
|
39222
|
-
function RichTextToolBar() {
|
39223
|
-
const [direction, setDirection] = useState("top");
|
39224
|
-
const [blockNode, setBlockNode] = useState(null);
|
39225
|
-
const [offsetX, setOffsetX] = useState(0);
|
39226
|
-
const { focusBlock: focusBlock2 } = useBlock();
|
39227
|
-
const { pageData: pageData2 } = useEditorContext();
|
39228
|
-
const { focusIdx: focusIdx2 } = useFocusIdx();
|
39229
|
-
const pageWidth = +(pageData2.attributes.width || "600").replace("px", "");
|
39230
|
-
useEffect(() => {
|
39231
|
-
const promiseObj = awaitForElement(focusIdx2);
|
39232
|
-
promiseObj.promise.then((blockNode2) => {
|
39233
|
-
setBlockNode(blockNode2);
|
39234
|
-
});
|
39235
|
-
return () => {
|
39236
|
-
promiseObj.cancel();
|
39237
|
-
};
|
39238
|
-
}, [focusIdx2, focusBlock2]);
|
39239
|
-
useEffect(() => {
|
39240
|
-
if (blockNode) {
|
39241
|
-
const options2 = {
|
39242
|
-
rootMargin: "-84px 0px 0px 0px",
|
39243
|
-
root: getShadowRoot().firstChild,
|
39244
|
-
threshold: [0, 1e-3, 0.1, 0.999, 0.8, 0.9, 1]
|
39245
|
-
};
|
39246
|
-
const checkDirection = (ev) => {
|
39247
|
-
const [current] = ev;
|
39248
|
-
const { top } = current.intersectionRect;
|
39249
|
-
const boundingClientRect = current.boundingClientRect;
|
39250
|
-
const rootBounds = current.rootBounds;
|
39251
|
-
const intersectionRatio = current.intersectionRatio;
|
39252
|
-
if (!rootBounds)
|
39253
|
-
return;
|
39254
|
-
const paddingLeft = (rootBounds.width - pageWidth) / 2;
|
39255
|
-
const offsetLeft = boundingClientRect.left - rootBounds.left;
|
39256
|
-
setOffsetX(paddingLeft - offsetLeft);
|
39257
|
-
if (intersectionRatio === 1) {
|
39258
|
-
setDirection("top");
|
39259
|
-
} else {
|
39260
|
-
if (top) {
|
39261
|
-
if (top > rootBounds.top) {
|
39262
|
-
setDirection("top");
|
39263
|
-
} else {
|
39264
|
-
setDirection("bottom");
|
39265
|
-
}
|
39266
|
-
}
|
39267
|
-
}
|
39268
|
-
};
|
39269
|
-
const observer = new IntersectionObserver(checkDirection, options2);
|
39270
|
-
observer.observe(blockNode);
|
39271
|
-
return () => {
|
39272
|
-
observer.unobserve(blockNode);
|
39273
|
-
};
|
39274
|
-
}
|
39275
|
-
}, [blockNode, pageWidth]);
|
39276
|
-
if (!blockNode)
|
39277
|
-
return null;
|
39278
|
-
const editorContainer = blockNode && getEditNode(blockNode);
|
39279
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, createPortal(/* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", {
|
39280
|
-
dangerouslySetInnerHTML: { __html: styleText }
|
39281
|
-
}), /* @__PURE__ */ React__default.createElement("div", {
|
39282
|
-
style: {
|
39283
|
-
transform: direction === "top" ? "translate(0,-100%)" : void 0,
|
39284
|
-
padding: "4px 8px",
|
39285
|
-
boxSizing: "border-box",
|
39286
|
-
position: "absolute",
|
39287
|
-
zIndex: 100,
|
39288
|
-
top: direction === "top" ? -40 : "calc(100% + 40px)",
|
39289
|
-
left: offsetX,
|
39290
|
-
width: pageWidth
|
39291
|
-
}
|
39292
|
-
}, /* @__PURE__ */ React__default.createElement("div", {
|
39293
|
-
style: {
|
39294
|
-
position: "absolute",
|
39295
|
-
backgroundColor: "#41444d",
|
39296
|
-
height: "100%",
|
39297
|
-
width: "100%",
|
39298
|
-
left: 0,
|
39299
|
-
top: 0
|
39300
|
-
}
|
39301
|
-
}), /* @__PURE__ */ React__default.createElement(Tools, {
|
39302
|
-
container: editorContainer,
|
39303
|
-
onChange: () => {
|
39304
|
-
}
|
39305
|
-
}))), blockNode));
|
39306
|
-
}
|
39307
|
-
const TEXT_BAR_LOCATION_KEY = "TEXT_BAR_LOCATION_KEY";
|
39308
|
-
const RichTextFieldItem = (props) => {
|
39309
|
-
useLocalStorage$1(TEXT_BAR_LOCATION_KEY, { left: 0, top: 0 });
|
39310
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(RichTextToolBar, null), /* @__PURE__ */ React__default.createElement(InlineTextField, __spreadValues({}, props)));
|
39311
|
-
};
|
39312
|
-
const RichTextField = (props) => {
|
39313
|
-
const { focusBlock: focusBlock2 } = useBlock();
|
39314
|
-
const { focusIdx: focusIdx2 } = useFocusIdx();
|
39315
|
-
if ((focusBlock2 == null ? void 0 : focusBlock2.type) !== BasicType.TEXT)
|
39316
|
-
return null;
|
39317
|
-
return /* @__PURE__ */ React__default.createElement(RichTextFieldItem, __spreadValues({
|
39318
|
-
key: focusIdx2
|
39319
|
-
}, props));
|
39320
|
-
};
|
39321
|
-
const TextField = enhancer(Input, (value) => value);
|
39322
|
-
const SearchField = enhancer(Input$5.Search, (val) => val);
|
39323
|
-
const TextAreaField = enhancer(Input$5.TextArea, (val) => val);
|
39324
|
-
const NumberField = enhancer(InputNumber$1, (e) => e);
|
39325
|
-
const SliderField = enhancer(Slider$2, (e) => e);
|
39326
|
-
const ColorPickerField = enhancer(ColorPicker, (e) => e);
|
39327
|
-
const UploadField = enhancer(UploadField$1, (val) => val);
|
39328
|
-
const ImageUploaderField = enhancer(ImageUploader, (url) => url);
|
39329
|
-
const SelectField = enhancer(Select, (e) => e);
|
39330
|
-
const AutoCompleteField = enhancer(AutoComplete, (e) => e);
|
39331
|
-
const RadioGroupField = enhancer(RadioGroup, (value) => value);
|
39332
|
-
const SwitchField = enhancer(Switch$1, (e) => e);
|
39333
|
-
const DatePickerField = enhancer(DatePicker$1, (date) => date);
|
39334
|
-
const CheckboxField = enhancer(CheckBoxGroup, (e) => e);
|
39335
|
-
const EditTabField = enhancer(EditTab, (e) => e);
|
39336
|
-
const InlineTextField = enhancer(InlineText, (value) => value);
|
39337
|
-
const AddToCollection = ({ visible, setVisible }) => {
|
39338
|
-
const { focusBlock: focusBlockData } = useBlock();
|
39339
|
-
const { onAddCollection, onUploadImage } = useEditorProps();
|
39340
|
-
const onSubmit = (values2) => {
|
39341
|
-
if (!values2.label)
|
39342
|
-
return;
|
39343
|
-
const uuid2 = uuid_1.v4();
|
39344
|
-
onAddCollection == null ? void 0 : onAddCollection({
|
39345
|
-
label: values2.label,
|
39346
|
-
helpText: values2.helpText,
|
39347
|
-
data: focusBlockData,
|
39348
|
-
thumbnail: values2.thumbnail,
|
39349
|
-
id: uuid2
|
39350
|
-
});
|
39351
|
-
setVisible(false);
|
39352
|
-
};
|
39353
|
-
return /* @__PURE__ */ React__default.createElement(Form$3, {
|
39354
|
-
initialValues: { label: "", helpText: "", thumbnail: "" },
|
39355
|
-
onSubmit
|
39356
|
-
}, ({ handleSubmit }) => /* @__PURE__ */ React__default.createElement(Modal$1, {
|
39357
|
-
maskClosable: false,
|
39358
|
-
style: { zIndex: 2e3 },
|
39359
|
-
visible,
|
39360
|
-
title: "Add to collection",
|
39361
|
-
onOk: () => handleSubmit(),
|
39362
|
-
onCancel: () => setVisible(false)
|
39363
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39364
|
-
vertical: true
|
39365
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, null), /* @__PURE__ */ React__default.createElement(TextField, {
|
39366
|
-
label: "Title",
|
39367
|
-
name: "label",
|
39368
|
-
validate: (val) => {
|
39369
|
-
if (!val)
|
39370
|
-
return "Title required!";
|
39371
|
-
return void 0;
|
39372
|
-
}
|
39373
|
-
}), /* @__PURE__ */ React__default.createElement(TextAreaField, {
|
39374
|
-
label: "Description",
|
39375
|
-
name: "helpText"
|
39376
|
-
}), /* @__PURE__ */ React__default.createElement(ImageUploaderField, {
|
39377
|
-
label: "Thumbnail",
|
39378
|
-
name: "thumbnail",
|
39379
|
-
uploadHandler: onUploadImage,
|
39380
|
-
validate: (val) => {
|
39381
|
-
if (!val)
|
39382
|
-
return "Thumbnail required!";
|
39383
|
-
return void 0;
|
39384
|
-
}
|
39385
|
-
}))));
|
39386
|
-
};
|
39387
|
-
function useAddToCollection() {
|
39388
|
-
const [modalVisible, setModalVisible] = useState(false);
|
39389
|
-
const modal = useMemo(() => /* @__PURE__ */ React__default.createElement(AddToCollection, {
|
39390
|
-
visible: modalVisible,
|
39391
|
-
setVisible: setModalVisible
|
39392
|
-
}), [modalVisible]);
|
39393
|
-
return {
|
39394
|
-
modal,
|
39395
|
-
modalVisible,
|
39396
|
-
setModalVisible
|
39397
|
-
};
|
39398
|
-
}
|
39399
|
-
function ContextMenu({
|
39400
|
-
moveBlock,
|
39401
|
-
copyBlock,
|
39402
|
-
removeBlock,
|
39403
|
-
contextMenuData,
|
39404
|
-
onClose
|
39405
|
-
}) {
|
39406
|
-
const { blockData, left, top } = contextMenuData;
|
39407
|
-
const idx = blockData.id;
|
39408
|
-
const { modal, modalVisible, setModalVisible } = useAddToCollection();
|
39409
|
-
const ref = useRef(null);
|
39410
|
-
const handleMoveUp = () => {
|
39411
|
-
moveBlock(idx, getSiblingIdx(idx, -1));
|
39412
|
-
scrollBlockEleIntoView({
|
39413
|
-
idx: getSiblingIdx(idx, -1)
|
39414
|
-
});
|
39415
|
-
onClose();
|
39416
|
-
};
|
39417
|
-
const handleMoveDown = () => {
|
39418
|
-
moveBlock(idx, getSiblingIdx(idx, 1));
|
39419
|
-
scrollBlockEleIntoView({
|
39420
|
-
idx: getSiblingIdx(idx, 1)
|
39421
|
-
});
|
39422
|
-
onClose();
|
39423
|
-
};
|
39424
|
-
const handleCopy = (ev) => {
|
39425
|
-
copyBlock(idx);
|
39426
|
-
scrollBlockEleIntoView({
|
39427
|
-
idx: getSiblingIdx(idx, 1)
|
39428
|
-
});
|
39429
|
-
onClose();
|
39430
|
-
};
|
39431
|
-
const handleAddToCollection = () => {
|
39432
|
-
setModalVisible(true);
|
39433
|
-
};
|
39434
|
-
const handleDelete = () => {
|
39435
|
-
removeBlock(idx);
|
39436
|
-
onClose();
|
39437
|
-
};
|
39438
|
-
const isFirst = getIndexByIdx(idx) === 0;
|
39439
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
39440
|
-
ref,
|
39441
|
-
style: { visibility: modalVisible ? "hidden" : void 0 }
|
39442
|
-
}, /* @__PURE__ */ React__default.createElement("div", {
|
39443
|
-
style: {
|
39444
|
-
left,
|
39445
|
-
top
|
39446
|
-
},
|
39447
|
-
className: styles$7.wrap,
|
39448
|
-
onClick: (e) => e.stopPropagation()
|
39449
|
-
}, !isFirst && /* @__PURE__ */ React__default.createElement("div", {
|
39450
|
-
className: styles$7.listItem,
|
39451
|
-
onClick: handleMoveUp
|
39452
|
-
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
39453
|
-
iconName: "icon-top",
|
39454
|
-
style: { marginRight: 10 }
|
39455
|
-
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Move up")), /* @__PURE__ */ React__default.createElement("div", {
|
39456
|
-
className: styles$7.listItem,
|
39457
|
-
onClick: handleMoveDown
|
39458
|
-
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
39459
|
-
iconName: "icon-bottom",
|
39460
|
-
style: { marginRight: 10 }
|
39461
|
-
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Move down")), /* @__PURE__ */ React__default.createElement("div", {
|
39462
|
-
className: styles$7.listItem,
|
39463
|
-
onClick: handleCopy
|
39464
|
-
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
39465
|
-
iconName: "icon-copy",
|
39466
|
-
style: { marginRight: 10 }
|
39467
|
-
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Copy")), /* @__PURE__ */ React__default.createElement("div", {
|
39468
|
-
className: styles$7.listItem,
|
39469
|
-
onClick: handleAddToCollection
|
39470
|
-
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
39471
|
-
iconName: "icon-start",
|
39472
|
-
style: { marginRight: 10 }
|
39473
|
-
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Add to collection")), /* @__PURE__ */ React__default.createElement("div", {
|
39474
|
-
className: styles$7.listItem,
|
39475
|
-
onClick: handleDelete
|
39476
|
-
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
39477
|
-
iconName: "icon-delete",
|
39478
|
-
style: { marginRight: 10 }
|
39479
|
-
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Delete")), /* @__PURE__ */ React__default.createElement("div", {
|
39480
|
-
className: styles$7.listItem,
|
39481
|
-
onClick: handleAddToCollection
|
39482
|
-
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
39483
|
-
iconName: "icon-start",
|
39484
|
-
style: { marginRight: 10 }
|
39485
|
-
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Add to collection"))), /* @__PURE__ */ React__default.createElement("div", {
|
39486
|
-
className: styles$7.contextmenuMark,
|
39487
|
-
onClick: onClose,
|
39488
|
-
onContextMenu: (e) => {
|
39489
|
-
e.preventDefault();
|
39490
|
-
onClose(e);
|
39491
|
-
}
|
39492
|
-
}), modal);
|
39493
|
-
}
|
39494
|
-
function BlockLayer() {
|
39495
|
-
const {
|
39496
|
-
pageData: pageData2,
|
39497
|
-
formState: { values: values2 }
|
39498
|
-
} = useEditorContext();
|
39499
|
-
const { onUploadImage, onAddCollection } = useEditorProps();
|
39500
|
-
const { focusIdx: focusIdx2, setFocusIdx } = useFocusIdx();
|
39501
|
-
const { setHoverIdx } = useHoverIdx();
|
39502
|
-
const { moveBlock, setValueByIdx: setValueByIdx2, copyBlock, removeBlock } = useBlock();
|
39503
|
-
const [contextMenuData, setContextMenuData] = useState(null);
|
39504
|
-
const onToggleVisible = useCallback(({ id }, e) => {
|
39505
|
-
e.stopPropagation();
|
39506
|
-
const blockData = lodash.exports.get(values2, id);
|
39507
|
-
if (blockData) {
|
39508
|
-
blockData.data.hidden = !Boolean(blockData.data.hidden);
|
39509
|
-
setValueByIdx2(id, blockData);
|
39510
|
-
}
|
39511
|
-
}, [setValueByIdx2, values2]);
|
39512
|
-
const renderTitle = useCallback((data) => {
|
39513
|
-
const block2 = BlockManager.getBlockByType(data.type);
|
39514
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
39515
|
-
className: styles$9.title
|
39516
|
-
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
39517
|
-
size: "smallest"
|
39518
|
-
}, block2 == null ? void 0 : block2.name), /* @__PURE__ */ React__default.createElement("div", {
|
39519
|
-
className: styles$9.eyeIcon
|
39520
|
-
}, /* @__PURE__ */ React__default.createElement(EyeIcon$1, {
|
39521
|
-
blockData: data,
|
39522
|
-
onToggleVisible
|
39523
|
-
})));
|
39524
|
-
}, [onToggleVisible]);
|
39525
|
-
const treeData = useMemo(() => {
|
39526
|
-
const copyData = lodash.exports.cloneDeep(pageData2);
|
39527
|
-
const loop2 = (item2, id, parent2) => {
|
39528
|
-
item2.id = id;
|
39529
|
-
item2.parent = parent2;
|
39530
|
-
item2.children.map((child, index2) => loop2(child, getChildIdx(id, index2), item2));
|
39531
|
-
};
|
39532
|
-
loop2(copyData, getPageIdx(), null);
|
39533
|
-
return [copyData];
|
39534
|
-
}, [pageData2]);
|
39535
|
-
const onSelect = useCallback((selectedId) => {
|
39536
|
-
setFocusIdx(selectedId);
|
39537
|
-
scrollBlockEleIntoView({ idx: selectedId });
|
39538
|
-
}, [setFocusIdx]);
|
39539
|
-
const onContextMenu = useCallback((blockData, ev) => {
|
39540
|
-
ev.preventDefault();
|
39541
|
-
setContextMenuData({ blockData, left: ev.clientX, top: ev.clientY });
|
39542
|
-
}, []);
|
39543
|
-
const onCloseContextMenu = useCallback((ev) => {
|
39544
|
-
setContextMenuData(null);
|
39545
|
-
}, []);
|
39546
|
-
const onMouseEnter = useCallback((id) => {
|
39547
|
-
setHoverIdx(id);
|
39548
|
-
}, [setHoverIdx]);
|
39549
|
-
const onMouseLeave = useCallback(() => {
|
39550
|
-
setHoverIdx("");
|
39551
|
-
}, [setHoverIdx]);
|
39552
|
-
const allowDrop = useCallback((params) => {
|
39553
|
-
const { dragNode, dropNode, willInsertAfter } = params;
|
39554
|
-
const dragBlock = BlockManager.getBlockByType(dragNode.type);
|
39555
|
-
if (!dragBlock)
|
39556
|
-
return false;
|
39557
|
-
if (dragBlock.validParentType.includes(dropNode.type) && willInsertAfter) {
|
39558
|
-
return true;
|
39559
|
-
}
|
39560
|
-
if (dropNode.parent && dragBlock.validParentType.includes(dropNode.parent.type)) {
|
39561
|
-
return true;
|
39562
|
-
}
|
39563
|
-
return false;
|
39564
|
-
}, []);
|
39565
|
-
const onDrop = useCallback((params) => {
|
39566
|
-
const { dragNode, dropNode, willInsertAfter } = params;
|
39567
|
-
const dragBlock = BlockManager.getBlockByType(dragNode.type);
|
39568
|
-
if (!dragBlock)
|
39569
|
-
return;
|
39570
|
-
if (dragBlock.validParentType.includes(dropNode.type) && willInsertAfter) {
|
39571
|
-
moveBlock(dragNode.id, getChildIdx(dropNode.id, 0));
|
39572
|
-
} else {
|
39573
|
-
moveBlock(dragNode.id, willInsertAfter ? getSiblingIdx(dropNode.id, 1) : dropNode.id);
|
39574
|
-
}
|
39575
|
-
}, [moveBlock]);
|
39576
|
-
const hasFocus = Boolean(focusIdx2);
|
39577
|
-
return useMemo(() => {
|
39578
|
-
if (!hasFocus)
|
39579
|
-
return null;
|
39580
|
-
return /* @__PURE__ */ React__default.createElement("div", __spreadValues({
|
39581
|
-
id: "BlockLayerManager"
|
39582
|
-
}, {
|
39583
|
-
[DATA_ATTRIBUTE_DROP_CONTAINER]: "true"
|
39584
|
-
}), /* @__PURE__ */ React__default.createElement(BlockTree, {
|
39585
|
-
selectedId: focusIdx2,
|
39586
|
-
defaultExpandAll: true,
|
39587
|
-
treeData,
|
39588
|
-
renderTitle,
|
39589
|
-
allowDrop,
|
39590
|
-
onContextMenu,
|
39591
|
-
onDrop,
|
39592
|
-
onSelect,
|
39593
|
-
onMouseEnter,
|
39594
|
-
onMouseLeave
|
39595
|
-
}), contextMenuData && /* @__PURE__ */ React__default.createElement(ContextMenu, {
|
39596
|
-
onClose: onCloseContextMenu,
|
39597
|
-
moveBlock,
|
39598
|
-
copyBlock,
|
39599
|
-
removeBlock,
|
39600
|
-
contextMenuData
|
39601
|
-
}));
|
39602
|
-
}, [
|
39603
|
-
hasFocus,
|
39604
|
-
focusIdx2,
|
39605
|
-
treeData,
|
39606
|
-
renderTitle,
|
39607
|
-
allowDrop,
|
39608
|
-
onContextMenu,
|
39609
|
-
onDrop,
|
39610
|
-
onSelect,
|
39611
|
-
onMouseEnter,
|
39612
|
-
onMouseLeave,
|
39613
|
-
contextMenuData,
|
39614
|
-
onCloseContextMenu,
|
39615
|
-
onUploadImage,
|
39616
|
-
onAddCollection,
|
39617
|
-
moveBlock,
|
39618
|
-
copyBlock,
|
39619
|
-
removeBlock
|
39620
|
-
]);
|
39621
|
-
}
|
39622
|
-
function Help(props) {
|
39623
|
-
return /* @__PURE__ */ React__default.createElement(Tooltip$1, __spreadProps(__spreadValues({}, __spreadProps(__spreadValues({}, props), { style: void 0 })), {
|
39624
|
-
content: props.title
|
39625
|
-
}), /* @__PURE__ */ React__default.createElement("span", {
|
39626
|
-
style: { cursor: "pointer" }
|
39627
|
-
}, /* @__PURE__ */ React__default.createElement(IconQuestionCircle$1, {
|
39628
|
-
style: props.style
|
39629
|
-
})));
|
39630
|
-
}
|
39631
|
-
var ARRAY_ERROR = "FINAL_FORM/array-error";
|
39632
|
-
var fieldSubscriptionItems = ["active", "data", "dirty", "dirtySinceLastSubmit", "error", "initial", "invalid", "length", "modified", "modifiedSinceLastSubmit", "pristine", "submitError", "submitFailed", "submitSucceeded", "submitting", "touched", "valid", "value", "visited", "validating"];
|
39633
|
-
var version$1 = "4.20.4";
|
39634
|
-
function renderComponent(props, name) {
|
39635
|
-
var render3 = props.render, children = props.children, component = props.component, rest = _objectWithoutPropertiesLoose(props, ["render", "children", "component"]);
|
39636
|
-
if (component) {
|
39637
|
-
return /* @__PURE__ */ createElement(component, _extends$f({}, rest, {
|
39638
|
-
children,
|
39639
|
-
render: render3
|
39640
|
-
}));
|
39641
|
-
}
|
39642
|
-
if (render3) {
|
39643
|
-
return render3(children === void 0 ? rest : _extends$f({}, rest, {
|
39644
|
-
children
|
39645
|
-
}));
|
39646
|
-
}
|
39647
|
-
if (typeof children !== "function") {
|
39648
|
-
throw new Error("Must specify either a render prop, a render function as children, or a component prop to " + name);
|
39649
|
-
}
|
39650
|
-
return children(rest);
|
39651
|
-
}
|
39652
|
-
var defaultIsEqual = function defaultIsEqual2(aArray, bArray) {
|
39653
|
-
return aArray === bArray || Array.isArray(aArray) && Array.isArray(bArray) && aArray.length === bArray.length && !aArray.some(function(a, index2) {
|
39654
|
-
return a !== bArray[index2];
|
39655
|
-
});
|
39656
|
-
};
|
39657
|
-
function useConstant(init) {
|
39658
|
-
var ref = React__default.useRef();
|
39659
|
-
if (!ref.current) {
|
39660
|
-
ref.current = init();
|
39661
|
-
}
|
39662
|
-
return ref.current;
|
39663
|
-
}
|
39664
|
-
var all = fieldSubscriptionItems.reduce(function(result, key) {
|
39665
|
-
result[key] = true;
|
39666
|
-
return result;
|
39667
|
-
}, {});
|
39668
|
-
var useFieldArray = function useFieldArray2(name, _temp) {
|
39669
|
-
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;
|
39670
|
-
var form = useForm$1("useFieldArray");
|
39671
|
-
var formMutators = form.mutators;
|
39672
|
-
var hasMutators = !!(formMutators && formMutators.push && formMutators.pop);
|
39673
|
-
if (!hasMutators) {
|
39674
|
-
throw new Error("Array mutators not found. You need to provide the mutators from final-form-arrays to your form");
|
39675
|
-
}
|
39676
|
-
var mutators = useConstant(function() {
|
39677
|
-
return Object.keys(formMutators).reduce(function(result, key) {
|
39678
|
-
result[key] = function() {
|
39679
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
39680
|
-
args[_key] = arguments[_key];
|
39681
|
-
}
|
39682
|
-
return formMutators[key].apply(formMutators, [name].concat(args));
|
39683
|
-
};
|
39684
|
-
return result;
|
39685
|
-
}, {});
|
39686
|
-
});
|
39687
|
-
var validate3 = useConstant(function() {
|
39688
|
-
return function(value, allValues, meta2) {
|
39689
|
-
if (!validateProp)
|
39690
|
-
return void 0;
|
39691
|
-
var error2 = validateProp(value, allValues, meta2);
|
39692
|
-
if (!error2 || Array.isArray(error2)) {
|
39693
|
-
return error2;
|
39694
|
-
} else {
|
39695
|
-
var arrayError = [];
|
39696
|
-
arrayError[ARRAY_ERROR] = error2;
|
39697
|
-
return arrayError;
|
39698
|
-
}
|
39699
|
-
};
|
39700
|
-
});
|
39701
|
-
var _useField = useField(name, {
|
39702
|
-
subscription: _extends$f({}, subscription, {
|
39703
|
-
length: true
|
39704
|
-
}),
|
39705
|
-
defaultValue,
|
39706
|
-
initialValue,
|
39707
|
-
isEqual: isEqual2,
|
39708
|
-
validate: validate3,
|
39709
|
-
format: function format(v) {
|
39710
|
-
return v;
|
39711
|
-
}
|
39712
|
-
}), _useField$meta = _useField.meta, length = _useField$meta.length, meta = _objectWithoutPropertiesLoose(_useField$meta, ["length"]), input = _useField.input, fieldState = _objectWithoutPropertiesLoose(_useField, ["meta", "input"]);
|
39713
|
-
var forEach2 = function forEach3(iterator) {
|
39714
|
-
var len = length || 0;
|
39715
|
-
for (var i2 = 0; i2 < len; i2++) {
|
39716
|
-
iterator(name + "[" + i2 + "]", i2);
|
39717
|
-
}
|
39718
|
-
};
|
39719
|
-
var map2 = function map3(iterator) {
|
39720
|
-
var len = length || 0;
|
39721
|
-
var results = [];
|
39722
|
-
for (var i2 = 0; i2 < len; i2++) {
|
39723
|
-
results.push(iterator(name + "[" + i2 + "]", i2));
|
39724
|
-
}
|
39725
|
-
return results;
|
39726
|
-
};
|
39727
|
-
return {
|
39728
|
-
fields: _extends$f({
|
39729
|
-
name,
|
39730
|
-
forEach: forEach2,
|
39731
|
-
length: length || 0,
|
39732
|
-
map: map2
|
39733
|
-
}, mutators, fieldState, {
|
39734
|
-
value: input.value
|
39735
|
-
}),
|
39736
|
-
meta
|
39737
|
-
};
|
39738
|
-
};
|
39739
|
-
var version = "3.1.2";
|
39740
|
-
var versions = {
|
39741
|
-
"final-form": version$1,
|
39742
|
-
"react-final-form": version$2,
|
39743
|
-
"react-final-form-arrays": version
|
39744
|
-
};
|
39745
|
-
var FieldArray = function FieldArray2(_ref2) {
|
39746
|
-
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"]);
|
39747
|
-
var _useFieldArray = useFieldArray(name, {
|
39748
|
-
subscription,
|
39749
|
-
defaultValue,
|
39750
|
-
initialValue,
|
39751
|
-
isEqual: isEqual2,
|
39752
|
-
validate: validate3
|
39753
|
-
}), fields = _useFieldArray.fields, meta = _useFieldArray.meta;
|
39754
|
-
return renderComponent(_extends$f({
|
39755
|
-
fields,
|
39756
|
-
meta: _extends$f({}, meta, {
|
39757
|
-
__versions: versions
|
39758
|
-
})
|
39759
|
-
}, rest), "FieldArray(" + name + ")");
|
39760
|
-
};
|
39761
|
-
function AddFont() {
|
39762
|
-
const { focusBlock: focusBlock2 } = useBlock();
|
39763
|
-
const { focusIdx: focusIdx2 } = useFocusIdx();
|
39764
|
-
const value = focusBlock2 == null ? void 0 : focusBlock2.data.value;
|
39765
|
-
return /* @__PURE__ */ React__default.createElement(FieldArray, {
|
39766
|
-
name: `${focusIdx2}.data.value.fonts`,
|
39767
|
-
render: (arrayHelpers) => {
|
39768
|
-
var _a;
|
39769
|
-
return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39770
|
-
vertical: true,
|
39771
|
-
spacing: "tight"
|
39772
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39773
|
-
distribution: "equalSpacing"
|
39774
|
-
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
39775
|
-
variation: "strong"
|
39776
|
-
}, "Import font ", /* @__PURE__ */ React__default.createElement(Help, {
|
39777
|
-
title: "Points to a hosted css file"
|
39778
|
-
})), /* @__PURE__ */ React__default.createElement(Stack$6, null, /* @__PURE__ */ React__default.createElement(Button$4, {
|
39779
|
-
size: "small",
|
39780
|
-
icon: /* @__PURE__ */ React__default.createElement(IconPlus$1, null),
|
39781
|
-
onClick: () => arrayHelpers.fields.push({ name: "", href: "" })
|
39782
|
-
}))), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39783
|
-
vertical: true,
|
39784
|
-
spacing: "extraTight"
|
39785
|
-
}, (_a = value.fonts) == null ? void 0 : _a.map((item2, index2) => {
|
39786
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
39787
|
-
key: index2
|
39788
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39789
|
-
alignment: "center",
|
39790
|
-
wrap: false
|
39791
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
39792
|
-
fill: true
|
39793
|
-
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
39794
|
-
inline: true,
|
39795
|
-
name: `${focusIdx2}.data.value.fonts.${index2}.name`,
|
39796
|
-
label: "Name"
|
39797
|
-
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
39798
|
-
fill: true
|
39799
|
-
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
39800
|
-
inline: true,
|
39801
|
-
name: `${focusIdx2}.data.value.fonts.${index2}.href`,
|
39802
|
-
label: "Href"
|
39803
|
-
})), /* @__PURE__ */ React__default.createElement(Button$4, {
|
39804
|
-
icon: /* @__PURE__ */ React__default.createElement(IconDelete$1, null),
|
39805
|
-
onClick: () => arrayHelpers.fields.remove(index2)
|
39806
|
-
})));
|
39807
|
-
}))));
|
39808
|
-
}
|
39809
|
-
});
|
39810
|
-
}
|
39811
|
-
const MergeTags = React__default.memo((props) => {
|
39812
|
-
const { mergeTags = {} } = useEditorProps();
|
39813
|
-
const treeOptions = useMemo(() => {
|
39814
|
-
const treeData = [];
|
39815
|
-
const deep = (key, title2, parent2, mapData = []) => {
|
39816
|
-
const currentMapData = {
|
39817
|
-
key: `{{${key}}}`,
|
39818
|
-
value: `{{${key}}}`,
|
38931
|
+
key: mergeTagGenerate(key),
|
38932
|
+
value: mergeTagGenerate(key),
|
39819
38933
|
title: title2,
|
39820
38934
|
children: []
|
39821
38935
|
};
|
@@ -39848,10 +38962,6 @@ const MergeTags = React__default.memo((props) => {
|
|
39848
38962
|
onSelect: (vals) => onSelect(vals[0])
|
39849
38963
|
}));
|
39850
38964
|
});
|
39851
|
-
const wrapper = "_wrapper_j840r_1";
|
39852
|
-
var styles$4 = {
|
39853
|
-
wrapper
|
39854
|
-
};
|
39855
38965
|
const AttributesPanelWrapper = (props) => {
|
39856
38966
|
const { focusBlock: focusBlock2, setFocusBlock } = useBlock();
|
39857
38967
|
const { mergeTags } = useEditorProps();
|
@@ -39864,11 +38974,9 @@ const AttributesPanelWrapper = (props) => {
|
|
39864
38974
|
}, [focusBlock2, setFocusBlock]);
|
39865
38975
|
if (!focusBlock2 || !block2)
|
39866
38976
|
return null;
|
39867
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
39868
|
-
className: styles$4.wrapper
|
39869
|
-
}, /* @__PURE__ */ React__default.createElement("div", {
|
38977
|
+
return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", {
|
39870
38978
|
style: {
|
39871
|
-
border: "1px solid
|
38979
|
+
border: "1px solid var(--color-neutral-3, rgb(229, 230, 235))",
|
39872
38980
|
borderBottom: "none",
|
39873
38981
|
padding: "12px 24px"
|
39874
38982
|
}
|
@@ -39883,7 +38991,10 @@ const AttributesPanelWrapper = (props) => {
|
|
39883
38991
|
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39884
38992
|
spacing: "extraTight",
|
39885
38993
|
alignment: "center"
|
39886
|
-
}, /* @__PURE__ */ React__default.createElement(EyeIcon, null), /* @__PURE__ */ React__default.createElement(TextStyle,
|
38994
|
+
}, /* @__PURE__ */ React__default.createElement(EyeIcon, null), /* @__PURE__ */ React__default.createElement(TextStyle, {
|
38995
|
+
variation: "strong",
|
38996
|
+
size: "large"
|
38997
|
+
}, `${block2.name} attributes`)), /* @__PURE__ */ React__default.createElement(Stack$6.Item, null, props.extra))), Boolean(focusBlock2.data.hidden) && mergeTags && /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39887
38998
|
spacing: "extraTight"
|
39888
38999
|
}, /* @__PURE__ */ React__default.createElement(TextStyle, null, "Hide if"), /* @__PURE__ */ React__default.createElement(MergeTags, {
|
39889
39000
|
isSelect: true,
|
@@ -39910,8 +39021,10 @@ function EyeIcon() {
|
|
39910
39021
|
if (focusBlock2.type === BasicType.PAGE)
|
39911
39022
|
return null;
|
39912
39023
|
return focusBlock2.data.hidden ? /* @__PURE__ */ React__default.createElement(IconEyeInvisible$1, {
|
39024
|
+
style: { cursor: "pointer", fontSize: 18 },
|
39913
39025
|
onClick: onToggleVisible
|
39914
39026
|
}) : /* @__PURE__ */ React__default.createElement(IconEye$1, {
|
39027
|
+
style: { cursor: "pointer", fontSize: 18 },
|
39915
39028
|
onClick: onToggleVisible
|
39916
39029
|
});
|
39917
39030
|
}
|
@@ -40038,10 +39151,10 @@ function Padding(props = {}) {
|
|
40038
39151
|
bottom,
|
40039
39152
|
right
|
40040
39153
|
};
|
40041
|
-
}, [paddingList, defaultPaddingList]);
|
39154
|
+
}, [paddingList, defaultPaddingList, defaultPaddingValue, paddingValue]);
|
40042
39155
|
const onChancePadding = useCallback((val) => {
|
40043
39156
|
change(focusIdx2 + `.attributes[${attributeName}]`, val);
|
40044
|
-
}, [focusIdx2, attributeName]);
|
39157
|
+
}, [focusIdx2, attributeName, change]);
|
40045
39158
|
return /* @__PURE__ */ React__default.createElement(Form$3, {
|
40046
39159
|
initialValues: paddingFormValues,
|
40047
39160
|
subscription: { submitting: true, pristine: true },
|
@@ -41696,168 +40809,1013 @@ function Table() {
|
|
41696
40809
|
setVisible
|
41697
40810
|
}));
|
41698
40811
|
}
|
41699
|
-
const blocks = {
|
41700
|
-
[BasicType.PAGE]: Page,
|
41701
|
-
[BasicType.SECTION]: Section,
|
41702
|
-
[BasicType.COLUMN]: Column,
|
41703
|
-
[BasicType.TEXT]: Text,
|
41704
|
-
[BasicType.IMAGE]: Image$1,
|
41705
|
-
[BasicType.GROUP]: Group,
|
41706
|
-
[BasicType.BUTTON]: Button,
|
41707
|
-
[BasicType.DIVIDER]: Divider,
|
41708
|
-
[BasicType.WRAPPER]: Wrapper,
|
41709
|
-
[BasicType.SPACER]: Spacer,
|
41710
|
-
[BasicType.RAW]: Raw,
|
41711
|
-
[BasicType.ACCORDION]: Accordion,
|
41712
|
-
[BasicType.ACCORDION_ELEMENT]: AccordionElement,
|
41713
|
-
[BasicType.ACCORDION_TITLE]: AccordionTitle,
|
41714
|
-
[BasicType.ACCORDION_TEXT]: AccordionText,
|
41715
|
-
[BasicType.CAROUSEL]: Carousel,
|
41716
|
-
[BasicType.HERO]: Hero,
|
41717
|
-
[BasicType.NAVBAR]: Navbar,
|
41718
|
-
[BasicType.SOCIAL]: Social,
|
41719
|
-
[BasicType.TABLE]: Table
|
40812
|
+
const blocks = {
|
40813
|
+
[BasicType.PAGE]: Page,
|
40814
|
+
[BasicType.SECTION]: Section,
|
40815
|
+
[BasicType.COLUMN]: Column,
|
40816
|
+
[BasicType.TEXT]: Text,
|
40817
|
+
[BasicType.IMAGE]: Image$1,
|
40818
|
+
[BasicType.GROUP]: Group,
|
40819
|
+
[BasicType.BUTTON]: Button,
|
40820
|
+
[BasicType.DIVIDER]: Divider,
|
40821
|
+
[BasicType.WRAPPER]: Wrapper,
|
40822
|
+
[BasicType.SPACER]: Spacer,
|
40823
|
+
[BasicType.RAW]: Raw,
|
40824
|
+
[BasicType.ACCORDION]: Accordion,
|
40825
|
+
[BasicType.ACCORDION_ELEMENT]: AccordionElement,
|
40826
|
+
[BasicType.ACCORDION_TITLE]: AccordionTitle,
|
40827
|
+
[BasicType.ACCORDION_TEXT]: AccordionText,
|
40828
|
+
[BasicType.CAROUSEL]: Carousel,
|
40829
|
+
[BasicType.HERO]: Hero,
|
40830
|
+
[BasicType.NAVBAR]: Navbar,
|
40831
|
+
[BasicType.SOCIAL]: Social,
|
40832
|
+
[BasicType.TABLE]: Table
|
40833
|
+
};
|
40834
|
+
class BlockAttributeConfigurationManager {
|
40835
|
+
static add(componentMap) {
|
40836
|
+
Object.keys(componentMap).forEach((name) => {
|
40837
|
+
this.map[name] = componentMap[name];
|
40838
|
+
});
|
40839
|
+
}
|
40840
|
+
static get(name) {
|
40841
|
+
return this.map[name];
|
40842
|
+
}
|
40843
|
+
static getMap() {
|
40844
|
+
return this.map;
|
40845
|
+
}
|
40846
|
+
}
|
40847
|
+
__publicField(BlockAttributeConfigurationManager, "map", __spreadValues({}, blocks));
|
40848
|
+
function AttributePanel() {
|
40849
|
+
const { values: values2, focusBlock: focusBlock2 } = useBlock();
|
40850
|
+
const { initialized } = useEditorContext();
|
40851
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
40852
|
+
const value = getValueByIdx(values2, focusIdx2);
|
40853
|
+
const Com = focusBlock2 && BlockAttributeConfigurationManager.get(focusBlock2.type);
|
40854
|
+
const shadowRoot = getShadowRoot();
|
40855
|
+
if (!value || !initialized)
|
40856
|
+
return null;
|
40857
|
+
return /* @__PURE__ */ React__default.createElement(PresetColorsProvider, null, Com ? /* @__PURE__ */ React__default.createElement(Com, null) : /* @__PURE__ */ React__default.createElement("div", {
|
40858
|
+
style: { marginTop: 200, padding: "0 50px" }
|
40859
|
+
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
40860
|
+
size: "extraLarge"
|
40861
|
+
}, "No matching components")), /* @__PURE__ */ React__default.createElement("div", {
|
40862
|
+
style: { position: "absolute" }
|
40863
|
+
}, /* @__PURE__ */ React__default.createElement(RichTextField, {
|
40864
|
+
idx: focusIdx2
|
40865
|
+
})), shadowRoot && ReactDOM.createPortal(/* @__PURE__ */ React__default.createElement("style", null, `
|
40866
|
+
.email-block [contentEditable="true"],
|
40867
|
+
.email-block [contentEditable="true"] * {
|
40868
|
+
outline: none;
|
40869
|
+
cursor: text;
|
40870
|
+
}
|
40871
|
+
`), shadowRoot));
|
40872
|
+
}
|
40873
|
+
function Decoration() {
|
40874
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
40875
|
+
return useMemo(() => {
|
40876
|
+
return /* @__PURE__ */ React__default.createElement(Stack$6, {
|
40877
|
+
key: focusIdx2,
|
40878
|
+
vertical: true,
|
40879
|
+
spacing: "extraTight"
|
40880
|
+
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
40881
|
+
variation: "strong",
|
40882
|
+
size: "large"
|
40883
|
+
}, "Decoration"), /* @__PURE__ */ React__default.createElement(TextField, {
|
40884
|
+
label: "Border radius",
|
40885
|
+
name: `${focusIdx2}.attributes.borderRadius`,
|
40886
|
+
inline: true
|
40887
|
+
}), /* @__PURE__ */ React__default.createElement(TextField, {
|
40888
|
+
label: "Border",
|
40889
|
+
name: `${focusIdx2}.attributes.border`,
|
40890
|
+
inline: true,
|
40891
|
+
alignment: "center"
|
40892
|
+
}), /* @__PURE__ */ React__default.createElement(NumberField, {
|
40893
|
+
label: "Opacity",
|
40894
|
+
max: 1,
|
40895
|
+
min: 0,
|
40896
|
+
step: 0.1,
|
40897
|
+
name: `${focusIdx2}.attributes.opacity`,
|
40898
|
+
inline: true,
|
40899
|
+
alignment: "center"
|
40900
|
+
}));
|
40901
|
+
}, [focusIdx2]);
|
40902
|
+
}
|
40903
|
+
const options = [
|
40904
|
+
{
|
40905
|
+
value: "ltr",
|
40906
|
+
label: "ltr"
|
40907
|
+
},
|
40908
|
+
{
|
40909
|
+
value: "rtl",
|
40910
|
+
label: "rtl"
|
40911
|
+
}
|
40912
|
+
];
|
40913
|
+
function Direction() {
|
40914
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
40915
|
+
return useMemo(() => {
|
40916
|
+
return /* @__PURE__ */ React__default.createElement(Stack$6, null, /* @__PURE__ */ React__default.createElement(RadioGroupField, {
|
40917
|
+
label: "Direction",
|
40918
|
+
name: `${focusIdx2}.attributes.direction`,
|
40919
|
+
options,
|
40920
|
+
inline: true
|
40921
|
+
}));
|
40922
|
+
}, [focusIdx2]);
|
40923
|
+
}
|
40924
|
+
function Margin() {
|
40925
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
40926
|
+
return useMemo(() => {
|
40927
|
+
return /* @__PURE__ */ React__default.createElement(Stack$6, {
|
40928
|
+
vertical: true,
|
40929
|
+
spacing: "extraTight"
|
40930
|
+
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
40931
|
+
size: "large"
|
40932
|
+
}, "Margin"), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
40933
|
+
wrap: false
|
40934
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
40935
|
+
fill: true
|
40936
|
+
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40937
|
+
label: "Top",
|
40938
|
+
quickchange: true,
|
40939
|
+
name: `${focusIdx2}.attributes.marginTop`,
|
40940
|
+
inline: true
|
40941
|
+
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
40942
|
+
fill: true
|
40943
|
+
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40944
|
+
label: "Bottom",
|
40945
|
+
quickchange: true,
|
40946
|
+
name: `${focusIdx2}.attributes.marginBottom`,
|
40947
|
+
inline: true
|
40948
|
+
}))), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
40949
|
+
wrap: false
|
40950
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
40951
|
+
fill: true
|
40952
|
+
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40953
|
+
label: "Left",
|
40954
|
+
quickchange: true,
|
40955
|
+
name: `${focusIdx2}.attributes.marginLeft`,
|
40956
|
+
inline: true
|
40957
|
+
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
40958
|
+
fill: true
|
40959
|
+
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40960
|
+
label: "Right",
|
40961
|
+
quickchange: true,
|
40962
|
+
name: `${focusIdx2}.attributes.marginRight`,
|
40963
|
+
inline: true
|
40964
|
+
}))));
|
40965
|
+
}, [focusIdx2]);
|
40966
|
+
}
|
40967
|
+
function Tools(props) {
|
40968
|
+
const { container: container2 } = props;
|
40969
|
+
const { mergeTags } = useEditorProps();
|
40970
|
+
const [selectionRange, setSelectionRange] = useState(null);
|
40971
|
+
useEffect(() => {
|
40972
|
+
const onSelectionChange = () => {
|
40973
|
+
try {
|
40974
|
+
const range2 = getShadowRoot().getSelection().getRangeAt(0);
|
40975
|
+
if (range2) {
|
40976
|
+
setSelectionRange(range2);
|
40977
|
+
}
|
40978
|
+
} catch (error2) {
|
40979
|
+
}
|
40980
|
+
};
|
40981
|
+
document.addEventListener("selectionchange", onSelectionChange);
|
40982
|
+
return () => {
|
40983
|
+
document.removeEventListener("selectionchange", onSelectionChange);
|
40984
|
+
};
|
40985
|
+
}, []);
|
40986
|
+
const restoreRange = useCallback((range2) => {
|
40987
|
+
const selection = getShadowRoot().getSelection();
|
40988
|
+
selection.removeAllRanges();
|
40989
|
+
const newRange = document.createRange();
|
40990
|
+
newRange.setStart(range2.startContainer, range2.startOffset);
|
40991
|
+
newRange.setEnd(range2.endContainer, range2.endOffset);
|
40992
|
+
selection.addRange(newRange);
|
40993
|
+
}, []);
|
40994
|
+
const execCommand = (cmd, val) => {
|
40995
|
+
if (!container2) {
|
40996
|
+
console.error("No container");
|
40997
|
+
return;
|
40998
|
+
}
|
40999
|
+
if (!selectionRange) {
|
41000
|
+
console.error("No selectionRange");
|
41001
|
+
return;
|
41002
|
+
}
|
41003
|
+
if (!(container2 == null ? void 0 : container2.contains(selectionRange == null ? void 0 : selectionRange.commonAncestorContainer)) && container2 !== (selectionRange == null ? void 0 : selectionRange.commonAncestorContainer)) {
|
41004
|
+
console.error("Not commonAncestorContainer");
|
41005
|
+
return;
|
41006
|
+
}
|
41007
|
+
restoreRange(selectionRange);
|
41008
|
+
if (cmd === "createLink") {
|
41009
|
+
const linkData = val;
|
41010
|
+
const target2 = linkData.blank ? "_blank" : "";
|
41011
|
+
let link;
|
41012
|
+
if (linkData.linkNode) {
|
41013
|
+
link = linkData.linkNode;
|
41014
|
+
} else {
|
41015
|
+
const uuid2 = (+new Date()).toString();
|
41016
|
+
document.execCommand(cmd, false, uuid2);
|
41017
|
+
link = getShadowRoot().querySelector(`a[href="${uuid2}"`);
|
41018
|
+
}
|
41019
|
+
if (target2) {
|
41020
|
+
link.setAttribute("target", target2);
|
41021
|
+
}
|
41022
|
+
link.style.color = "inherit";
|
41023
|
+
link.style.textDecoration = linkData.underline ? "underline" : "none";
|
41024
|
+
link.setAttribute("href", linkData.link);
|
41025
|
+
} else {
|
41026
|
+
document.execCommand(cmd, false, val);
|
41027
|
+
}
|
41028
|
+
const html = container2.innerHTML;
|
41029
|
+
props.onChange(html);
|
41030
|
+
};
|
41031
|
+
const getPopoverMountNode = () => document.getElementById(FIXED_CONTAINER_ID);
|
41032
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
41033
|
+
id: "Tools",
|
41034
|
+
style: { display: "flex", flexWrap: "nowrap" }
|
41035
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
41036
|
+
style: {
|
41037
|
+
display: "flex",
|
41038
|
+
alignItems: "center"
|
41039
|
+
}
|
41040
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
41041
|
+
className: "easy-email-extensions-divider"
|
41042
|
+
}), /* @__PURE__ */ React__default.createElement(Popover$1, {
|
41043
|
+
className: "easy-email-extensions-Tools-Popover",
|
41044
|
+
trigger: "click",
|
41045
|
+
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$1), /* @__PURE__ */ React__default.createElement(FontFamily$1, {
|
41046
|
+
onChange: (val) => execCommand("fontName", val)
|
41047
|
+
})),
|
41048
|
+
getPopupContainer: getPopoverMountNode
|
41049
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41050
|
+
title: "font family",
|
41051
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41052
|
+
iconName: "icon-font-family"
|
41053
|
+
})
|
41054
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
41055
|
+
className: "easy-email-extensions-divider"
|
41056
|
+
}), /* @__PURE__ */ React__default.createElement(Popover$1, {
|
41057
|
+
className: "easy-email-extensions-Tools-Popover",
|
41058
|
+
color: "#fff",
|
41059
|
+
trigger: "click",
|
41060
|
+
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$1), /* @__PURE__ */ React__default.createElement(FontSizeList, {
|
41061
|
+
onChange: (val) => execCommand("fontSize", val)
|
41062
|
+
})),
|
41063
|
+
getPopupContainer: getPopoverMountNode
|
41064
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41065
|
+
title: "line-height",
|
41066
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41067
|
+
iconName: "icon-line-height"
|
41068
|
+
})
|
41069
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
41070
|
+
className: "easy-email-extensions-divider"
|
41071
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41072
|
+
onClick: () => execCommand("bold"),
|
41073
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41074
|
+
iconName: "icon-bold"
|
41075
|
+
}),
|
41076
|
+
title: "Bold"
|
41077
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41078
|
+
className: "easy-email-extensions-divider"
|
41079
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41080
|
+
onClick: () => execCommand("italic"),
|
41081
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41082
|
+
iconName: "icon-italic"
|
41083
|
+
}),
|
41084
|
+
title: "Italic"
|
41085
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41086
|
+
className: "easy-email-extensions-divider"
|
41087
|
+
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
41088
|
+
label: "",
|
41089
|
+
position: "tl",
|
41090
|
+
onChange: (color) => execCommand("foreColor", color),
|
41091
|
+
getPopupContainer: getPopoverMountNode,
|
41092
|
+
showInput: false
|
41093
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41094
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41095
|
+
iconName: "icon-font-color"
|
41096
|
+
}),
|
41097
|
+
title: "Text color"
|
41098
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
41099
|
+
className: "easy-email-extensions-divider"
|
41100
|
+
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
41101
|
+
label: "",
|
41102
|
+
showInput: false,
|
41103
|
+
position: "tl",
|
41104
|
+
onChange: (color) => execCommand("hiliteColor", color),
|
41105
|
+
getPopupContainer: getPopoverMountNode
|
41106
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41107
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41108
|
+
iconName: "icon-bg-colors"
|
41109
|
+
}),
|
41110
|
+
title: "Background color"
|
41111
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
41112
|
+
className: "easy-email-extensions-divider"
|
41113
|
+
}), /* @__PURE__ */ React__default.createElement(Link$1, {
|
41114
|
+
currentRange: selectionRange,
|
41115
|
+
onChange: (values2) => execCommand("createLink", values2),
|
41116
|
+
getPopupContainer: getPopoverMountNode
|
41117
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41118
|
+
className: "easy-email-extensions-divider"
|
41119
|
+
}), mergeTags && /* @__PURE__ */ React__default.createElement(Popover$1, {
|
41120
|
+
trigger: "click",
|
41121
|
+
color: "#fff",
|
41122
|
+
position: "bottom",
|
41123
|
+
content: /* @__PURE__ */ React__default.createElement(MergeTags, {
|
41124
|
+
value: "",
|
41125
|
+
onChange: (val) => execCommand("insertHTML", val)
|
41126
|
+
}),
|
41127
|
+
getPopupContainer: getPopoverMountNode
|
41128
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41129
|
+
title: "Merge tag",
|
41130
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41131
|
+
iconName: "icon-merge-tags"
|
41132
|
+
})
|
41133
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
41134
|
+
className: "easy-email-extensions-divider"
|
41135
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41136
|
+
onClick: () => execCommand("justifyLeft"),
|
41137
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41138
|
+
iconName: "icon-align-left"
|
41139
|
+
}),
|
41140
|
+
title: "Align left"
|
41141
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41142
|
+
onClick: () => execCommand("justifyCenter"),
|
41143
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41144
|
+
iconName: "icon-align-center"
|
41145
|
+
}),
|
41146
|
+
title: "Align center"
|
41147
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41148
|
+
onClick: () => execCommand("justifyRight"),
|
41149
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41150
|
+
iconName: "icon-align-right"
|
41151
|
+
}),
|
41152
|
+
title: "Align right"
|
41153
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41154
|
+
className: "easy-email-extensions-divider"
|
41155
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41156
|
+
onClick: () => execCommand("insertOrderedList"),
|
41157
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41158
|
+
iconName: "icon-list-ol"
|
41159
|
+
}),
|
41160
|
+
title: "Orderlist"
|
41161
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41162
|
+
onClick: () => execCommand("insertUnorderedList"),
|
41163
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41164
|
+
iconName: "icon-list-ul"
|
41165
|
+
}),
|
41166
|
+
title: "Unorderlist"
|
41167
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41168
|
+
className: "easy-email-extensions-divider"
|
41169
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41170
|
+
onClick: () => execCommand("strikeThrough"),
|
41171
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41172
|
+
iconName: "icon-strikethrough"
|
41173
|
+
}),
|
41174
|
+
title: "StrikethroughOutlined"
|
41175
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41176
|
+
onClick: () => execCommand("underline"),
|
41177
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41178
|
+
iconName: "icon-underline"
|
41179
|
+
}),
|
41180
|
+
title: "UnderlineOutlined"
|
41181
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41182
|
+
onClick: () => execCommand("insertHorizontalRule"),
|
41183
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41184
|
+
iconName: "icon-line"
|
41185
|
+
}),
|
41186
|
+
title: "Line"
|
41187
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41188
|
+
className: "easy-email-extensions-divider"
|
41189
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41190
|
+
onClick: () => execCommand("removeFormat"),
|
41191
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41192
|
+
iconName: "icon-close"
|
41193
|
+
}),
|
41194
|
+
title: "Remove format"
|
41195
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41196
|
+
className: "easy-email-extensions-divider"
|
41197
|
+
})));
|
41198
|
+
}
|
41199
|
+
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";
|
41200
|
+
function RichTextToolBar() {
|
41201
|
+
const [direction, setDirection] = useState("top");
|
41202
|
+
const [blockNode, setBlockNode] = useState(null);
|
41203
|
+
const [offsetX, setOffsetX] = useState(0);
|
41204
|
+
const { focusBlock: focusBlock2 } = useBlock();
|
41205
|
+
const { pageData: pageData2 } = useEditorContext();
|
41206
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
41207
|
+
const pageWidth = +(pageData2.attributes.width || "600").replace("px", "");
|
41208
|
+
useEffect(() => {
|
41209
|
+
const promiseObj = awaitForElement(focusIdx2);
|
41210
|
+
promiseObj.promise.then((blockNode2) => {
|
41211
|
+
setBlockNode(blockNode2);
|
41212
|
+
});
|
41213
|
+
return () => {
|
41214
|
+
promiseObj.cancel();
|
41215
|
+
};
|
41216
|
+
}, [focusIdx2, focusBlock2]);
|
41217
|
+
useEffect(() => {
|
41218
|
+
if (blockNode) {
|
41219
|
+
const options2 = {
|
41220
|
+
rootMargin: "-84px 0px 0px 0px",
|
41221
|
+
root: getShadowRoot().firstChild,
|
41222
|
+
threshold: [0, 1e-3, 0.1, 0.999, 0.8, 0.9, 1]
|
41223
|
+
};
|
41224
|
+
const checkDirection = (ev) => {
|
41225
|
+
const [current] = ev;
|
41226
|
+
const { top } = current.intersectionRect;
|
41227
|
+
const boundingClientRect = current.boundingClientRect;
|
41228
|
+
const rootBounds = current.rootBounds;
|
41229
|
+
const intersectionRatio = current.intersectionRatio;
|
41230
|
+
if (!rootBounds)
|
41231
|
+
return;
|
41232
|
+
const paddingLeft = (rootBounds.width - pageWidth) / 2;
|
41233
|
+
const offsetLeft = boundingClientRect.left - rootBounds.left;
|
41234
|
+
setOffsetX(paddingLeft - offsetLeft);
|
41235
|
+
if (intersectionRatio === 1) {
|
41236
|
+
setDirection("top");
|
41237
|
+
} else {
|
41238
|
+
if (top) {
|
41239
|
+
if (top > rootBounds.top) {
|
41240
|
+
setDirection("top");
|
41241
|
+
} else {
|
41242
|
+
setDirection("bottom");
|
41243
|
+
}
|
41244
|
+
}
|
41245
|
+
}
|
41246
|
+
};
|
41247
|
+
const observer = new IntersectionObserver(checkDirection, options2);
|
41248
|
+
observer.observe(blockNode);
|
41249
|
+
return () => {
|
41250
|
+
observer.unobserve(blockNode);
|
41251
|
+
};
|
41252
|
+
}
|
41253
|
+
}, [blockNode, pageWidth]);
|
41254
|
+
if (!blockNode)
|
41255
|
+
return null;
|
41256
|
+
const editorContainer = blockNode && getEditNode(blockNode);
|
41257
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, createPortal(/* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", {
|
41258
|
+
dangerouslySetInnerHTML: { __html: styleText }
|
41259
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41260
|
+
style: {
|
41261
|
+
transform: direction === "top" ? "translate(0,-100%)" : void 0,
|
41262
|
+
padding: "4px 8px",
|
41263
|
+
boxSizing: "border-box",
|
41264
|
+
position: "absolute",
|
41265
|
+
zIndex: 100,
|
41266
|
+
top: direction === "top" ? -40 : "calc(100% + 40px)",
|
41267
|
+
left: offsetX,
|
41268
|
+
width: pageWidth
|
41269
|
+
}
|
41270
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
41271
|
+
style: {
|
41272
|
+
position: "absolute",
|
41273
|
+
backgroundColor: "#41444d",
|
41274
|
+
height: "100%",
|
41275
|
+
width: "100%",
|
41276
|
+
left: 0,
|
41277
|
+
top: 0
|
41278
|
+
}
|
41279
|
+
}), /* @__PURE__ */ React__default.createElement(Tools, {
|
41280
|
+
container: editorContainer,
|
41281
|
+
onChange: () => {
|
41282
|
+
}
|
41283
|
+
}))), blockNode));
|
41284
|
+
}
|
41285
|
+
const RichTextField = (props) => {
|
41286
|
+
const { focusBlock: focusBlock2 } = useBlock();
|
41287
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
41288
|
+
if ((focusBlock2 == null ? void 0 : focusBlock2.type) !== BasicType.TEXT)
|
41289
|
+
return null;
|
41290
|
+
const name = `${focusIdx2}.data.value.content`;
|
41291
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(RichTextToolBar, null), /* @__PURE__ */ React__default.createElement(Field, {
|
41292
|
+
name,
|
41293
|
+
parse: (v) => v
|
41294
|
+
}, ({ input }) => /* @__PURE__ */ React__default.createElement(FieldWrapper, __spreadProps(__spreadValues({}, props), {
|
41295
|
+
input
|
41296
|
+
}))));
|
41297
|
+
};
|
41298
|
+
function FieldWrapper(props) {
|
41299
|
+
const _a = props, { input } = _a, rest = __objRest(_a, ["input"]);
|
41300
|
+
const debounceCallbackChange = useCallback(lodash.exports.debounce((val) => {
|
41301
|
+
input.onChange(val);
|
41302
|
+
}, 500), [input]);
|
41303
|
+
return /* @__PURE__ */ React__default.createElement(InlineText, __spreadProps(__spreadValues({}, rest), {
|
41304
|
+
onChange: debounceCallbackChange
|
41305
|
+
}));
|
41306
|
+
}
|
41307
|
+
const TextField = enhancer(Input, (value) => value);
|
41308
|
+
const SearchField = enhancer(Input$5.Search, (val) => val);
|
41309
|
+
const TextAreaField = enhancer(Input$5.TextArea, (val) => val);
|
41310
|
+
const NumberField = enhancer(InputNumber$1, (e) => e);
|
41311
|
+
const SliderField = enhancer(Slider$2, (e) => e);
|
41312
|
+
const ColorPickerField = enhancer(ColorPicker, (e) => e);
|
41313
|
+
const UploadField = enhancer(UploadField$1, (val) => val);
|
41314
|
+
const ImageUploaderField = enhancer(ImageUploader, (url) => url);
|
41315
|
+
const SelectField = enhancer(Select, (e) => e);
|
41316
|
+
const AutoCompleteField = enhancer(AutoComplete, (e) => e);
|
41317
|
+
const RadioGroupField = enhancer(RadioGroup, (value) => value);
|
41318
|
+
const SwitchField = enhancer(Switch$1, (e) => e);
|
41319
|
+
const DatePickerField = enhancer(DatePicker$1, (date) => date);
|
41320
|
+
const CheckboxField = enhancer(CheckBoxGroup, (e) => e);
|
41321
|
+
const EditTabField = enhancer(EditTab, (e) => e);
|
41322
|
+
const InlineTextField = enhancer(InlineText, (value) => value);
|
41323
|
+
const AddToCollection = ({ visible, setVisible }) => {
|
41324
|
+
const { focusBlock: focusBlockData } = useBlock();
|
41325
|
+
const { onAddCollection, onUploadImage } = useEditorProps();
|
41326
|
+
const onSubmit = (values2) => {
|
41327
|
+
if (!values2.label)
|
41328
|
+
return;
|
41329
|
+
const uuid2 = uuid_1.v4();
|
41330
|
+
onAddCollection == null ? void 0 : onAddCollection({
|
41331
|
+
label: values2.label,
|
41332
|
+
helpText: values2.helpText,
|
41333
|
+
data: focusBlockData,
|
41334
|
+
thumbnail: values2.thumbnail,
|
41335
|
+
id: uuid2
|
41336
|
+
});
|
41337
|
+
setVisible(false);
|
41338
|
+
};
|
41339
|
+
return /* @__PURE__ */ React__default.createElement(Form$3, {
|
41340
|
+
initialValues: { label: "", helpText: "", thumbnail: "" },
|
41341
|
+
onSubmit
|
41342
|
+
}, ({ handleSubmit }) => /* @__PURE__ */ React__default.createElement(Modal$1, {
|
41343
|
+
maskClosable: false,
|
41344
|
+
style: { zIndex: 2e3 },
|
41345
|
+
visible,
|
41346
|
+
title: "Add to collection",
|
41347
|
+
onOk: () => handleSubmit(),
|
41348
|
+
onCancel: () => setVisible(false)
|
41349
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
41350
|
+
vertical: true
|
41351
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, null), /* @__PURE__ */ React__default.createElement(TextField, {
|
41352
|
+
label: "Title",
|
41353
|
+
name: "label",
|
41354
|
+
validate: (val) => {
|
41355
|
+
if (!val)
|
41356
|
+
return "Title required!";
|
41357
|
+
return void 0;
|
41358
|
+
}
|
41359
|
+
}), /* @__PURE__ */ React__default.createElement(TextAreaField, {
|
41360
|
+
label: "Description",
|
41361
|
+
name: "helpText"
|
41362
|
+
}), /* @__PURE__ */ React__default.createElement(ImageUploaderField, {
|
41363
|
+
label: "Thumbnail",
|
41364
|
+
name: "thumbnail",
|
41365
|
+
uploadHandler: onUploadImage,
|
41366
|
+
validate: (val) => {
|
41367
|
+
if (!val)
|
41368
|
+
return "Thumbnail required!";
|
41369
|
+
return void 0;
|
41370
|
+
}
|
41371
|
+
}))));
|
41720
41372
|
};
|
41721
|
-
|
41722
|
-
|
41723
|
-
|
41724
|
-
|
41373
|
+
function useAddToCollection() {
|
41374
|
+
const [modalVisible, setModalVisible] = useState(false);
|
41375
|
+
const modal = useMemo(() => /* @__PURE__ */ React__default.createElement(AddToCollection, {
|
41376
|
+
visible: modalVisible,
|
41377
|
+
setVisible: setModalVisible
|
41378
|
+
}), [modalVisible]);
|
41379
|
+
return {
|
41380
|
+
modal,
|
41381
|
+
modalVisible,
|
41382
|
+
setModalVisible
|
41383
|
+
};
|
41384
|
+
}
|
41385
|
+
function ContextMenu({
|
41386
|
+
moveBlock,
|
41387
|
+
copyBlock,
|
41388
|
+
removeBlock,
|
41389
|
+
contextMenuData,
|
41390
|
+
onClose
|
41391
|
+
}) {
|
41392
|
+
const { blockData, left, top } = contextMenuData;
|
41393
|
+
const idx = blockData.id;
|
41394
|
+
const { modal, modalVisible, setModalVisible } = useAddToCollection();
|
41395
|
+
const ref = useRef(null);
|
41396
|
+
const handleMoveUp = () => {
|
41397
|
+
moveBlock(idx, getSiblingIdx(idx, -1));
|
41398
|
+
scrollBlockEleIntoView({
|
41399
|
+
idx: getSiblingIdx(idx, -1)
|
41725
41400
|
});
|
41401
|
+
onClose();
|
41402
|
+
};
|
41403
|
+
const handleMoveDown = () => {
|
41404
|
+
moveBlock(idx, getSiblingIdx(idx, 1));
|
41405
|
+
scrollBlockEleIntoView({
|
41406
|
+
idx: getSiblingIdx(idx, 1)
|
41407
|
+
});
|
41408
|
+
onClose();
|
41409
|
+
};
|
41410
|
+
const handleCopy = (ev) => {
|
41411
|
+
copyBlock(idx);
|
41412
|
+
scrollBlockEleIntoView({
|
41413
|
+
idx: getSiblingIdx(idx, 1)
|
41414
|
+
});
|
41415
|
+
onClose();
|
41416
|
+
};
|
41417
|
+
const handleAddToCollection = () => {
|
41418
|
+
setModalVisible(true);
|
41419
|
+
};
|
41420
|
+
const handleDelete = () => {
|
41421
|
+
removeBlock(idx);
|
41422
|
+
onClose();
|
41423
|
+
};
|
41424
|
+
const isFirst = getIndexByIdx(idx) === 0;
|
41425
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
41426
|
+
ref,
|
41427
|
+
style: { visibility: modalVisible ? "hidden" : void 0 }
|
41428
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
41429
|
+
style: {
|
41430
|
+
left,
|
41431
|
+
top
|
41432
|
+
},
|
41433
|
+
className: styles$5.wrap,
|
41434
|
+
onClick: (e) => e.stopPropagation()
|
41435
|
+
}, !isFirst && /* @__PURE__ */ React__default.createElement("div", {
|
41436
|
+
className: styles$5.listItem,
|
41437
|
+
onClick: handleMoveUp
|
41438
|
+
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
41439
|
+
iconName: "icon-top",
|
41440
|
+
style: { marginRight: 10 }
|
41441
|
+
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Move up")), /* @__PURE__ */ React__default.createElement("div", {
|
41442
|
+
className: styles$5.listItem,
|
41443
|
+
onClick: handleMoveDown
|
41444
|
+
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
41445
|
+
iconName: "icon-bottom",
|
41446
|
+
style: { marginRight: 10 }
|
41447
|
+
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Move down")), /* @__PURE__ */ React__default.createElement("div", {
|
41448
|
+
className: styles$5.listItem,
|
41449
|
+
onClick: handleCopy
|
41450
|
+
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
41451
|
+
iconName: "icon-copy",
|
41452
|
+
style: { marginRight: 10 }
|
41453
|
+
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Copy")), /* @__PURE__ */ React__default.createElement("div", {
|
41454
|
+
className: styles$5.listItem,
|
41455
|
+
onClick: handleAddToCollection
|
41456
|
+
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
41457
|
+
iconName: "icon-start",
|
41458
|
+
style: { marginRight: 10 }
|
41459
|
+
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Add to collection")), /* @__PURE__ */ React__default.createElement("div", {
|
41460
|
+
className: styles$5.listItem,
|
41461
|
+
onClick: handleDelete
|
41462
|
+
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
41463
|
+
iconName: "icon-delete",
|
41464
|
+
style: { marginRight: 10 }
|
41465
|
+
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Delete")), /* @__PURE__ */ React__default.createElement("div", {
|
41466
|
+
className: styles$5.listItem,
|
41467
|
+
onClick: handleAddToCollection
|
41468
|
+
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
41469
|
+
iconName: "icon-start",
|
41470
|
+
style: { marginRight: 10 }
|
41471
|
+
}), " ", /* @__PURE__ */ React__default.createElement(TextStyle, null, "Add to collection"))), /* @__PURE__ */ React__default.createElement("div", {
|
41472
|
+
className: styles$5.contextmenuMark,
|
41473
|
+
onClick: onClose,
|
41474
|
+
onContextMenu: (e) => {
|
41475
|
+
e.preventDefault();
|
41476
|
+
onClose(e);
|
41477
|
+
}
|
41478
|
+
}), modal);
|
41479
|
+
}
|
41480
|
+
function useAvatarWrapperDrop() {
|
41481
|
+
const [blockLayerRef, setBlockLayerRef] = useState(null);
|
41482
|
+
const { setHoverIdx, setDirection } = useHoverIdx();
|
41483
|
+
const { dataTransfer, setDataTransfer } = useDataTransfer();
|
41484
|
+
const {
|
41485
|
+
formState: { values: values2 }
|
41486
|
+
} = useEditorContext();
|
41487
|
+
const valuesRef = useRef(values2);
|
41488
|
+
const dataTransferRef = useRef(dataTransfer);
|
41489
|
+
useEffect(() => {
|
41490
|
+
valuesRef.current = values2;
|
41491
|
+
}, [values2]);
|
41492
|
+
useEffect(() => {
|
41493
|
+
dataTransferRef.current = dataTransfer;
|
41494
|
+
}, [dataTransfer]);
|
41495
|
+
function isKeyObject(o) {
|
41496
|
+
return o.key !== void 0;
|
41726
41497
|
}
|
41727
|
-
|
41728
|
-
|
41729
|
-
|
41730
|
-
|
41731
|
-
|
41732
|
-
|
41498
|
+
const removeHightLightClassName = useCallback(() => {
|
41499
|
+
if (!blockLayerRef)
|
41500
|
+
return;
|
41501
|
+
blockLayerRef.querySelectorAll(".arco-tree-node-title-gap-top, .arco-tree-node-title-gap-bottom, .arco-tree-node-title-highlight").forEach((item2) => {
|
41502
|
+
item2.classList.remove("arco-tree-node-title-gap-top", "arco-tree-node-title-gap-bottom", "arco-tree-node-title-highlight");
|
41503
|
+
});
|
41504
|
+
}, [blockLayerRef]);
|
41505
|
+
const allowDrop = useCallback((params) => {
|
41506
|
+
const { dragNode, dropNode, dropPosition } = params;
|
41507
|
+
let dragType;
|
41508
|
+
if (isKeyObject(dragNode)) {
|
41509
|
+
const blockData = lodash.exports.get(valuesRef.current, dragNode.key);
|
41510
|
+
if (!blockData)
|
41511
|
+
return false;
|
41512
|
+
dragType = blockData.type;
|
41513
|
+
} else {
|
41514
|
+
dragType = dragNode.type;
|
41515
|
+
}
|
41516
|
+
const dragBlock = BlockManager.getBlockByType(dragType);
|
41517
|
+
if (!dragBlock)
|
41518
|
+
return false;
|
41519
|
+
if (dropPosition === 0) {
|
41520
|
+
if (dragBlock.validParentType.includes(dropNode.dataRef.type) && dropNode.dataRef.children.length === 0) {
|
41521
|
+
return {
|
41522
|
+
position: 0,
|
41523
|
+
key: dropNode.key
|
41524
|
+
};
|
41525
|
+
} else if (dropNode.parent && dragBlock.validParentType.includes(dropNode.parent.type)) {
|
41526
|
+
return {
|
41527
|
+
position: -1,
|
41528
|
+
key: dropNode.key
|
41529
|
+
};
|
41530
|
+
}
|
41531
|
+
} else {
|
41532
|
+
if (dropNode.parent && dragBlock.validParentType.includes(dropNode.parent.type)) {
|
41533
|
+
return {
|
41534
|
+
position: dropPosition,
|
41535
|
+
key: dropNode.key
|
41536
|
+
};
|
41537
|
+
}
|
41538
|
+
}
|
41539
|
+
setDirection("");
|
41540
|
+
setHoverIdx("");
|
41541
|
+
return false;
|
41542
|
+
}, [setDirection, setHoverIdx, removeHightLightClassName]);
|
41543
|
+
useEffect(() => {
|
41544
|
+
if (blockLayerRef) {
|
41545
|
+
const onDragOver = lodash.exports.debounce((ev) => {
|
41546
|
+
var _a, _b, _c, _d;
|
41547
|
+
if (!dataTransferRef.current)
|
41548
|
+
return;
|
41549
|
+
const blockNode = getBlockNodeByChildEle(ev.target);
|
41550
|
+
if (!blockNode || !ev.target)
|
41551
|
+
return;
|
41552
|
+
const directionPosition = getDirectionPosition(ev, 5);
|
41553
|
+
const treeNodeEle = (_b = (_a = blockNode.parentNode) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.parentNode;
|
41554
|
+
if (!treeNodeEle)
|
41555
|
+
return;
|
41556
|
+
removeHightLightClassName();
|
41557
|
+
const dropIdx = getNodeIdxFromClassName(blockNode.classList);
|
41558
|
+
if (!dropIdx)
|
41559
|
+
return;
|
41560
|
+
const dropParentIdx = getParentIdx(dropIdx);
|
41561
|
+
const dropBlockData = lodash.exports.get(valuesRef.current, dropIdx);
|
41562
|
+
const dropParentBlockData = dropParentIdx ? lodash.exports.get(valuesRef.current, dropParentIdx) : null;
|
41563
|
+
let dropPosition = 0;
|
41564
|
+
if (directionPosition.vertical.direction === "top" && directionPosition.vertical.isEdge) {
|
41565
|
+
dropPosition = -1;
|
41566
|
+
} else if (directionPosition.vertical.direction === "bottom" && directionPosition.vertical.isEdge) {
|
41567
|
+
dropPosition = 1;
|
41568
|
+
}
|
41569
|
+
const dropResult = allowDrop({
|
41570
|
+
dragNode: {
|
41571
|
+
type: dataTransferRef.current.type
|
41572
|
+
},
|
41573
|
+
dropNode: {
|
41574
|
+
dataRef: dropBlockData,
|
41575
|
+
key: dropIdx,
|
41576
|
+
parent: dropParentBlockData
|
41577
|
+
},
|
41578
|
+
dropPosition
|
41579
|
+
});
|
41580
|
+
if (!dropResult)
|
41581
|
+
return;
|
41582
|
+
const node = (_d = (_c = document.querySelector(`[data-tree-idx="${dropResult.key}"]`)) == null ? void 0 : _c.parentNode) == null ? void 0 : _d.parentNode;
|
41583
|
+
if (node instanceof HTMLElement) {
|
41584
|
+
removeHightLightClassName();
|
41585
|
+
node.classList.add("arco-tree-node-title-gap-bottom");
|
41586
|
+
}
|
41587
|
+
setDirection(getDirectionFormDropPosition(dropResult.position));
|
41588
|
+
setHoverIdx(dropResult.key);
|
41589
|
+
if (dropResult.position === -1) {
|
41590
|
+
treeNodeEle.classList.add("arco-tree-node-title-gap-top");
|
41591
|
+
setDataTransfer((dataTransfer2) => {
|
41592
|
+
return __spreadProps(__spreadValues({}, dataTransfer2), {
|
41593
|
+
parentIdx: dropParentIdx,
|
41594
|
+
positionIndex: getIndexByIdx(dropIdx)
|
41595
|
+
});
|
41596
|
+
});
|
41597
|
+
} else if (dropResult.position === 1) {
|
41598
|
+
setDataTransfer((dataTransfer2) => {
|
41599
|
+
return __spreadProps(__spreadValues({}, dataTransfer2), {
|
41600
|
+
parentIdx: dropParentIdx,
|
41601
|
+
positionIndex: getIndexByIdx(dropIdx) + 1
|
41602
|
+
});
|
41603
|
+
});
|
41604
|
+
treeNodeEle.classList.add("arco-tree-node-title-gap-bottom");
|
41605
|
+
} else {
|
41606
|
+
treeNodeEle.classList.add("arco-tree-node-title-highlight");
|
41607
|
+
setDataTransfer((dataTransfer2) => {
|
41608
|
+
return __spreadProps(__spreadValues({}, dataTransfer2), {
|
41609
|
+
parentIdx: getIndexByIdx(dropIdx),
|
41610
|
+
positionIndex: 0
|
41611
|
+
});
|
41612
|
+
});
|
41613
|
+
}
|
41614
|
+
});
|
41615
|
+
const onDragend = (ev) => {
|
41616
|
+
removeHightLightClassName();
|
41617
|
+
};
|
41618
|
+
const onDrop = (ev) => {
|
41619
|
+
setTimeout(() => {
|
41620
|
+
removeHightLightClassName();
|
41621
|
+
}, 0);
|
41622
|
+
};
|
41623
|
+
blockLayerRef.addEventListener("dragover", onDragOver);
|
41624
|
+
blockLayerRef.addEventListener("drop", onDrop);
|
41625
|
+
blockLayerRef.addEventListener("dragleave", onDragend);
|
41626
|
+
return () => {
|
41627
|
+
blockLayerRef.removeEventListener("dragover", onDragOver);
|
41628
|
+
blockLayerRef.removeEventListener("drop", onDrop);
|
41629
|
+
blockLayerRef.removeEventListener("dragleave", onDragend);
|
41630
|
+
};
|
41631
|
+
}
|
41632
|
+
}, [blockLayerRef, dataTransferRef, valuesRef, removeHightLightClassName]);
|
41633
|
+
return {
|
41634
|
+
setBlockLayerRef,
|
41635
|
+
blockLayerRef,
|
41636
|
+
allowDrop,
|
41637
|
+
removeHightLightClassName
|
41638
|
+
};
|
41733
41639
|
}
|
41734
|
-
|
41735
|
-
|
41736
|
-
|
41737
|
-
|
41738
|
-
|
41739
|
-
|
41740
|
-
const Com = focusBlock2 && BlockAttributeConfigurationManager.get(focusBlock2.type);
|
41741
|
-
const shadowRoot = getShadowRoot();
|
41742
|
-
if (!value || !initialized)
|
41743
|
-
return null;
|
41744
|
-
return /* @__PURE__ */ React__default.createElement(PresetColorsProvider, null, Com ? /* @__PURE__ */ React__default.createElement(Com, null) : /* @__PURE__ */ React__default.createElement("div", {
|
41745
|
-
style: { marginTop: 200, padding: "0 50px" }
|
41746
|
-
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
41747
|
-
size: "extraLarge"
|
41748
|
-
}, "No matching components")), /* @__PURE__ */ React__default.createElement("div", {
|
41749
|
-
style: { position: "absolute" }
|
41750
|
-
}, /* @__PURE__ */ React__default.createElement(RichTextField, {
|
41751
|
-
idx: focusIdx2,
|
41752
|
-
name: `${focusIdx2}.data.value.content`,
|
41753
|
-
label: "",
|
41754
|
-
labelHidden: true
|
41755
|
-
})), shadowRoot && ReactDOM.createPortal(/* @__PURE__ */ React__default.createElement("style", null, `
|
41756
|
-
.email-block [contentEditable="true"],
|
41757
|
-
.email-block [contentEditable="true"] * {
|
41758
|
-
outline: none;
|
41759
|
-
cursor: text;
|
41760
|
-
}
|
41761
|
-
`), shadowRoot));
|
41640
|
+
function getDirectionFormDropPosition(position) {
|
41641
|
+
if (position === -1)
|
41642
|
+
return "top";
|
41643
|
+
if (position === 1)
|
41644
|
+
return "bottom";
|
41645
|
+
return "";
|
41762
41646
|
}
|
41763
|
-
function
|
41764
|
-
const {
|
41765
|
-
|
41766
|
-
|
41767
|
-
|
41768
|
-
|
41769
|
-
|
41647
|
+
function BlockLayer() {
|
41648
|
+
const {
|
41649
|
+
pageData: pageData2,
|
41650
|
+
formState: { values: values2 }
|
41651
|
+
} = useEditorContext();
|
41652
|
+
const { onUploadImage, onAddCollection } = useEditorProps();
|
41653
|
+
const { focusIdx: focusIdx2, setFocusIdx } = useFocusIdx();
|
41654
|
+
const { setHoverIdx, setIsDragging, setDirection } = useHoverIdx();
|
41655
|
+
const { moveBlock, setValueByIdx: setValueByIdx2, copyBlock, removeBlock } = useBlock();
|
41656
|
+
const {
|
41657
|
+
setBlockLayerRef,
|
41658
|
+
allowDrop,
|
41659
|
+
blockLayerRef,
|
41660
|
+
removeHightLightClassName
|
41661
|
+
} = useAvatarWrapperDrop();
|
41662
|
+
const [contextMenuData, setContextMenuData] = useState(null);
|
41663
|
+
const onToggleVisible = useCallback(({ id }, e) => {
|
41664
|
+
e.stopPropagation();
|
41665
|
+
const blockData = lodash.exports.get(values2, id);
|
41666
|
+
if (blockData) {
|
41667
|
+
blockData.data.hidden = !Boolean(blockData.data.hidden);
|
41668
|
+
setValueByIdx2(id, blockData);
|
41669
|
+
}
|
41670
|
+
}, [setValueByIdx2, values2]);
|
41671
|
+
const renderTitle = useCallback((data) => {
|
41672
|
+
const block2 = BlockManager.getBlockByType(data.type);
|
41673
|
+
const isPage = data.type === BasicType.PAGE;
|
41674
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
41675
|
+
"data-tree-idx": data.id,
|
41676
|
+
className: classnames(styles$6.title, !isPage && getNodeIdxClassName(data.id), !isPage && "email-block")
|
41770
41677
|
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
41771
|
-
|
41772
|
-
|
41773
|
-
|
41774
|
-
|
41775
|
-
|
41776
|
-
|
41777
|
-
})
|
41778
|
-
|
41779
|
-
|
41780
|
-
|
41781
|
-
|
41782
|
-
|
41783
|
-
|
41784
|
-
|
41785
|
-
|
41786
|
-
|
41787
|
-
|
41788
|
-
|
41789
|
-
|
41790
|
-
|
41791
|
-
|
41792
|
-
}
|
41793
|
-
const
|
41794
|
-
|
41795
|
-
|
41796
|
-
|
41797
|
-
|
41798
|
-
|
41799
|
-
|
41800
|
-
|
41801
|
-
|
41802
|
-
];
|
41803
|
-
|
41804
|
-
|
41678
|
+
size: "smallest"
|
41679
|
+
}, block2 == null ? void 0 : block2.name), /* @__PURE__ */ React__default.createElement("div", {
|
41680
|
+
className: styles$6.eyeIcon
|
41681
|
+
}, /* @__PURE__ */ React__default.createElement(EyeIcon$1, {
|
41682
|
+
blockData: data,
|
41683
|
+
onToggleVisible
|
41684
|
+
})));
|
41685
|
+
}, [onToggleVisible]);
|
41686
|
+
const treeData = useMemo(() => {
|
41687
|
+
const copyData = lodash.exports.cloneDeep(pageData2);
|
41688
|
+
const loop2 = (item2, id, parent2) => {
|
41689
|
+
item2.id = id;
|
41690
|
+
item2.parent = parent2;
|
41691
|
+
item2.children.map((child, index2) => loop2(child, getChildIdx(id, index2), item2));
|
41692
|
+
};
|
41693
|
+
loop2(copyData, getPageIdx(), null);
|
41694
|
+
return [copyData];
|
41695
|
+
}, [pageData2]);
|
41696
|
+
const onSelect = useCallback((selectedId) => {
|
41697
|
+
setFocusIdx(selectedId);
|
41698
|
+
scrollBlockEleIntoView({ idx: selectedId });
|
41699
|
+
}, [setFocusIdx]);
|
41700
|
+
const onContextMenu = useCallback((blockData, ev) => {
|
41701
|
+
ev.preventDefault();
|
41702
|
+
setContextMenuData({ blockData, left: ev.clientX, top: ev.clientY });
|
41703
|
+
}, []);
|
41704
|
+
const onCloseContextMenu = useCallback((ev) => {
|
41705
|
+
setContextMenuData(null);
|
41706
|
+
}, []);
|
41707
|
+
const onMouseEnter = useCallback((id) => {
|
41708
|
+
setHoverIdx(id);
|
41709
|
+
}, [setHoverIdx]);
|
41710
|
+
const onMouseLeave = useCallback(() => {
|
41711
|
+
setHoverIdx("");
|
41712
|
+
}, [setHoverIdx]);
|
41713
|
+
const onDragStart = useCallback(() => {
|
41714
|
+
setIsDragging(true);
|
41715
|
+
}, [setIsDragging]);
|
41716
|
+
const onDragEnd = useCallback(() => {
|
41717
|
+
setIsDragging(false);
|
41718
|
+
}, [setIsDragging]);
|
41719
|
+
const onDrop = useCallback((params) => {
|
41720
|
+
const { dragNode, dropNode, dropPosition } = params;
|
41721
|
+
const dragBlock = BlockManager.getBlockByType(dragNode.dataRef.type);
|
41722
|
+
if (!dragBlock)
|
41723
|
+
return false;
|
41724
|
+
const dropIndex = getIndexByIdx(dropNode.key);
|
41725
|
+
if (dropPosition === 0) {
|
41726
|
+
if (dragBlock.validParentType.includes(dropNode.dataRef.type) && dropNode.dataRef.children.length === 0) {
|
41727
|
+
moveBlock(dragNode.key, getChildIdx(dropNode.key, 0));
|
41728
|
+
} else if (dropNode.parent && dragBlock.validParentType.includes(dropNode.parent.type)) {
|
41729
|
+
moveBlock(dragNode.key, getChildIdx(dropNode.parentKey, dropIndex));
|
41730
|
+
}
|
41731
|
+
} else {
|
41732
|
+
moveBlock(dragNode.key, getChildIdx(dropNode.parentKey, dropPosition > 0 ? dropIndex + 1 : dropIndex));
|
41733
|
+
}
|
41734
|
+
}, [moveBlock]);
|
41735
|
+
useEffect(() => {
|
41736
|
+
if (!blockLayerRef)
|
41737
|
+
return;
|
41738
|
+
if (focusIdx2) {
|
41739
|
+
setTimeout(() => {
|
41740
|
+
const selectedNode = blockLayerRef.querySelector(`[${DATA_ATTRIBUTE_ID}="${focusIdx2}"]`);
|
41741
|
+
if (selectedNode) {
|
41742
|
+
selectedNode.scrollIntoView({
|
41743
|
+
block: "center",
|
41744
|
+
behavior: "smooth"
|
41745
|
+
});
|
41746
|
+
}
|
41747
|
+
}, 50);
|
41748
|
+
}
|
41749
|
+
}, [blockLayerRef, focusIdx2]);
|
41750
|
+
const blockTreeAllowDrop = useCallback((data) => {
|
41751
|
+
var _a, _b;
|
41752
|
+
const dropResult = allowDrop(data);
|
41753
|
+
if (dropResult) {
|
41754
|
+
const node = (_b = (_a = document.querySelector(`[data-tree-idx="${dropResult.key}"]`)) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.parentNode;
|
41755
|
+
if (node instanceof HTMLElement) {
|
41756
|
+
removeHightLightClassName();
|
41757
|
+
node.classList.add("arco-tree-node-title-gap-bottom");
|
41758
|
+
}
|
41759
|
+
setDirection(getDirectionFormDropPosition(dropResult.position));
|
41760
|
+
setHoverIdx(dropResult.key);
|
41761
|
+
}
|
41762
|
+
return dropResult;
|
41763
|
+
}, [allowDrop]);
|
41764
|
+
const hasFocus = Boolean(focusIdx2);
|
41805
41765
|
return useMemo(() => {
|
41806
|
-
|
41807
|
-
|
41808
|
-
|
41809
|
-
|
41810
|
-
|
41766
|
+
if (!hasFocus)
|
41767
|
+
return null;
|
41768
|
+
return /* @__PURE__ */ React__default.createElement("div", __spreadValues({
|
41769
|
+
ref: setBlockLayerRef,
|
41770
|
+
id: "BlockLayerManager"
|
41771
|
+
}, {
|
41772
|
+
[DATA_ATTRIBUTE_DROP_CONTAINER]: "true"
|
41773
|
+
}), /* @__PURE__ */ React__default.createElement(BlockTree, {
|
41774
|
+
selectedId: focusIdx2,
|
41775
|
+
defaultExpandAll: true,
|
41776
|
+
treeData,
|
41777
|
+
renderTitle,
|
41778
|
+
allowDrop: blockTreeAllowDrop,
|
41779
|
+
onContextMenu,
|
41780
|
+
onDrop,
|
41781
|
+
onDragStart,
|
41782
|
+
onDragEnd,
|
41783
|
+
onSelect,
|
41784
|
+
onMouseEnter,
|
41785
|
+
onMouseLeave
|
41786
|
+
}), contextMenuData && /* @__PURE__ */ React__default.createElement(ContextMenu, {
|
41787
|
+
onClose: onCloseContextMenu,
|
41788
|
+
moveBlock,
|
41789
|
+
copyBlock,
|
41790
|
+
removeBlock,
|
41791
|
+
contextMenuData
|
41811
41792
|
}));
|
41812
|
-
}, [
|
41813
|
-
|
41814
|
-
|
41815
|
-
|
41816
|
-
|
41817
|
-
|
41818
|
-
|
41819
|
-
|
41820
|
-
|
41821
|
-
|
41822
|
-
|
41823
|
-
|
41824
|
-
|
41825
|
-
|
41826
|
-
|
41827
|
-
|
41828
|
-
|
41829
|
-
|
41830
|
-
|
41831
|
-
|
41832
|
-
|
41833
|
-
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
41834
|
-
label: "Bottom",
|
41835
|
-
quickchange: true,
|
41836
|
-
name: `${focusIdx2}.attributes.marginBottom`,
|
41837
|
-
inline: true
|
41838
|
-
}))), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
41839
|
-
wrap: false
|
41840
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
41841
|
-
fill: true
|
41842
|
-
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
41843
|
-
label: "Left",
|
41844
|
-
quickchange: true,
|
41845
|
-
name: `${focusIdx2}.attributes.marginLeft`,
|
41846
|
-
inline: true
|
41847
|
-
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
41848
|
-
fill: true
|
41849
|
-
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
41850
|
-
label: "Right",
|
41851
|
-
quickchange: true,
|
41852
|
-
name: `${focusIdx2}.attributes.marginRight`,
|
41853
|
-
inline: true
|
41854
|
-
}))));
|
41855
|
-
}, [focusIdx2]);
|
41793
|
+
}, [
|
41794
|
+
hasFocus,
|
41795
|
+
focusIdx2,
|
41796
|
+
treeData,
|
41797
|
+
renderTitle,
|
41798
|
+
allowDrop,
|
41799
|
+
onContextMenu,
|
41800
|
+
onDrop,
|
41801
|
+
onSelect,
|
41802
|
+
onMouseEnter,
|
41803
|
+
onMouseLeave,
|
41804
|
+
contextMenuData,
|
41805
|
+
onCloseContextMenu,
|
41806
|
+
onUploadImage,
|
41807
|
+
onAddCollection,
|
41808
|
+
moveBlock,
|
41809
|
+
copyBlock,
|
41810
|
+
removeBlock,
|
41811
|
+
onDragEnd,
|
41812
|
+
onDragStart
|
41813
|
+
]);
|
41856
41814
|
}
|
41857
41815
|
const BlocksPanel$1 = "_BlocksPanel_15fho_1";
|
41858
41816
|
const blockItem = "_blockItem_15fho_5";
|
41859
41817
|
const closeBtn = "_closeBtn_15fho_12";
|
41860
|
-
var styles$
|
41818
|
+
var styles$2 = {
|
41861
41819
|
BlocksPanel: BlocksPanel$1,
|
41862
41820
|
blockItem,
|
41863
41821
|
closeBtn
|
@@ -41915,7 +41873,7 @@ __publicField(BlockMarketManager, "category", []);
|
|
41915
41873
|
__publicField(BlockMarketManager, "subscriptHandles", []);
|
41916
41874
|
const mask = "_mask_1a0xw_1";
|
41917
41875
|
const drag = "_drag_1a0xw_12";
|
41918
|
-
var styles$
|
41876
|
+
var styles$1 = {
|
41919
41877
|
mask,
|
41920
41878
|
drag
|
41921
41879
|
};
|
@@ -41925,7 +41883,7 @@ const BlockMaskWrapper = (props) => {
|
|
41925
41883
|
const { type, payload } = props;
|
41926
41884
|
const onMouseDown = useCallback(() => {
|
41927
41885
|
if (ref.current) {
|
41928
|
-
ref.current.classList.add(styles$
|
41886
|
+
ref.current.classList.add(styles$1.drag);
|
41929
41887
|
}
|
41930
41888
|
}, []);
|
41931
41889
|
const onMaskMouseDown = useCallback((ev) => {
|
@@ -41937,7 +41895,7 @@ const BlockMaskWrapper = (props) => {
|
|
41937
41895
|
useEffect(() => {
|
41938
41896
|
const mouseup = () => {
|
41939
41897
|
if (ref.current) {
|
41940
|
-
ref.current.classList.remove(styles$
|
41898
|
+
ref.current.classList.remove(styles$1.drag);
|
41941
41899
|
}
|
41942
41900
|
};
|
41943
41901
|
document.addEventListener("mouseup", mouseup);
|
@@ -41948,7 +41906,7 @@ const BlockMaskWrapper = (props) => {
|
|
41948
41906
|
return /* @__PURE__ */ React__default.createElement("div", {
|
41949
41907
|
style: { position: "relative" }
|
41950
41908
|
}, props.children, /* @__PURE__ */ React__default.createElement("div", {
|
41951
|
-
className: styles$
|
41909
|
+
className: styles$1.wrapper,
|
41952
41910
|
style: {
|
41953
41911
|
position: "absolute",
|
41954
41912
|
height: "100%",
|
@@ -41963,7 +41921,7 @@ const BlockMaskWrapper = (props) => {
|
|
41963
41921
|
payload
|
41964
41922
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
41965
41923
|
ref,
|
41966
|
-
className: styles$
|
41924
|
+
className: styles$1.mask,
|
41967
41925
|
onMouseDown: onMaskMouseDown
|
41968
41926
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
41969
41927
|
ref: dragRef,
|
@@ -44009,13 +43967,13 @@ const BlocksPanel = (props) => {
|
|
44009
43967
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
44010
43968
|
onClick: toggleVisible
|
44011
43969
|
}, props.children), ele && visible && createPortal(/* @__PURE__ */ React__default.createElement("div", {
|
44012
|
-
className: styles$
|
43970
|
+
className: styles$2.BlocksPanel,
|
44013
43971
|
style: {
|
44014
43972
|
pointerEvents: isDragging ? "none" : void 0,
|
44015
43973
|
position: "fixed",
|
44016
43974
|
width: isDragging ? 0 : 650,
|
43975
|
+
backgroundColor: "var(--color-bg-2)",
|
44017
43976
|
zIndex: 200,
|
44018
|
-
top: 0,
|
44019
43977
|
left: 60,
|
44020
43978
|
maxHeight: "85vh",
|
44021
43979
|
transition: "width .5s",
|
@@ -44025,7 +43983,7 @@ const BlocksPanel = (props) => {
|
|
44025
43983
|
bodyStyle: { padding: 0 },
|
44026
43984
|
title: "Drag block",
|
44027
43985
|
extra: /* @__PURE__ */ React__default.createElement("div", {
|
44028
|
-
className: styles$
|
43986
|
+
className: styles$2.closeBtn
|
44029
43987
|
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
44030
43988
|
iconName: "icon-close",
|
44031
43989
|
onClick: toggleVisible
|
@@ -44036,7 +43994,8 @@ const BlocksPanel = (props) => {
|
|
44036
43994
|
}, filterCategories.map((category, index2) => /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
|
44037
43995
|
style: {
|
44038
43996
|
padding: 0,
|
44039
|
-
overflow: "auto"
|
43997
|
+
overflow: "auto",
|
43998
|
+
height: 500
|
44040
43999
|
},
|
44041
44000
|
key: category.title,
|
44042
44001
|
title: /* @__PURE__ */ React__default.createElement("div", {
|
@@ -44051,17 +44010,16 @@ const BlocksPanel = (props) => {
|
|
44051
44010
|
};
|
44052
44011
|
const BlockPanelItem = React__default.memo((props) => {
|
44053
44012
|
return /* @__PURE__ */ React__default.createElement(Tabs$1, {
|
44054
|
-
style: { padding: "20px 0" },
|
44055
44013
|
tabPosition: "left"
|
44056
44014
|
}, props.category.blocks.map((block2, index2) => {
|
44057
44015
|
return /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
|
44058
|
-
style: { padding: 0 },
|
44016
|
+
style: { padding: 0, height: 500 },
|
44059
44017
|
key: block2.title,
|
44060
44018
|
title: /* @__PURE__ */ React__default.createElement(Stack$6, {
|
44061
44019
|
alignment: "center",
|
44062
44020
|
spacing: "extraTight"
|
44063
44021
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
44064
|
-
className: styles$
|
44022
|
+
className: styles$2.blockItem
|
44065
44023
|
}, block2.title), block2.description && /* @__PURE__ */ React__default.createElement(Help, {
|
44066
44024
|
title: block2.description
|
44067
44025
|
}))
|
@@ -44078,11 +44036,14 @@ const BlockPanelItem = React__default.memo((props) => {
|
|
44078
44036
|
}));
|
44079
44037
|
});
|
44080
44038
|
function ShortcutToolbar() {
|
44039
|
+
const blocksPanelRef = useRef(null);
|
44081
44040
|
return /* @__PURE__ */ React__default.createElement(Stack$6, {
|
44082
44041
|
vertical: true,
|
44083
44042
|
alignment: "center",
|
44084
44043
|
distribution: "center"
|
44085
|
-
}, /* @__PURE__ */ React__default.createElement(
|
44044
|
+
}, /* @__PURE__ */ React__default.createElement(BlocksPanel, null, /* @__PURE__ */ React__default.createElement("div", {
|
44045
|
+
ref: blocksPanelRef
|
44046
|
+
})), /* @__PURE__ */ React__default.createElement(BlockAvatarWrapper, {
|
44086
44047
|
type: BasicType.TEXT
|
44087
44048
|
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
44088
44049
|
title: "Text",
|
@@ -44126,22 +44087,25 @@ function ShortcutToolbar() {
|
|
44126
44087
|
cursor: "move",
|
44127
44088
|
color: "#e5afe5"
|
44128
44089
|
}
|
44129
|
-
})), /* @__PURE__ */ React__default.createElement(
|
44090
|
+
})), /* @__PURE__ */ React__default.createElement(IconFont, {
|
44091
|
+
onClick: () => {
|
44092
|
+
var _a;
|
44093
|
+
return (_a = blocksPanelRef.current) == null ? void 0 : _a.click();
|
44094
|
+
},
|
44130
44095
|
iconName: "icon-more",
|
44131
44096
|
style: {
|
44132
44097
|
display: "flex",
|
44133
44098
|
alignItems: "center",
|
44134
44099
|
justifyContent: "center",
|
44135
|
-
color: "#000",
|
44136
44100
|
width: 30,
|
44137
44101
|
height: 30,
|
44138
44102
|
borderRadius: "50%",
|
44139
|
-
|
44103
|
+
color: "var(--color-text-2)",
|
44104
|
+
boxShadow: "0 0 12px -3px var(--color-text-2)",
|
44140
44105
|
fontSize: 18
|
44141
44106
|
}
|
44142
|
-
}))
|
44107
|
+
}));
|
44143
44108
|
}
|
44144
|
-
var styles$1 = {};
|
44145
44109
|
function SourceCodePanel() {
|
44146
44110
|
const { setValueByIdx, focusBlock, values } = useBlock();
|
44147
44111
|
const { focusIdx } = useFocusIdx();
|
@@ -44152,7 +44116,7 @@ function SourceCodePanel() {
|
|
44152
44116
|
return "";
|
44153
44117
|
return JSON.stringify(focusBlock, null, 2) || "";
|
44154
44118
|
}, [focusBlock]);
|
44155
|
-
const
|
44119
|
+
const onChangeCode = useCallback((event) => {
|
44156
44120
|
try {
|
44157
44121
|
const parseValue = JSON.parse(JSON.stringify(eval("(" + event.target.value + ")")));
|
44158
44122
|
const block = BlockManager.getBlockByType(parseValue.type);
|
@@ -44197,9 +44161,7 @@ function SourceCodePanel() {
|
|
44197
44161
|
}, [focusBlock, focusIdx, pageData]);
|
44198
44162
|
if (!focusBlock)
|
44199
44163
|
return null;
|
44200
|
-
return /* @__PURE__ */ React__default.createElement(Collapse$1, {
|
44201
|
-
className: styles$1.wrapper
|
44202
|
-
}, /* @__PURE__ */ React__default.createElement(Collapse$1.Item, {
|
44164
|
+
return /* @__PURE__ */ React__default.createElement(Collapse$1, null, /* @__PURE__ */ React__default.createElement(Collapse$1.Item, {
|
44203
44165
|
name: "json",
|
44204
44166
|
header: "Json source",
|
44205
44167
|
contentStyle: { padding: "8px 13px" }
|
@@ -44207,7 +44169,7 @@ function SourceCodePanel() {
|
|
44207
44169
|
key: code,
|
44208
44170
|
defaultValue: code,
|
44209
44171
|
autoSize: { maxRows: 25 },
|
44210
|
-
onBlur:
|
44172
|
+
onBlur: onChangeCode
|
44211
44173
|
})), /* @__PURE__ */ React__default.createElement(Collapse$1.Item, {
|
44212
44174
|
name: "mjml",
|
44213
44175
|
header: "MJML source",
|
@@ -44261,7 +44223,7 @@ function Toolbar({
|
|
44261
44223
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
44262
44224
|
style: {
|
44263
44225
|
color: "#ffffff",
|
44264
|
-
backgroundColor: "
|
44226
|
+
backgroundColor: "var(--selected-color)",
|
44265
44227
|
height: "22px",
|
44266
44228
|
display: "inline-flex",
|
44267
44229
|
padding: "1px 5px",
|
@@ -44301,7 +44263,7 @@ function ToolItem(props) {
|
|
44301
44263
|
onClick: props.onClick,
|
44302
44264
|
style: {
|
44303
44265
|
color: "#ffffff",
|
44304
|
-
backgroundColor: "
|
44266
|
+
backgroundColor: "var(--selected-color)",
|
44305
44267
|
height: 22,
|
44306
44268
|
fontSize: props.width || 14,
|
44307
44269
|
lineHeight: "22px",
|
@@ -44311,7 +44273,7 @@ function ToolItem(props) {
|
|
44311
44273
|
cursor: "pointer",
|
44312
44274
|
justifyContent: "center"
|
44313
44275
|
},
|
44314
|
-
className: classnames
|
44276
|
+
className: classnames("iconfont", props.iconName)
|
44315
44277
|
});
|
44316
44278
|
}
|
44317
44279
|
function FocusTooltip() {
|
@@ -44656,10 +44618,9 @@ var styles = {
|
|
44656
44618
|
container,
|
44657
44619
|
customScrollBar
|
44658
44620
|
};
|
44659
|
-
const { TabPane } = Tabs$1;
|
44660
44621
|
const SimpleLayout = (props) => {
|
44661
44622
|
const { height: containerHeight } = useEditorProps();
|
44662
|
-
return /* @__PURE__ */ React__default.createElement(Layout$1,
|
44623
|
+
return /* @__PURE__ */ React__default.createElement(Layout$1, {
|
44663
44624
|
style: {
|
44664
44625
|
display: "flex",
|
44665
44626
|
width: "100vw",
|
@@ -44667,40 +44628,38 @@ const SimpleLayout = (props) => {
|
|
44667
44628
|
minWidth: 1400
|
44668
44629
|
}
|
44669
44630
|
}, /* @__PURE__ */ React__default.createElement(Layout$1.Sider, {
|
44670
|
-
theme: "light",
|
44671
|
-
width: 60,
|
44672
|
-
style: { border: "1px solid #f0f0f0" }
|
44673
|
-
}, /* @__PURE__ */ React__default.createElement(ShortcutToolbar, null)), /* @__PURE__ */ React__default.createElement(Layout$1.Sider, {
|
44674
44631
|
style: {
|
44675
|
-
|
44632
|
+
width: 360
|
44633
|
+
}
|
44634
|
+
}, /* @__PURE__ */ React__default.createElement(Card$1, {
|
44635
|
+
bodyStyle: { padding: 0 },
|
44636
|
+
style: { border: "none" }
|
44637
|
+
}, /* @__PURE__ */ React__default.createElement(Card$1.Grid, {
|
44638
|
+
style: { width: 60 }
|
44639
|
+
}, /* @__PURE__ */ React__default.createElement(ShortcutToolbar, null)), /* @__PURE__ */ React__default.createElement(Card$1.Grid, {
|
44640
|
+
className: styles.customScrollBar,
|
44641
|
+
style: {
|
44642
|
+
width: 300,
|
44643
|
+
paddingBottom: 50,
|
44644
|
+
border: "none",
|
44676
44645
|
height: containerHeight,
|
44677
44646
|
overflow: "auto"
|
44678
|
-
}
|
44679
|
-
className: styles.customScrollBar,
|
44680
|
-
theme: "light",
|
44681
|
-
width: 300
|
44647
|
+
}
|
44682
44648
|
}, /* @__PURE__ */ React__default.createElement(Card$1, {
|
44683
|
-
|
44684
|
-
style: {
|
44685
|
-
}, /* @__PURE__ */ React__default.createElement(Tabs$1, {
|
44686
|
-
style: { borderLeft: "none" },
|
44687
|
-
defaultActiveTab: "Layout"
|
44688
|
-
}, /* @__PURE__ */ React__default.createElement(TabPane, {
|
44689
|
-
style: { paddingTop: 10 },
|
44690
|
-
key: "Layout",
|
44691
|
-
title: "Layout"
|
44649
|
+
title: "Layout",
|
44650
|
+
style: { border: "none" }
|
44692
44651
|
}, /* @__PURE__ */ React__default.createElement(BlockLayer, null))))), /* @__PURE__ */ React__default.createElement(Layout$1, {
|
44693
44652
|
style: { height: containerHeight }
|
44694
44653
|
}, props.children), /* @__PURE__ */ React__default.createElement(Layout$1.Sider, {
|
44695
44654
|
style: { height: containerHeight },
|
44696
|
-
theme: "light",
|
44697
44655
|
width: 350
|
44698
44656
|
}, /* @__PURE__ */ React__default.createElement(Card$1, {
|
44699
44657
|
size: "small",
|
44700
44658
|
id: "rightSide",
|
44701
44659
|
style: {
|
44702
44660
|
maxHeight: "100%",
|
44703
|
-
height: "100%"
|
44661
|
+
height: "100%",
|
44662
|
+
borderLeft: "none"
|
44704
44663
|
},
|
44705
44664
|
bodyStyle: { padding: 0 },
|
44706
44665
|
className: styles.customScrollBar
|
@@ -44711,7 +44670,7 @@ const SimpleLayout = (props) => {
|
|
44711
44670
|
}, /* @__PURE__ */ React__default.createElement(AttributePanel, null)), /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
|
44712
44671
|
key: "Source code",
|
44713
44672
|
title: "Source code"
|
44714
|
-
}, /* @__PURE__ */ React__default.createElement(SourceCodePanel, null)))))
|
44673
|
+
}, /* @__PURE__ */ React__default.createElement(SourceCodePanel, null))))), /* @__PURE__ */ React__default.createElement(InteractivePrompt, null));
|
44715
44674
|
};
|
44716
44675
|
export { EditTabField 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, AutoCompleteField as R, ShortcutToolbar as S, TextAlign as T, UploadField as U, VerticalAlign as V, Width as W, RadioGroupField as X, SwitchField as Y, DatePickerField as Z, CheckboxField as _, BlockAttributeConfigurationManager as a, InlineTextField as a0, enhancer as a1, RichTextField as a2, 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 };
|
44717
44676
|
//# sourceMappingURL=index2.js.map
|