easy-email-extensions 3.0.7 → 3.0.11
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/components/Form/InlineTextField/index.d.ts +1 -2
- package/lib/components/Form/RichTextToolBar/RichTextToolBar.d.ts +1 -0
- package/lib/components/Form/{RichTextField → RichTextToolBar}/components/FontFamily/index.d.ts +0 -0
- package/lib/components/Form/{RichTextField → RichTextToolBar}/components/FontSizeList/index.d.ts +0 -0
- package/lib/components/Form/{RichTextField → RichTextToolBar}/components/Heading/index.d.ts +0 -0
- package/lib/components/Form/{RichTextField → RichTextToolBar}/components/Link/index.d.ts +0 -0
- package/lib/components/Form/{RichTextField/components/TextToolbar → RichTextToolBar/components/MergeTags}/MergeTags.d.ts +0 -0
- package/lib/components/Form/RichTextToolBar/components/MergeTags/index.d.ts +1 -0
- package/lib/components/Form/{RichTextField → RichTextToolBar}/components/ToolItem/index.d.ts +0 -0
- 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/RenderCount/index.d.ts +1 -0
- package/lib/index2.js +325 -288
- package/lib/index2.js.map +1 -1
- package/package.json +13 -3
- package/lib/components/Form/RichTextField/components/TextToolbar/index.d.ts +0 -5
package/lib/index2.js
CHANGED
@@ -55,10 +55,10 @@ 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, getShadowRoot, FIXED_CONTAINER_ID, getEditContent, getEditorRoot, useEditorProps,
|
58
|
+
import { IconFont, Stack as Stack$6, TextStyle, getBlockNodeByIdx, useBlock, getEditNode, getShadowRoot, FIXED_CONTAINER_ID, getEditContent, getEditorRoot, useEditorProps, useEditorContext, useFocusIdx, scrollBlockEleIntoView, useHoverIdx, DATA_ATTRIBUTE_DROP_CONTAINER, BlockAvatarWrapper, 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
|
-
import { useForm as useForm$1,
|
61
|
+
import { useField, Field, useForm as useForm$1, Form as Form$3, version as version$2, useFormState } from "react-final-form";
|
62
62
|
import ReactDOM, { findDOMNode, createPortal } from "react-dom";
|
63
63
|
var arco = "";
|
64
64
|
const title = "_title_1gyaq_1";
|
@@ -38483,75 +38483,88 @@ function enhancer(Component2, changeAdapter) {
|
|
38483
38483
|
"wrapper",
|
38484
38484
|
"debounceTime"
|
38485
38485
|
]);
|
38486
|
-
const id = useMemo(() => {
|
38487
|
-
return `enhancer-${primaryId++}`;
|
38488
|
-
}, []);
|
38489
|
-
const { change, mutators } = useForm$1();
|
38490
38486
|
const {
|
38491
|
-
input: { value,
|
38492
|
-
meta: { touched, error: error2 }
|
38487
|
+
input: { value, onChange }
|
38493
38488
|
} = useField(name, {
|
38494
38489
|
validate: validate3
|
38495
38490
|
});
|
38496
|
-
const
|
38497
|
-
|
38498
|
-
|
38499
|
-
|
38500
|
-
|
38501
|
-
|
38502
|
-
|
38503
|
-
|
38491
|
+
const [currentValue, setCurrentValue] = useState(value);
|
38492
|
+
const debounceCallbackChange = useCallback(lodash.exports.debounce((val) => {
|
38493
|
+
onChange(val);
|
38494
|
+
}, 100, {
|
38495
|
+
maxWait: 500
|
38496
|
+
}), []);
|
38497
|
+
useEffect(() => {
|
38498
|
+
setCurrentValue(value);
|
38499
|
+
}, [value]);
|
38500
|
+
const id = useMemo(() => {
|
38501
|
+
return `enhancer-${primaryId++}`;
|
38502
|
+
}, []);
|
38503
|
+
return /* @__PURE__ */ React__default.createElement(Field, {
|
38504
|
+
name,
|
38505
|
+
validate: validate3
|
38506
|
+
}, ({ input: { onBlur: onBlur3 }, meta: { touched, error: error2 } }) => {
|
38507
|
+
const onFieldChange = useCallback((e) => {
|
38508
|
+
const newVal = onChangeAdapter ? onChangeAdapter(changeAdapter(e)) : changeAdapter(e);
|
38509
|
+
setCurrentValue(newVal);
|
38510
|
+
debounceCallbackChange(newVal);
|
38511
|
+
onBlur3();
|
38512
|
+
}, [onBlur3, onChangeAdapter, debounceCallbackChange]);
|
38513
|
+
if (!wrapper2)
|
38514
|
+
return /* @__PURE__ */ React__default.createElement(Component2, __spreadProps(__spreadValues({}, rest), {
|
38515
|
+
id,
|
38516
|
+
name,
|
38517
|
+
checked: valueAdapter ? valueAdapter(currentValue) : currentValue,
|
38518
|
+
value: valueAdapter ? valueAdapter(currentValue) : currentValue,
|
38519
|
+
onChange: onFieldChange
|
38520
|
+
}));
|
38521
|
+
return /* @__PURE__ */ React__default.createElement(Form.Item, {
|
38522
|
+
noStyle: true,
|
38523
|
+
validateStatus: touched && error2 ? "error" : void 0,
|
38524
|
+
help: touched && error2
|
38525
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38526
|
+
vertical: true,
|
38527
|
+
spacing: "extraTight"
|
38528
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38529
|
+
spacing: inline ? void 0 : "extraTight",
|
38530
|
+
wrap: false,
|
38531
|
+
vertical: !inline,
|
38532
|
+
alignment: alignment ? alignment : inline ? "center" : void 0,
|
38533
|
+
distribution
|
38534
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, null, /* @__PURE__ */ React__default.createElement("label", {
|
38535
|
+
className: labelHidden2 ? styles$5["label-hidden"] : void 0,
|
38536
|
+
htmlFor: id
|
38537
|
+
}, /* @__PURE__ */ React__default.createElement("span", {
|
38538
|
+
style: { whiteSpace: "pre" }
|
38539
|
+
}, required && /* @__PURE__ */ React__default.createElement("span", {
|
38540
|
+
style: { color: "#ff4d4f" }
|
38541
|
+
}, "* "), /* @__PURE__ */ React__default.createElement(TextStyle, {
|
38542
|
+
size: size === "small" ? "smallest" : "small"
|
38543
|
+
}, label)))), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
38544
|
+
fill: inline
|
38545
|
+
}, /* @__PURE__ */ React__default.createElement(Component2, __spreadProps(__spreadValues({
|
38546
|
+
size
|
38547
|
+
}, rest), {
|
38504
38548
|
id,
|
38505
38549
|
name,
|
38506
|
-
checked: valueAdapter ? valueAdapter(
|
38507
|
-
value: valueAdapter ? valueAdapter(
|
38550
|
+
checked: valueAdapter ? valueAdapter(currentValue) : currentValue,
|
38551
|
+
value: valueAdapter ? valueAdapter(currentValue) : currentValue,
|
38508
38552
|
onChange: onFieldChange
|
38509
|
-
}))
|
38510
|
-
|
38511
|
-
|
38512
|
-
|
38513
|
-
help: touched && error2
|
38514
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38515
|
-
vertical: true,
|
38516
|
-
spacing: "extraTight"
|
38517
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38518
|
-
spacing: inline ? void 0 : "extraTight",
|
38519
|
-
wrap: false,
|
38520
|
-
vertical: !inline,
|
38521
|
-
alignment: alignment ? alignment : inline ? "center" : void 0,
|
38522
|
-
distribution
|
38523
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, null, /* @__PURE__ */ React__default.createElement("label", {
|
38524
|
-
className: labelHidden2 ? styles$5["label-hidden"] : void 0,
|
38525
|
-
htmlFor: id
|
38526
|
-
}, /* @__PURE__ */ React__default.createElement("span", {
|
38527
|
-
style: { whiteSpace: "pre" }
|
38528
|
-
}, required && /* @__PURE__ */ React__default.createElement("span", {
|
38529
|
-
style: { color: "#ff4d4f" }
|
38530
|
-
}, "* "), /* @__PURE__ */ React__default.createElement(TextStyle, {
|
38531
|
-
size: size === "small" ? "smallest" : "small"
|
38532
|
-
}, label)))), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
38533
|
-
fill: inline
|
38534
|
-
}, /* @__PURE__ */ React__default.createElement(Component2, __spreadProps(__spreadValues({
|
38535
|
-
size
|
38536
|
-
}, rest), {
|
38537
|
-
mutators,
|
38538
|
-
id,
|
38539
|
-
name,
|
38540
|
-
checked: valueAdapter ? valueAdapter(value) : value,
|
38541
|
-
value: valueAdapter ? valueAdapter(value) : value,
|
38542
|
-
onChange: onFieldChange
|
38543
|
-
})))), /* @__PURE__ */ React__default.createElement("div", {
|
38544
|
-
className: styles$5.helperText
|
38545
|
-
}, /* @__PURE__ */ React__default.createElement("small", null, helpText))));
|
38553
|
+
})))), /* @__PURE__ */ React__default.createElement("div", {
|
38554
|
+
className: styles$5.helperText
|
38555
|
+
}, /* @__PURE__ */ React__default.createElement("small", null, helpText))));
|
38556
|
+
});
|
38546
38557
|
};
|
38547
38558
|
}
|
38548
38559
|
function Input(props) {
|
38549
38560
|
const { quickchange, value = "", onKeyDown: onPropsKeyDown } = props;
|
38550
38561
|
const onChange = useCallback((val) => {
|
38551
38562
|
props.onChange(val);
|
38552
|
-
}, [props]);
|
38563
|
+
}, [props.onChange]);
|
38553
38564
|
const onKeyDown = useCallback((ev) => {
|
38554
|
-
|
38565
|
+
if (onPropsKeyDown) {
|
38566
|
+
onPropsKeyDown == null ? void 0 : onPropsKeyDown(ev);
|
38567
|
+
}
|
38555
38568
|
if (quickchange) {
|
38556
38569
|
let step = 0;
|
38557
38570
|
if (ev.key === "ArrowUp") {
|
@@ -38562,6 +38575,7 @@ function Input(props) {
|
|
38562
38575
|
}
|
38563
38576
|
if (step) {
|
38564
38577
|
if (/^\d+/.test(value)) {
|
38578
|
+
ev.preventDefault();
|
38565
38579
|
onChange(String(value).replace(/^(\d+)/, (_, match) => {
|
38566
38580
|
return (Number(match) + step).toString();
|
38567
38581
|
}));
|
@@ -38637,12 +38651,10 @@ function awaitForElement$1(idx) {
|
|
38637
38651
|
});
|
38638
38652
|
return promiseObj;
|
38639
38653
|
}
|
38640
|
-
function InlineText({
|
38641
|
-
|
38642
|
-
|
38643
|
-
|
38644
|
-
mutators: { setFieldTouched }
|
38645
|
-
}) {
|
38654
|
+
function InlineText({ idx, onChange, children }) {
|
38655
|
+
const {
|
38656
|
+
mutators: { setFieldTouched }
|
38657
|
+
} = useForm$1();
|
38646
38658
|
const [isFocus, setIsFocus] = useState(false);
|
38647
38659
|
const [textContainer, setTextContainer] = useState(null);
|
38648
38660
|
useField(idx);
|
@@ -38733,64 +38745,46 @@ function InlineText({
|
|
38733
38745
|
}
|
38734
38746
|
function AutoComplete(props) {
|
38735
38747
|
const options2 = useMemo(() => {
|
38748
|
+
const selectedValue = (props.value || "").toLowerCase();
|
38736
38749
|
return props.options.filter((item2) => {
|
38737
|
-
return lodash.exports.isString(item2.value) && item2.value.toLowerCase().startsWith(
|
38750
|
+
return lodash.exports.isString(item2.value) && item2.value.toLowerCase().startsWith(selectedValue) || lodash.exports.isString(item2.label) && item2.label.toLowerCase().startsWith(selectedValue);
|
38738
38751
|
}).map((item2) => __spreadProps(__spreadValues({}, item2), { name: item2.label }));
|
38739
38752
|
}, [props.options, props.value]);
|
38740
38753
|
return /* @__PURE__ */ React__default.createElement(ArcoAutoComplete, __spreadProps(__spreadValues({}, props), {
|
38741
38754
|
data: options2
|
38742
38755
|
}));
|
38743
38756
|
}
|
38744
|
-
|
38745
|
-
|
38746
|
-
|
38747
|
-
|
38748
|
-
|
38749
|
-
}
|
38750
|
-
|
38751
|
-
|
38752
|
-
|
38753
|
-
|
38754
|
-
|
38755
|
-
initX = event2.clientX;
|
38756
|
-
initY = event2.clientY;
|
38757
|
-
} else {
|
38758
|
-
initX = event2.touches[0].clientX;
|
38759
|
-
initY = event2.touches[0].clientY;
|
38760
|
-
}
|
38761
|
-
const onDragMove = lodash.exports.debounce((mEvt) => {
|
38762
|
-
let movX = 0;
|
38763
|
-
let movY = 0;
|
38764
|
-
if (isMouseEvent(mEvt)) {
|
38765
|
-
movX = mEvt.clientX;
|
38766
|
-
movY = mEvt.clientY;
|
38767
|
-
} else {
|
38768
|
-
movX = mEvt.touches[0].clientX;
|
38769
|
-
movY = mEvt.touches[0].clientY;
|
38757
|
+
function awaitForElement(idx) {
|
38758
|
+
let promiseObj = {
|
38759
|
+
cancel: () => {
|
38760
|
+
},
|
38761
|
+
promise: Promise.resolve()
|
38762
|
+
};
|
38763
|
+
promiseObj.promise = new Promise((resolve) => {
|
38764
|
+
const ele = getBlockNodeByIdx(idx);
|
38765
|
+
if (ele) {
|
38766
|
+
resolve(ele);
|
38767
|
+
return;
|
38770
38768
|
}
|
38771
|
-
const
|
38772
|
-
|
38773
|
-
|
38769
|
+
const timer = setInterval(() => {
|
38770
|
+
const ele2 = getBlockNodeByIdx(idx);
|
38771
|
+
if (ele2) {
|
38772
|
+
resolve(ele2);
|
38773
|
+
clearInterval(timer);
|
38774
|
+
}
|
38775
|
+
}, 50);
|
38776
|
+
promiseObj.cancel = () => {
|
38777
|
+
clearInterval(timer);
|
38778
|
+
};
|
38774
38779
|
});
|
38775
|
-
|
38776
|
-
|
38777
|
-
document.removeEventListener("touchmove", onDragMove);
|
38778
|
-
document.removeEventListener("touchend", onDragEnd);
|
38779
|
-
document.removeEventListener("mousemove", onDragMove);
|
38780
|
-
document.removeEventListener("mousemove", onDragEnd);
|
38781
|
-
};
|
38782
|
-
document.addEventListener("touchmove", onDragMove);
|
38783
|
-
document.addEventListener("touchend", onDragEnd);
|
38784
|
-
document.addEventListener("mousemove", onDragMove);
|
38785
|
-
document.addEventListener("mouseup", onDragEnd);
|
38786
|
-
};
|
38780
|
+
return promiseObj;
|
38781
|
+
}
|
38787
38782
|
const ToolItem$1 = (props) => {
|
38788
|
-
return /* @__PURE__ */ React__default.createElement(
|
38783
|
+
return /* @__PURE__ */ React__default.createElement("button", {
|
38784
|
+
className: "easy-email-extensions-emailToolItem",
|
38789
38785
|
title: props.title,
|
38790
|
-
size: "mini",
|
38791
|
-
icon: props.icon,
|
38792
38786
|
onClick: props.onClick
|
38793
|
-
});
|
38787
|
+
}, props.icon);
|
38794
38788
|
};
|
38795
38789
|
function getAnchorElement(node, matchLength) {
|
38796
38790
|
var _a, _b;
|
@@ -38823,7 +38817,7 @@ function Link$1(props) {
|
|
38823
38817
|
const initialValues = useMemo(() => {
|
38824
38818
|
let link = "";
|
38825
38819
|
let blank = true;
|
38826
|
-
let underline =
|
38820
|
+
let underline = true;
|
38827
38821
|
let linkNode = getLinkNode(props.currentRange);
|
38828
38822
|
if (linkNode) {
|
38829
38823
|
link = linkNode.href;
|
@@ -38875,9 +38869,8 @@ function Link$1(props) {
|
|
38875
38869
|
uncheckedText: "on",
|
38876
38870
|
inline: true
|
38877
38871
|
}))))
|
38878
|
-
}), /* @__PURE__ */ React__default.createElement(
|
38872
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
38879
38873
|
title: "Link",
|
38880
|
-
size: "mini",
|
38881
38874
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
38882
38875
|
iconName: "icon-link"
|
38883
38876
|
})
|
@@ -38915,7 +38908,14 @@ function FontSizeList(props) {
|
|
38915
38908
|
label: "48px"
|
38916
38909
|
}
|
38917
38910
|
];
|
38918
|
-
return /* @__PURE__ */ React__default.createElement(
|
38911
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
38912
|
+
style: {
|
38913
|
+
maxWidth: 150,
|
38914
|
+
maxHeight: 350,
|
38915
|
+
overflowY: "auto",
|
38916
|
+
overflowX: "hidden"
|
38917
|
+
}
|
38918
|
+
}, /* @__PURE__ */ React__default.createElement(Menu$1, {
|
38919
38919
|
onClickMenuItem: (item2) => {
|
38920
38920
|
props.onChange(item2);
|
38921
38921
|
},
|
@@ -38924,13 +38924,13 @@ function FontSizeList(props) {
|
|
38924
38924
|
}, list2.map((item2) => /* @__PURE__ */ React__default.createElement(Menu$1.Item, {
|
38925
38925
|
style: { lineHeight: "30px", height: 30 },
|
38926
38926
|
key: item2.value
|
38927
|
-
}, item2.label)));
|
38927
|
+
}, item2.label))));
|
38928
38928
|
}
|
38929
38929
|
function FontFamily$1(props) {
|
38930
38930
|
const { fontList: fontList2 = [] } = useEditorProps();
|
38931
38931
|
return /* @__PURE__ */ React__default.createElement("div", {
|
38932
38932
|
style: {
|
38933
|
-
|
38933
|
+
maxWidth: 150,
|
38934
38934
|
maxHeight: 350,
|
38935
38935
|
overflowY: "auto",
|
38936
38936
|
overflowX: "hidden"
|
@@ -38940,7 +38940,7 @@ function FontFamily$1(props) {
|
|
38940
38940
|
props.onChange(item2);
|
38941
38941
|
},
|
38942
38942
|
selectedKeys: [],
|
38943
|
-
style: { border: "none" }
|
38943
|
+
style: { border: "none", padding: 0 }
|
38944
38944
|
}, fontList2.map((item2) => /* @__PURE__ */ React__default.createElement(Menu$1.Item, {
|
38945
38945
|
style: { lineHeight: "30px", height: 30 },
|
38946
38946
|
key: item2.value
|
@@ -38986,7 +38986,8 @@ const MergeTags$1 = React__default.memo((props) => {
|
|
38986
38986
|
onSelect: (vals) => onSelect(vals[0])
|
38987
38987
|
}));
|
38988
38988
|
});
|
38989
|
-
|
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) {
|
38990
38991
|
const { container: container2 } = props;
|
38991
38992
|
const { mergeTags } = useEditorProps();
|
38992
38993
|
const [selectionRange, setSelectionRange] = useState(null);
|
@@ -39052,47 +39053,60 @@ function TextToolbar(props) {
|
|
39052
39053
|
};
|
39053
39054
|
const getPopoverMountNode = () => document.getElementById(FIXED_CONTAINER_ID);
|
39054
39055
|
return /* @__PURE__ */ React__default.createElement("div", {
|
39055
|
-
id: "
|
39056
|
+
id: "Tools",
|
39056
39057
|
style: { display: "flex", flexWrap: "nowrap" }
|
39057
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39058
|
-
|
39059
|
-
|
39060
|
-
|
39061
|
-
|
39062
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39063
|
-
|
39064
|
-
|
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, {
|
39065
39069
|
onChange: (val) => execCommand("fontName", val)
|
39066
|
-
}),
|
39070
|
+
})),
|
39067
39071
|
getPopupContainer: getPopoverMountNode
|
39068
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39069
|
-
|
39072
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39073
|
+
title: "font family",
|
39070
39074
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39071
39075
|
iconName: "icon-font-family"
|
39072
39076
|
})
|
39073
|
-
})), /* @__PURE__ */ React__default.createElement(
|
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",
|
39074
39081
|
color: "#fff",
|
39075
|
-
|
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, {
|
39076
39084
|
onChange: (val) => execCommand("fontSize", val)
|
39077
|
-
}),
|
39085
|
+
})),
|
39078
39086
|
getPopupContainer: getPopoverMountNode
|
39079
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39080
|
-
|
39087
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39088
|
+
title: "line-height",
|
39081
39089
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39082
39090
|
iconName: "icon-line-height"
|
39083
39091
|
})
|
39084
|
-
})), /* @__PURE__ */ React__default.createElement(
|
39092
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
39093
|
+
className: "easy-email-extensions-divider"
|
39094
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39085
39095
|
onClick: () => execCommand("bold"),
|
39086
39096
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39087
39097
|
iconName: "icon-bold"
|
39088
39098
|
}),
|
39089
39099
|
title: "Bold"
|
39100
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39101
|
+
className: "easy-email-extensions-divider"
|
39090
39102
|
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39091
39103
|
onClick: () => execCommand("italic"),
|
39092
39104
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39093
39105
|
iconName: "icon-italic"
|
39094
39106
|
}),
|
39095
39107
|
title: "Italic"
|
39108
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39109
|
+
className: "easy-email-extensions-divider"
|
39096
39110
|
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
39097
39111
|
label: "",
|
39098
39112
|
position: "tl",
|
@@ -39104,7 +39118,9 @@ function TextToolbar(props) {
|
|
39104
39118
|
iconName: "icon-font-color"
|
39105
39119
|
}),
|
39106
39120
|
title: "Text color"
|
39107
|
-
})), /* @__PURE__ */ React__default.createElement(
|
39121
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
39122
|
+
className: "easy-email-extensions-divider"
|
39123
|
+
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
39108
39124
|
label: "",
|
39109
39125
|
showInput: false,
|
39110
39126
|
position: "tl",
|
@@ -39115,10 +39131,14 @@ function TextToolbar(props) {
|
|
39115
39131
|
iconName: "icon-bg-colors"
|
39116
39132
|
}),
|
39117
39133
|
title: "Background color"
|
39118
|
-
})), /* @__PURE__ */ React__default.createElement(
|
39134
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
39135
|
+
className: "easy-email-extensions-divider"
|
39136
|
+
}), /* @__PURE__ */ React__default.createElement(Link$1, {
|
39119
39137
|
currentRange: selectionRange,
|
39120
39138
|
onChange: (values2) => execCommand("createLink", values2),
|
39121
39139
|
getPopupContainer: getPopoverMountNode
|
39140
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39141
|
+
className: "easy-email-extensions-divider"
|
39122
39142
|
}), mergeTags && /* @__PURE__ */ React__default.createElement(Tooltip$1, {
|
39123
39143
|
color: "#fff",
|
39124
39144
|
position: "bottom",
|
@@ -39127,21 +39147,14 @@ function TextToolbar(props) {
|
|
39127
39147
|
onChange: (val) => execCommand("insertHTML", val)
|
39128
39148
|
}),
|
39129
39149
|
getPopupContainer: getPopoverMountNode
|
39130
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39131
|
-
size: "mini",
|
39150
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39132
39151
|
title: "Merge tag",
|
39133
39152
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39134
39153
|
iconName: "icon-merge-tags"
|
39135
39154
|
})
|
39136
|
-
})), /* @__PURE__ */ React__default.createElement(
|
39137
|
-
|
39138
|
-
|
39139
|
-
iconName: "icon-close"
|
39140
|
-
}),
|
39141
|
-
title: "Remove format"
|
39142
|
-
})), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39143
|
-
spacing: "extraTight"
|
39144
|
-
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39155
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
39156
|
+
className: "easy-email-extensions-divider"
|
39157
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39145
39158
|
onClick: () => execCommand("justifyLeft"),
|
39146
39159
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39147
39160
|
iconName: "icon-align-left"
|
@@ -39159,6 +39172,8 @@ function TextToolbar(props) {
|
|
39159
39172
|
iconName: "icon-align-right"
|
39160
39173
|
}),
|
39161
39174
|
title: "Align right"
|
39175
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39176
|
+
className: "easy-email-extensions-divider"
|
39162
39177
|
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39163
39178
|
onClick: () => execCommand("insertOrderedList"),
|
39164
39179
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
@@ -39171,6 +39186,8 @@ function TextToolbar(props) {
|
|
39171
39186
|
iconName: "icon-list-ul"
|
39172
39187
|
}),
|
39173
39188
|
title: "Unorderlist"
|
39189
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39190
|
+
className: "easy-email-extensions-divider"
|
39174
39191
|
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39175
39192
|
onClick: () => execCommand("strikeThrough"),
|
39176
39193
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
@@ -39189,77 +39206,108 @@ function TextToolbar(props) {
|
|
39189
39206
|
iconName: "icon-line"
|
39190
39207
|
}),
|
39191
39208
|
title: "Line"
|
39192
|
-
})
|
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
|
+
})));
|
39193
39220
|
}
|
39194
|
-
|
39195
|
-
|
39196
|
-
const
|
39197
|
-
const
|
39198
|
-
const [
|
39199
|
-
const
|
39200
|
-
const {
|
39201
|
-
const
|
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", "");
|
39202
39230
|
useEffect(() => {
|
39203
|
-
const
|
39204
|
-
|
39205
|
-
|
39206
|
-
|
39207
|
-
|
39208
|
-
|
39209
|
-
});
|
39210
|
-
}
|
39211
|
-
}, [idx, locationState == null ? void 0 : locationState.left, locationState == null ? void 0 : locationState.top]);
|
39212
|
-
const onChange = useCallback(() => {
|
39213
|
-
}, []);
|
39214
|
-
const editorContainer = container2 && getEditNode(container2);
|
39215
|
-
const textToolbar = useMemo(() => {
|
39216
|
-
const onMoveTextToolbar = (event2) => {
|
39217
|
-
onDrag({
|
39218
|
-
event: event2,
|
39219
|
-
onMove(x, y) {
|
39220
|
-
setPosition({
|
39221
|
-
left: position.left + x,
|
39222
|
-
top: position.top + y
|
39223
|
-
});
|
39224
|
-
setLocationState({
|
39225
|
-
left: position.left + x,
|
39226
|
-
top: position.top + y
|
39227
|
-
});
|
39228
|
-
},
|
39229
|
-
onEnd() {
|
39230
|
-
}
|
39231
|
-
});
|
39231
|
+
const promiseObj = awaitForElement(focusIdx2);
|
39232
|
+
promiseObj.promise.then((blockNode2) => {
|
39233
|
+
setBlockNode(blockNode2);
|
39234
|
+
});
|
39235
|
+
return () => {
|
39236
|
+
promiseObj.cancel();
|
39232
39237
|
};
|
39233
|
-
|
39234
|
-
|
39235
|
-
|
39236
|
-
|
39237
|
-
|
39238
|
-
|
39239
|
-
|
39240
|
-
|
39241
|
-
|
39242
|
-
|
39243
|
-
|
39244
|
-
|
39245
|
-
|
39246
|
-
|
39247
|
-
|
39248
|
-
|
39249
|
-
width
|
39250
|
-
left
|
39251
|
-
|
39252
|
-
|
39253
|
-
|
39254
|
-
|
39255
|
-
|
39256
|
-
|
39257
|
-
|
39258
|
-
|
39259
|
-
|
39260
|
-
|
39261
|
-
|
39262
|
-
|
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)));
|
39263
39311
|
};
|
39264
39312
|
const RichTextField = (props) => {
|
39265
39313
|
const { focusBlock: focusBlock2 } = useBlock();
|
@@ -39969,32 +40017,39 @@ function Page() {
|
|
39969
40017
|
}
|
39970
40018
|
function Padding(props = {}) {
|
39971
40019
|
const { title: title2 = "Padding", attributeName = "padding" } = props;
|
39972
|
-
const { focusBlock: focusBlock2 } = useBlock();
|
40020
|
+
const { focusBlock: focusBlock2, change } = useBlock();
|
39973
40021
|
const { focusIdx: focusIdx2 } = useFocusIdx();
|
39974
|
-
const
|
39975
|
-
const
|
39976
|
-
|
39977
|
-
|
39978
|
-
|
39979
|
-
|
39980
|
-
|
39981
|
-
|
39982
|
-
|
39983
|
-
|
39984
|
-
|
39985
|
-
|
39986
|
-
|
39987
|
-
|
39988
|
-
|
39989
|
-
|
39990
|
-
|
39991
|
-
|
39992
|
-
vals[index2] = newVal;
|
39993
|
-
return vals.join(" ");
|
40022
|
+
const type = focusBlock2 && focusBlock2.type;
|
40023
|
+
const defaultConfig = useMemo(() => type ? createBlockDataByType(type) : void 0, [type]);
|
40024
|
+
const paddingValue = focusBlock2 == null ? void 0 : focusBlock2.attributes[attributeName];
|
40025
|
+
const defaultPaddingValue = defaultConfig == null ? void 0 : defaultConfig.attributes[attributeName];
|
40026
|
+
const paddingList = paddingValue == null ? void 0 : paddingValue.split(" ");
|
40027
|
+
const defaultPaddingList = defaultPaddingValue == null ? void 0 : defaultPaddingValue.split(" ");
|
40028
|
+
const paddingFormValues = useMemo(() => {
|
40029
|
+
const paddingList2 = paddingValue == null ? void 0 : paddingValue.split(" ");
|
40030
|
+
const defaultPaddingList2 = defaultPaddingValue == null ? void 0 : defaultPaddingValue.split(" ");
|
40031
|
+
const top = paddingList2 ? paddingList2[0] : (defaultPaddingList2 == null ? void 0 : defaultPaddingList2[0]) || "";
|
40032
|
+
const right = paddingList2 ? paddingList2[1] : (defaultPaddingList2 == null ? void 0 : defaultPaddingList2[1]) || "";
|
40033
|
+
const bottom = paddingList2 ? paddingList2[2] : (defaultPaddingList2 == null ? void 0 : defaultPaddingList2[2]) || "";
|
40034
|
+
const left = paddingList2 ? paddingList2[3] : (defaultPaddingList2 == null ? void 0 : defaultPaddingList2[3]) || "";
|
40035
|
+
return {
|
40036
|
+
top,
|
40037
|
+
left,
|
40038
|
+
bottom,
|
40039
|
+
right
|
39994
40040
|
};
|
39995
|
-
}, [
|
39996
|
-
|
39997
|
-
|
40041
|
+
}, [paddingList, defaultPaddingList]);
|
40042
|
+
const onChancePadding = useCallback((val) => {
|
40043
|
+
change(focusIdx2 + `.attributes[${attributeName}]`, val);
|
40044
|
+
}, [focusIdx2, attributeName]);
|
40045
|
+
return /* @__PURE__ */ React__default.createElement(Form$3, {
|
40046
|
+
initialValues: paddingFormValues,
|
40047
|
+
subscription: { submitting: true, pristine: true },
|
40048
|
+
enableReinitialize: true,
|
40049
|
+
onSubmit: () => {
|
40050
|
+
}
|
40051
|
+
}, () => {
|
40052
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39998
40053
|
vertical: true,
|
39999
40054
|
spacing: "extraTight"
|
40000
40055
|
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
@@ -40006,18 +40061,14 @@ function Padding(props = {}) {
|
|
40006
40061
|
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40007
40062
|
label: /* @__PURE__ */ React__default.createElement("span", null, "Top\xA0"),
|
40008
40063
|
quickchange: true,
|
40009
|
-
name:
|
40010
|
-
valueAdapter: getVal(0),
|
40011
|
-
onChangeAdapter: setVal(0),
|
40064
|
+
name: "top",
|
40012
40065
|
inline: true
|
40013
40066
|
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
40014
40067
|
fill: true
|
40015
40068
|
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40016
40069
|
label: "Bottom",
|
40017
40070
|
quickchange: true,
|
40018
|
-
name:
|
40019
|
-
valueAdapter: getVal(2),
|
40020
|
-
onChangeAdapter: setVal(2),
|
40071
|
+
name: "bottom",
|
40021
40072
|
inline: true
|
40022
40073
|
}))), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
40023
40074
|
wrap: false
|
@@ -40026,22 +40077,29 @@ function Padding(props = {}) {
|
|
40026
40077
|
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40027
40078
|
label: /* @__PURE__ */ React__default.createElement("span", null, "Left"),
|
40028
40079
|
quickchange: true,
|
40029
|
-
name:
|
40030
|
-
valueAdapter: getVal(3),
|
40031
|
-
onChangeAdapter: setVal(3),
|
40080
|
+
name: "left",
|
40032
40081
|
inline: true
|
40033
40082
|
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
40034
40083
|
fill: true
|
40035
40084
|
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40036
40085
|
label: /* @__PURE__ */ React__default.createElement("span", null, "Right\xA0"),
|
40037
40086
|
quickchange: true,
|
40038
|
-
name:
|
40039
|
-
valueAdapter: getVal(1),
|
40040
|
-
onChangeAdapter: setVal(1),
|
40087
|
+
name: "right",
|
40041
40088
|
inline: true
|
40042
|
-
}))))
|
40043
|
-
|
40089
|
+
})))), /* @__PURE__ */ React__default.createElement(PaddingChangeWrapper, {
|
40090
|
+
onChange: onChancePadding
|
40091
|
+
}));
|
40092
|
+
});
|
40044
40093
|
}
|
40094
|
+
const PaddingChangeWrapper = (props) => {
|
40095
|
+
const {
|
40096
|
+
values: { top, right, bottom, left }
|
40097
|
+
} = useFormState();
|
40098
|
+
useEffect(() => {
|
40099
|
+
props.onChange([top, right, bottom, left].join(" "));
|
40100
|
+
}, [top, right, bottom, left]);
|
40101
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
|
40102
|
+
};
|
40045
40103
|
function BackgroundColor({
|
40046
40104
|
title: title2 = "Background color"
|
40047
40105
|
}) {
|
@@ -43976,7 +44034,6 @@ const BlocksPanel = (props) => {
|
|
43976
44034
|
tabPosition: "left",
|
43977
44035
|
size: "large"
|
43978
44036
|
}, filterCategories.map((category, index2) => /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
|
43979
|
-
className: "no-scrollbar",
|
43980
44037
|
style: {
|
43981
44038
|
padding: 0,
|
43982
44039
|
overflow: "auto"
|
@@ -44163,31 +44220,6 @@ function SourceCodePanel() {
|
|
44163
44220
|
onBlur: onMjmlChange
|
44164
44221
|
})));
|
44165
44222
|
}
|
44166
|
-
function awaitForElement(idx) {
|
44167
|
-
let promiseObj = {
|
44168
|
-
cancel: () => {
|
44169
|
-
},
|
44170
|
-
promise: Promise.resolve()
|
44171
|
-
};
|
44172
|
-
promiseObj.promise = new Promise((resolve) => {
|
44173
|
-
const ele = getBlockNodeByIdx(idx);
|
44174
|
-
if (ele) {
|
44175
|
-
resolve(ele);
|
44176
|
-
return;
|
44177
|
-
}
|
44178
|
-
const timer = setInterval(() => {
|
44179
|
-
const ele2 = getBlockNodeByIdx(idx);
|
44180
|
-
if (ele2) {
|
44181
|
-
resolve(ele2);
|
44182
|
-
clearInterval(timer);
|
44183
|
-
}
|
44184
|
-
}, 50);
|
44185
|
-
promiseObj.cancel = () => {
|
44186
|
-
clearInterval(timer);
|
44187
|
-
};
|
44188
|
-
});
|
44189
|
-
return promiseObj;
|
44190
|
-
}
|
44191
44223
|
function Toolbar({
|
44192
44224
|
block: block2,
|
44193
44225
|
direction
|
@@ -44300,22 +44332,27 @@ function FocusTooltip() {
|
|
44300
44332
|
useEffect(() => {
|
44301
44333
|
if (blockNode) {
|
44302
44334
|
const options2 = {
|
44303
|
-
rootMargin: "-24px 0px
|
44304
|
-
root: getShadowRoot().
|
44305
|
-
threshold: [0, 1e-3, 0.1, 0.
|
44335
|
+
rootMargin: "-24px 0px 0px 0px",
|
44336
|
+
root: getShadowRoot().firstChild,
|
44337
|
+
threshold: [0, 1e-3, 0.1, 0.5, 0.999, 1]
|
44306
44338
|
};
|
44307
44339
|
const checkDirection = (ev) => {
|
44308
44340
|
const [current] = ev;
|
44309
|
-
const { top
|
44341
|
+
const { top } = current.intersectionRect;
|
44310
44342
|
const rootBounds = current.rootBounds;
|
44343
|
+
const intersectionRatio = current.intersectionRatio;
|
44311
44344
|
if (!rootBounds)
|
44312
44345
|
return;
|
44313
|
-
if (
|
44346
|
+
if (intersectionRatio === 1) {
|
44314
44347
|
setDirection("top");
|
44315
|
-
} else if (rootBounds.top === top) {
|
44316
|
-
setDirection("bottom");
|
44317
44348
|
} else {
|
44318
|
-
|
44349
|
+
if (top) {
|
44350
|
+
if (top > rootBounds.top) {
|
44351
|
+
setDirection("top");
|
44352
|
+
} else {
|
44353
|
+
setDirection("bottom");
|
44354
|
+
}
|
44355
|
+
}
|
44319
44356
|
}
|
44320
44357
|
};
|
44321
44358
|
const observer = new IntersectionObserver(checkDirection, options2);
|