easy-email-extensions 3.0.9 → 3.0.13
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/components/BlockTreeItem/index.d.ts +23 -23
- package/lib/BlockLayer/components/BlockTree/components/TreeCollapse.d.ts +6 -6
- package/lib/BlockLayer/components/BlockTree/index.d.ts +29 -29
- package/lib/BlockLayer/components/ContextMenu/index.d.ts +14 -14
- package/lib/BlockLayer/components/EyeIcon/index.d.ts +7 -7
- package/lib/BlockLayer/index.d.ts +7 -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 -0
- package/lib/components/Form/{RichTextField → RichTextToolBar}/components/FontFamily/index.d.ts +3 -3
- package/lib/components/Form/{RichTextField → RichTextToolBar}/components/FontSizeList/index.d.ts +3 -3
- package/lib/components/Form/{RichTextField → RichTextToolBar}/components/Heading/index.d.ts +3 -3
- package/lib/components/Form/{RichTextField → RichTextToolBar}/components/Link/index.d.ts +12 -12
- package/lib/components/Form/{RichTextField/components/TextToolbar → RichTextToolBar/components/MergeTags}/MergeTags.d.ts +6 -6
- package/lib/components/Form/RichTextToolBar/components/MergeTags/index.d.ts +1 -0
- package/lib/components/Form/{RichTextField → RichTextToolBar}/components/ToolItem/index.d.ts +7 -7
- package/lib/components/Form/RichTextToolBar/components/Tools/Tools.d.ts +5 -0
- package/lib/components/Form/RichTextToolBar/components/Tools/index.d.ts +1 -0
- package/lib/components/Form/RichTextToolBar/index.d.ts +1 -0
- 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/index2.js +218 -247
- package/lib/index2.js.map +1 -1
- package/lib/index3.js.map +1 -1
- package/lib/utils/awaitForElement.d.ts +4 -4
- package/lib/utils/classnames.d.ts +1 -1
- package/package.json +13 -3
- package/readme.md +138 -138
- package/lib/components/Form/RichTextField/components/TextToolbar/index.d.ts +0 -5
package/lib/index2.js
CHANGED
@@ -55,7 +55,7 @@ var __async = (__this, __arguments, generator) => {
|
|
55
55
|
};
|
56
56
|
import * as React from "react";
|
57
57
|
import React__default, { useCallback, useState, useRef, useEffect, useMemo, Children, isValidElement, cloneElement, createContext, useContext, Component, memo, forwardRef, useLayoutEffect, createRef, useImperativeHandle, PureComponent, useReducer, createElement, Suspense } from "react";
|
58
|
-
import { IconFont, Stack as Stack$6, TextStyle, getBlockNodeByIdx, useBlock, getEditNode,
|
58
|
+
import { IconFont, Stack as Stack$6, TextStyle, getBlockNodeByIdx, useBlock, getEditNode, getEditContent, useEditorProps, getShadowRoot, FIXED_CONTAINER_ID, useEditorContext, useFocusIdx, scrollBlockEleIntoView, useHoverIdx, DATA_ATTRIBUTE_DROP_CONTAINER, BlockAvatarWrapper, getEditorRoot, useActiveTab, ActiveTabKeys } from "easy-email-editor";
|
59
59
|
import { BasicType, ImageManager, getIndexByIdx, getSiblingIdx, BlockManager, getPageIdx, getChildIdx, createBlockDataByType, getParentByIdx, getValueByIdx, MjmlToJson, JsonToMjml, getParentIdx, getNodeTypeFromClassName } from "easy-email-core";
|
60
60
|
import { ReactSortable } from "react-sortablejs";
|
61
61
|
import { useField, Field, useForm as useForm$1, Form as Form$3, version as version$2, useFormState } from "react-final-form";
|
@@ -38655,7 +38655,6 @@ function InlineText({ idx, onChange, children }) {
|
|
38655
38655
|
const {
|
38656
38656
|
mutators: { setFieldTouched }
|
38657
38657
|
} = useForm$1();
|
38658
|
-
const [isFocus, setIsFocus] = useState(false);
|
38659
38658
|
const [textContainer, setTextContainer] = useState(null);
|
38660
38659
|
useField(idx);
|
38661
38660
|
const { focusBlock: focusBlock2 } = useBlock();
|
@@ -38668,79 +38667,32 @@ function InlineText({ idx, onChange, children }) {
|
|
38668
38667
|
promiseObj.cancel();
|
38669
38668
|
};
|
38670
38669
|
}, [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
38670
|
useEffect(() => {
|
38677
38671
|
if (!textContainer)
|
38678
38672
|
return;
|
38679
38673
|
const container2 = getEditNode(textContainer);
|
38680
38674
|
if (container2) {
|
38681
38675
|
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
38676
|
const onPaste = (e) => {
|
38697
38677
|
var _a;
|
38698
38678
|
e.preventDefault();
|
38699
38679
|
const text = ((_a = e.clipboardData) == null ? void 0 : _a.getData("text/plain")) || "";
|
38700
38680
|
document.execCommand("insertHTML", false, text);
|
38701
|
-
|
38702
|
-
|
38703
|
-
e.preventDefault();
|
38704
|
-
e.stopPropagation();
|
38681
|
+
setFieldTouched(idx, true);
|
38682
|
+
onChange(getEditContent(textContainer));
|
38705
38683
|
};
|
38706
38684
|
const onInput = () => {
|
38707
38685
|
setFieldTouched(idx, true);
|
38686
|
+
onChange(getEditContent(textContainer));
|
38708
38687
|
};
|
38709
38688
|
container2.addEventListener("paste", onPaste, true);
|
38710
|
-
container2.addEventListener("dragstart", stopDrag);
|
38711
38689
|
container2.addEventListener("input", onInput);
|
38712
|
-
document.addEventListener("mousedown", onClick);
|
38713
|
-
root2.addEventListener("mousedown", onClick);
|
38714
38690
|
return () => {
|
38715
38691
|
container2.removeEventListener("paste", onPaste, true);
|
38716
|
-
container2.removeEventListener("dragstart", stopDrag);
|
38717
38692
|
container2.removeEventListener("input", onInput);
|
38718
|
-
document.removeEventListener("mousedown", onClick);
|
38719
|
-
root2.removeEventListener("mousedown", onClick);
|
38720
38693
|
};
|
38721
38694
|
}
|
38722
|
-
}, [idx,
|
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;
|
38695
|
+
}, [idx, onChange, setFieldTouched, textContainer]);
|
38744
38696
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children);
|
38745
38697
|
}
|
38746
38698
|
function AutoComplete(props) {
|
@@ -38754,56 +38706,37 @@ function AutoComplete(props) {
|
|
38754
38706
|
data: options2
|
38755
38707
|
}));
|
38756
38708
|
}
|
38757
|
-
|
38758
|
-
|
38759
|
-
|
38760
|
-
|
38761
|
-
|
38762
|
-
}
|
38763
|
-
|
38764
|
-
|
38765
|
-
|
38766
|
-
|
38767
|
-
|
38768
|
-
initX = event2.clientX;
|
38769
|
-
initY = event2.clientY;
|
38770
|
-
} else {
|
38771
|
-
initX = event2.touches[0].clientX;
|
38772
|
-
initY = event2.touches[0].clientY;
|
38773
|
-
}
|
38774
|
-
const onDragMove = lodash.exports.debounce((mEvt) => {
|
38775
|
-
let movX = 0;
|
38776
|
-
let movY = 0;
|
38777
|
-
if (isMouseEvent(mEvt)) {
|
38778
|
-
movX = mEvt.clientX;
|
38779
|
-
movY = mEvt.clientY;
|
38780
|
-
} else {
|
38781
|
-
movX = mEvt.touches[0].clientX;
|
38782
|
-
movY = mEvt.touches[0].clientY;
|
38709
|
+
function awaitForElement(idx) {
|
38710
|
+
let promiseObj = {
|
38711
|
+
cancel: () => {
|
38712
|
+
},
|
38713
|
+
promise: Promise.resolve()
|
38714
|
+
};
|
38715
|
+
promiseObj.promise = new Promise((resolve) => {
|
38716
|
+
const ele = getBlockNodeByIdx(idx);
|
38717
|
+
if (ele) {
|
38718
|
+
resolve(ele);
|
38719
|
+
return;
|
38783
38720
|
}
|
38784
|
-
const
|
38785
|
-
|
38786
|
-
|
38721
|
+
const timer = setInterval(() => {
|
38722
|
+
const ele2 = getBlockNodeByIdx(idx);
|
38723
|
+
if (ele2) {
|
38724
|
+
resolve(ele2);
|
38725
|
+
clearInterval(timer);
|
38726
|
+
}
|
38727
|
+
}, 50);
|
38728
|
+
promiseObj.cancel = () => {
|
38729
|
+
clearInterval(timer);
|
38730
|
+
};
|
38787
38731
|
});
|
38788
|
-
|
38789
|
-
|
38790
|
-
document.removeEventListener("touchmove", onDragMove);
|
38791
|
-
document.removeEventListener("touchend", onDragEnd);
|
38792
|
-
document.removeEventListener("mousemove", onDragMove);
|
38793
|
-
document.removeEventListener("mousemove", onDragEnd);
|
38794
|
-
};
|
38795
|
-
document.addEventListener("touchmove", onDragMove);
|
38796
|
-
document.addEventListener("touchend", onDragEnd);
|
38797
|
-
document.addEventListener("mousemove", onDragMove);
|
38798
|
-
document.addEventListener("mouseup", onDragEnd);
|
38799
|
-
};
|
38732
|
+
return promiseObj;
|
38733
|
+
}
|
38800
38734
|
const ToolItem$1 = (props) => {
|
38801
|
-
return /* @__PURE__ */ React__default.createElement(
|
38735
|
+
return /* @__PURE__ */ React__default.createElement("button", {
|
38736
|
+
className: "easy-email-extensions-emailToolItem",
|
38802
38737
|
title: props.title,
|
38803
|
-
size: "mini",
|
38804
|
-
icon: props.icon,
|
38805
38738
|
onClick: props.onClick
|
38806
|
-
});
|
38739
|
+
}, props.icon);
|
38807
38740
|
};
|
38808
38741
|
function getAnchorElement(node, matchLength) {
|
38809
38742
|
var _a, _b;
|
@@ -38836,7 +38769,7 @@ function Link$1(props) {
|
|
38836
38769
|
const initialValues = useMemo(() => {
|
38837
38770
|
let link = "";
|
38838
38771
|
let blank = true;
|
38839
|
-
let underline =
|
38772
|
+
let underline = true;
|
38840
38773
|
let linkNode = getLinkNode(props.currentRange);
|
38841
38774
|
if (linkNode) {
|
38842
38775
|
link = linkNode.href;
|
@@ -38888,9 +38821,8 @@ function Link$1(props) {
|
|
38888
38821
|
uncheckedText: "on",
|
38889
38822
|
inline: true
|
38890
38823
|
}))))
|
38891
|
-
}), /* @__PURE__ */ React__default.createElement(
|
38824
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
38892
38825
|
title: "Link",
|
38893
|
-
size: "mini",
|
38894
38826
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
38895
38827
|
iconName: "icon-link"
|
38896
38828
|
})
|
@@ -38928,7 +38860,14 @@ function FontSizeList(props) {
|
|
38928
38860
|
label: "48px"
|
38929
38861
|
}
|
38930
38862
|
];
|
38931
|
-
return /* @__PURE__ */ React__default.createElement(
|
38863
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
38864
|
+
style: {
|
38865
|
+
maxWidth: 150,
|
38866
|
+
maxHeight: 350,
|
38867
|
+
overflowY: "auto",
|
38868
|
+
overflowX: "hidden"
|
38869
|
+
}
|
38870
|
+
}, /* @__PURE__ */ React__default.createElement(Menu$1, {
|
38932
38871
|
onClickMenuItem: (item2) => {
|
38933
38872
|
props.onChange(item2);
|
38934
38873
|
},
|
@@ -38937,13 +38876,13 @@ function FontSizeList(props) {
|
|
38937
38876
|
}, list2.map((item2) => /* @__PURE__ */ React__default.createElement(Menu$1.Item, {
|
38938
38877
|
style: { lineHeight: "30px", height: 30 },
|
38939
38878
|
key: item2.value
|
38940
|
-
}, item2.label)));
|
38879
|
+
}, item2.label))));
|
38941
38880
|
}
|
38942
38881
|
function FontFamily$1(props) {
|
38943
38882
|
const { fontList: fontList2 = [] } = useEditorProps();
|
38944
38883
|
return /* @__PURE__ */ React__default.createElement("div", {
|
38945
38884
|
style: {
|
38946
|
-
|
38885
|
+
maxWidth: 150,
|
38947
38886
|
maxHeight: 350,
|
38948
38887
|
overflowY: "auto",
|
38949
38888
|
overflowX: "hidden"
|
@@ -38953,7 +38892,7 @@ function FontFamily$1(props) {
|
|
38953
38892
|
props.onChange(item2);
|
38954
38893
|
},
|
38955
38894
|
selectedKeys: [],
|
38956
|
-
style: { border: "none" }
|
38895
|
+
style: { border: "none", padding: 0 }
|
38957
38896
|
}, fontList2.map((item2) => /* @__PURE__ */ React__default.createElement(Menu$1.Item, {
|
38958
38897
|
style: { lineHeight: "30px", height: 30 },
|
38959
38898
|
key: item2.value
|
@@ -38999,7 +38938,8 @@ const MergeTags$1 = React__default.memo((props) => {
|
|
38999
38938
|
onSelect: (vals) => onSelect(vals[0])
|
39000
38939
|
}));
|
39001
38940
|
});
|
39002
|
-
|
38941
|
+
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";
|
38942
|
+
function Tools(props) {
|
39003
38943
|
const { container: container2 } = props;
|
39004
38944
|
const { mergeTags } = useEditorProps();
|
39005
38945
|
const [selectionRange, setSelectionRange] = useState(null);
|
@@ -39065,47 +39005,60 @@ function TextToolbar(props) {
|
|
39065
39005
|
};
|
39066
39006
|
const getPopoverMountNode = () => document.getElementById(FIXED_CONTAINER_ID);
|
39067
39007
|
return /* @__PURE__ */ React__default.createElement("div", {
|
39068
|
-
id: "
|
39008
|
+
id: "Tools",
|
39069
39009
|
style: { display: "flex", flexWrap: "nowrap" }
|
39070
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39071
|
-
|
39072
|
-
|
39073
|
-
|
39074
|
-
|
39075
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39076
|
-
|
39077
|
-
|
39010
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
39011
|
+
style: {
|
39012
|
+
display: "flex",
|
39013
|
+
alignItems: "center"
|
39014
|
+
}
|
39015
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
39016
|
+
className: "easy-email-extensions-divider"
|
39017
|
+
}), /* @__PURE__ */ React__default.createElement(Popover$1, {
|
39018
|
+
className: "easy-email-extensions-Tools-Popover",
|
39019
|
+
trigger: "click",
|
39020
|
+
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$1), /* @__PURE__ */ React__default.createElement(FontFamily$1, {
|
39078
39021
|
onChange: (val) => execCommand("fontName", val)
|
39079
|
-
}),
|
39022
|
+
})),
|
39080
39023
|
getPopupContainer: getPopoverMountNode
|
39081
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39082
|
-
|
39024
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39025
|
+
title: "font family",
|
39083
39026
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39084
39027
|
iconName: "icon-font-family"
|
39085
39028
|
})
|
39086
|
-
})), /* @__PURE__ */ React__default.createElement(
|
39029
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
39030
|
+
className: "easy-email-extensions-divider"
|
39031
|
+
}), /* @__PURE__ */ React__default.createElement(Popover$1, {
|
39032
|
+
className: "easy-email-extensions-Tools-Popover",
|
39087
39033
|
color: "#fff",
|
39088
|
-
|
39034
|
+
trigger: "click",
|
39035
|
+
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$1), /* @__PURE__ */ React__default.createElement(FontSizeList, {
|
39089
39036
|
onChange: (val) => execCommand("fontSize", val)
|
39090
|
-
}),
|
39037
|
+
})),
|
39091
39038
|
getPopupContainer: getPopoverMountNode
|
39092
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39093
|
-
|
39039
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39040
|
+
title: "line-height",
|
39094
39041
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39095
39042
|
iconName: "icon-line-height"
|
39096
39043
|
})
|
39097
|
-
})), /* @__PURE__ */ React__default.createElement(
|
39044
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
39045
|
+
className: "easy-email-extensions-divider"
|
39046
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39098
39047
|
onClick: () => execCommand("bold"),
|
39099
39048
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39100
39049
|
iconName: "icon-bold"
|
39101
39050
|
}),
|
39102
39051
|
title: "Bold"
|
39052
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39053
|
+
className: "easy-email-extensions-divider"
|
39103
39054
|
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39104
39055
|
onClick: () => execCommand("italic"),
|
39105
39056
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39106
39057
|
iconName: "icon-italic"
|
39107
39058
|
}),
|
39108
39059
|
title: "Italic"
|
39060
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39061
|
+
className: "easy-email-extensions-divider"
|
39109
39062
|
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
39110
39063
|
label: "",
|
39111
39064
|
position: "tl",
|
@@ -39117,7 +39070,9 @@ function TextToolbar(props) {
|
|
39117
39070
|
iconName: "icon-font-color"
|
39118
39071
|
}),
|
39119
39072
|
title: "Text color"
|
39120
|
-
})), /* @__PURE__ */ React__default.createElement(
|
39073
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
39074
|
+
className: "easy-email-extensions-divider"
|
39075
|
+
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
39121
39076
|
label: "",
|
39122
39077
|
showInput: false,
|
39123
39078
|
position: "tl",
|
@@ -39128,10 +39083,14 @@ function TextToolbar(props) {
|
|
39128
39083
|
iconName: "icon-bg-colors"
|
39129
39084
|
}),
|
39130
39085
|
title: "Background color"
|
39131
|
-
})), /* @__PURE__ */ React__default.createElement(
|
39086
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
39087
|
+
className: "easy-email-extensions-divider"
|
39088
|
+
}), /* @__PURE__ */ React__default.createElement(Link$1, {
|
39132
39089
|
currentRange: selectionRange,
|
39133
39090
|
onChange: (values2) => execCommand("createLink", values2),
|
39134
39091
|
getPopupContainer: getPopoverMountNode
|
39092
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39093
|
+
className: "easy-email-extensions-divider"
|
39135
39094
|
}), mergeTags && /* @__PURE__ */ React__default.createElement(Tooltip$1, {
|
39136
39095
|
color: "#fff",
|
39137
39096
|
position: "bottom",
|
@@ -39140,21 +39099,14 @@ function TextToolbar(props) {
|
|
39140
39099
|
onChange: (val) => execCommand("insertHTML", val)
|
39141
39100
|
}),
|
39142
39101
|
getPopupContainer: getPopoverMountNode
|
39143
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39144
|
-
size: "mini",
|
39102
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39145
39103
|
title: "Merge tag",
|
39146
39104
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39147
39105
|
iconName: "icon-merge-tags"
|
39148
39106
|
})
|
39149
|
-
})), /* @__PURE__ */ React__default.createElement(
|
39150
|
-
|
39151
|
-
|
39152
|
-
iconName: "icon-close"
|
39153
|
-
}),
|
39154
|
-
title: "Remove format"
|
39155
|
-
})), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39156
|
-
spacing: "extraTight"
|
39157
|
-
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39107
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
39108
|
+
className: "easy-email-extensions-divider"
|
39109
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39158
39110
|
onClick: () => execCommand("justifyLeft"),
|
39159
39111
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39160
39112
|
iconName: "icon-align-left"
|
@@ -39172,6 +39124,8 @@ function TextToolbar(props) {
|
|
39172
39124
|
iconName: "icon-align-right"
|
39173
39125
|
}),
|
39174
39126
|
title: "Align right"
|
39127
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39128
|
+
className: "easy-email-extensions-divider"
|
39175
39129
|
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39176
39130
|
onClick: () => execCommand("insertOrderedList"),
|
39177
39131
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
@@ -39184,6 +39138,8 @@ function TextToolbar(props) {
|
|
39184
39138
|
iconName: "icon-list-ul"
|
39185
39139
|
}),
|
39186
39140
|
title: "Unorderlist"
|
39141
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39142
|
+
className: "easy-email-extensions-divider"
|
39187
39143
|
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39188
39144
|
onClick: () => execCommand("strikeThrough"),
|
39189
39145
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
@@ -39202,87 +39158,126 @@ function TextToolbar(props) {
|
|
39202
39158
|
iconName: "icon-line"
|
39203
39159
|
}),
|
39204
39160
|
title: "Line"
|
39205
|
-
})
|
39161
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39162
|
+
className: "easy-email-extensions-divider"
|
39163
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39164
|
+
onClick: () => execCommand("removeFormat"),
|
39165
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39166
|
+
iconName: "icon-close"
|
39167
|
+
}),
|
39168
|
+
title: "Remove format"
|
39169
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39170
|
+
className: "easy-email-extensions-divider"
|
39171
|
+
})));
|
39206
39172
|
}
|
39207
|
-
|
39208
|
-
|
39209
|
-
const
|
39210
|
-
const
|
39211
|
-
const [
|
39212
|
-
const
|
39213
|
-
const {
|
39214
|
-
const
|
39173
|
+
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";
|
39174
|
+
function RichTextToolBar() {
|
39175
|
+
const [direction, setDirection] = useState("top");
|
39176
|
+
const [blockNode, setBlockNode] = useState(null);
|
39177
|
+
const [offsetX, setOffsetX] = useState(0);
|
39178
|
+
const { focusBlock: focusBlock2 } = useBlock();
|
39179
|
+
const { pageData: pageData2 } = useEditorContext();
|
39180
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
39181
|
+
const pageWidth = +(pageData2.attributes.width || "600").replace("px", "");
|
39215
39182
|
useEffect(() => {
|
39216
|
-
const
|
39217
|
-
|
39218
|
-
|
39219
|
-
|
39220
|
-
|
39221
|
-
|
39222
|
-
});
|
39223
|
-
}
|
39224
|
-
}, [idx, locationState == null ? void 0 : locationState.left, locationState == null ? void 0 : locationState.top]);
|
39225
|
-
const onChange = useCallback(() => {
|
39226
|
-
}, []);
|
39227
|
-
const editorContainer = container2 && getEditNode(container2);
|
39228
|
-
const textToolbar = useMemo(() => {
|
39229
|
-
const onMoveTextToolbar = (event2) => {
|
39230
|
-
onDrag({
|
39231
|
-
event: event2,
|
39232
|
-
onMove(x, y) {
|
39233
|
-
setPosition({
|
39234
|
-
left: position.left + x,
|
39235
|
-
top: position.top + y
|
39236
|
-
});
|
39237
|
-
setLocationState({
|
39238
|
-
left: position.left + x,
|
39239
|
-
top: position.top + y
|
39240
|
-
});
|
39241
|
-
},
|
39242
|
-
onEnd() {
|
39243
|
-
}
|
39244
|
-
});
|
39183
|
+
const promiseObj = awaitForElement(focusIdx2);
|
39184
|
+
promiseObj.promise.then((blockNode2) => {
|
39185
|
+
setBlockNode(blockNode2);
|
39186
|
+
});
|
39187
|
+
return () => {
|
39188
|
+
promiseObj.cancel();
|
39245
39189
|
};
|
39246
|
-
|
39247
|
-
|
39248
|
-
|
39249
|
-
|
39250
|
-
|
39251
|
-
|
39252
|
-
|
39253
|
-
|
39254
|
-
|
39255
|
-
|
39256
|
-
|
39257
|
-
|
39258
|
-
|
39259
|
-
|
39260
|
-
|
39261
|
-
|
39262
|
-
width
|
39263
|
-
left
|
39264
|
-
|
39265
|
-
|
39266
|
-
|
39267
|
-
|
39268
|
-
|
39269
|
-
|
39270
|
-
|
39271
|
-
|
39272
|
-
|
39273
|
-
|
39274
|
-
|
39275
|
-
|
39276
|
-
};
|
39190
|
+
}, [focusIdx2, focusBlock2]);
|
39191
|
+
useEffect(() => {
|
39192
|
+
if (blockNode) {
|
39193
|
+
const options2 = {
|
39194
|
+
rootMargin: "-84px 0px 0px 0px",
|
39195
|
+
root: getShadowRoot().firstChild,
|
39196
|
+
threshold: [0, 1e-3, 0.1, 0.999, 0.8, 0.9, 1]
|
39197
|
+
};
|
39198
|
+
const checkDirection = (ev) => {
|
39199
|
+
const [current] = ev;
|
39200
|
+
const { top } = current.intersectionRect;
|
39201
|
+
const boundingClientRect = current.boundingClientRect;
|
39202
|
+
const rootBounds = current.rootBounds;
|
39203
|
+
const intersectionRatio = current.intersectionRatio;
|
39204
|
+
if (!rootBounds)
|
39205
|
+
return;
|
39206
|
+
const paddingLeft = (rootBounds.width - pageWidth) / 2;
|
39207
|
+
const offsetLeft = boundingClientRect.left - rootBounds.left;
|
39208
|
+
setOffsetX(paddingLeft - offsetLeft);
|
39209
|
+
if (intersectionRatio === 1) {
|
39210
|
+
setDirection("top");
|
39211
|
+
} else {
|
39212
|
+
if (top) {
|
39213
|
+
if (top > rootBounds.top) {
|
39214
|
+
setDirection("top");
|
39215
|
+
} else {
|
39216
|
+
setDirection("bottom");
|
39217
|
+
}
|
39218
|
+
}
|
39219
|
+
}
|
39220
|
+
};
|
39221
|
+
const observer = new IntersectionObserver(checkDirection, options2);
|
39222
|
+
observer.observe(blockNode);
|
39223
|
+
return () => {
|
39224
|
+
observer.unobserve(blockNode);
|
39225
|
+
};
|
39226
|
+
}
|
39227
|
+
}, [blockNode, pageWidth]);
|
39228
|
+
if (!blockNode)
|
39229
|
+
return null;
|
39230
|
+
const editorContainer = blockNode && getEditNode(blockNode);
|
39231
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, createPortal(/* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", {
|
39232
|
+
dangerouslySetInnerHTML: { __html: styleText }
|
39233
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39234
|
+
style: {
|
39235
|
+
transform: direction === "top" ? "translate(0,-100%)" : void 0,
|
39236
|
+
padding: "4px 8px",
|
39237
|
+
boxSizing: "border-box",
|
39238
|
+
position: "absolute",
|
39239
|
+
zIndex: 100,
|
39240
|
+
top: direction === "top" ? -40 : "calc(100% + 40px)",
|
39241
|
+
left: offsetX,
|
39242
|
+
width: pageWidth
|
39243
|
+
}
|
39244
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
39245
|
+
style: {
|
39246
|
+
position: "absolute",
|
39247
|
+
backgroundColor: "#41444d",
|
39248
|
+
height: "100%",
|
39249
|
+
width: "100%",
|
39250
|
+
left: 0,
|
39251
|
+
top: 0
|
39252
|
+
}
|
39253
|
+
}), /* @__PURE__ */ React__default.createElement(Tools, {
|
39254
|
+
container: editorContainer,
|
39255
|
+
onChange: () => {
|
39256
|
+
}
|
39257
|
+
}))), blockNode));
|
39258
|
+
}
|
39277
39259
|
const RichTextField = (props) => {
|
39278
39260
|
const { focusBlock: focusBlock2 } = useBlock();
|
39279
39261
|
const { focusIdx: focusIdx2 } = useFocusIdx();
|
39280
39262
|
if ((focusBlock2 == null ? void 0 : focusBlock2.type) !== BasicType.TEXT)
|
39281
39263
|
return null;
|
39282
|
-
|
39283
|
-
|
39284
|
-
|
39264
|
+
const name = `${focusIdx2}.data.value.content`;
|
39265
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(RichTextToolBar, null), /* @__PURE__ */ React__default.createElement(Field, {
|
39266
|
+
name,
|
39267
|
+
parse: (v) => v
|
39268
|
+
}, ({ input }) => /* @__PURE__ */ React__default.createElement(FieldWrapper, __spreadProps(__spreadValues({}, props), {
|
39269
|
+
input
|
39270
|
+
}))));
|
39285
39271
|
};
|
39272
|
+
function FieldWrapper(props) {
|
39273
|
+
const _a = props, { input } = _a, rest = __objRest(_a, ["input"]);
|
39274
|
+
const debounceCallbackChange = useCallback(lodash.exports.debounce((val) => {
|
39275
|
+
input.onChange(val);
|
39276
|
+
}, 500), [input]);
|
39277
|
+
return /* @__PURE__ */ React__default.createElement(InlineText, __spreadProps(__spreadValues({}, rest), {
|
39278
|
+
onChange: debounceCallbackChange
|
39279
|
+
}));
|
39280
|
+
}
|
39286
39281
|
const TextField = enhancer(Input, (value) => value);
|
39287
39282
|
const SearchField = enhancer(Input$5.Search, (val) => val);
|
39288
39283
|
const TextAreaField = enhancer(Input$5.TextArea, (val) => val);
|
@@ -41713,10 +41708,7 @@ function AttributePanel() {
|
|
41713
41708
|
}, "No matching components")), /* @__PURE__ */ React__default.createElement("div", {
|
41714
41709
|
style: { position: "absolute" }
|
41715
41710
|
}, /* @__PURE__ */ React__default.createElement(RichTextField, {
|
41716
|
-
idx: focusIdx2
|
41717
|
-
name: `${focusIdx2}.data.value.content`,
|
41718
|
-
label: "",
|
41719
|
-
labelHidden: true
|
41711
|
+
idx: focusIdx2
|
41720
41712
|
})), shadowRoot && ReactDOM.createPortal(/* @__PURE__ */ React__default.createElement("style", null, `
|
41721
41713
|
.email-block [contentEditable="true"],
|
41722
41714
|
.email-block [contentEditable="true"] * {
|
@@ -43999,7 +43991,6 @@ const BlocksPanel = (props) => {
|
|
43999
43991
|
tabPosition: "left",
|
44000
43992
|
size: "large"
|
44001
43993
|
}, filterCategories.map((category, index2) => /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
|
44002
|
-
className: "no-scrollbar",
|
44003
43994
|
style: {
|
44004
43995
|
padding: 0,
|
44005
43996
|
overflow: "auto"
|
@@ -44186,31 +44177,6 @@ function SourceCodePanel() {
|
|
44186
44177
|
onBlur: onMjmlChange
|
44187
44178
|
})));
|
44188
44179
|
}
|
44189
|
-
function awaitForElement(idx) {
|
44190
|
-
let promiseObj = {
|
44191
|
-
cancel: () => {
|
44192
|
-
},
|
44193
|
-
promise: Promise.resolve()
|
44194
|
-
};
|
44195
|
-
promiseObj.promise = new Promise((resolve) => {
|
44196
|
-
const ele = getBlockNodeByIdx(idx);
|
44197
|
-
if (ele) {
|
44198
|
-
resolve(ele);
|
44199
|
-
return;
|
44200
|
-
}
|
44201
|
-
const timer = setInterval(() => {
|
44202
|
-
const ele2 = getBlockNodeByIdx(idx);
|
44203
|
-
if (ele2) {
|
44204
|
-
resolve(ele2);
|
44205
|
-
clearInterval(timer);
|
44206
|
-
}
|
44207
|
-
}, 50);
|
44208
|
-
promiseObj.cancel = () => {
|
44209
|
-
clearInterval(timer);
|
44210
|
-
};
|
44211
|
-
});
|
44212
|
-
return promiseObj;
|
44213
|
-
}
|
44214
44180
|
function Toolbar({
|
44215
44181
|
block: block2,
|
44216
44182
|
direction
|
@@ -44323,22 +44289,27 @@ function FocusTooltip() {
|
|
44323
44289
|
useEffect(() => {
|
44324
44290
|
if (blockNode) {
|
44325
44291
|
const options2 = {
|
44326
|
-
rootMargin: "-24px 0px
|
44327
|
-
root: getShadowRoot().
|
44328
|
-
threshold: [0, 1e-3, 0.1, 0.
|
44292
|
+
rootMargin: "-24px 0px 0px 0px",
|
44293
|
+
root: getShadowRoot().firstChild,
|
44294
|
+
threshold: [0, 1e-3, 0.1, 0.5, 0.999, 1]
|
44329
44295
|
};
|
44330
44296
|
const checkDirection = (ev) => {
|
44331
44297
|
const [current] = ev;
|
44332
|
-
const { top
|
44298
|
+
const { top } = current.intersectionRect;
|
44333
44299
|
const rootBounds = current.rootBounds;
|
44300
|
+
const intersectionRatio = current.intersectionRatio;
|
44334
44301
|
if (!rootBounds)
|
44335
44302
|
return;
|
44336
|
-
if (
|
44303
|
+
if (intersectionRatio === 1) {
|
44337
44304
|
setDirection("top");
|
44338
|
-
} else if (rootBounds.top === top) {
|
44339
|
-
setDirection("bottom");
|
44340
44305
|
} else {
|
44341
|
-
|
44306
|
+
if (top) {
|
44307
|
+
if (top > rootBounds.top) {
|
44308
|
+
setDirection("top");
|
44309
|
+
} else {
|
44310
|
+
setDirection("bottom");
|
44311
|
+
}
|
44312
|
+
}
|
44342
44313
|
}
|
44343
44314
|
};
|
44344
44315
|
const observer = new IntersectionObserver(checkDirection, options2);
|