easy-email-extensions 3.1.23 → 3.1.28
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/InteractivePrompt/components/Toolbar.d.ts +1 -5
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/index2.js +122 -166
- package/lib/index2.js.map +1 -1
- package/lib/style.css +1 -1
- package/lib/utils/getBlockTitle.d.ts +2 -0
- package/lib/{AttributePanel/utils → utils}/getIconNameByBlockType.d.ts +0 -0
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export {
|
1
|
+
export { d as Align, A as AttributePanel, e as AttributesPanelWrapper, _ as AutoCompleteField, i as Background, l as BackgroundColor, b as BlockAttributeConfigurationManager, B as BlockLayer, w as BlockMarketManager, x as BlockMaskWrapper, o as Border, p as BorderColor, s as BorderStyle, u as BorderWidth, a2 as CheckboxField, C as Color, R as ColorPickerField, f as ContainerBackgroundColor, a1 as DatePickerField, D as Decoration, m as Direction, a3 as EditTabField, F as FontFamily, q as FontSize, t as FontStyle, v as FontWeight, H as Height, X as ImageUploaderField, a4 as InlineTextField, G as InputWithUnitField, I as InteractivePrompt, L as LetterSpacing, j as LineHeight, n as Link, M as Margin, r as MergeTags, N as NavbarLinkPadding, O as NumberField, P as Padding, $ as RadioGroupField, a6 as RichTextField, J as SearchField, Y as SelectField, S as ShortcutToolbar, z as SimpleLayout, Q as SliderField, y as SourceCodePanel, a0 as SwitchField, T as TextAlign, K as TextAreaField, h as TextDecoration, E as TextField, k as TextTransform, Z as TreeSelectField, U as UploadField, V as VerticalAlign, W as Width, a5 as enhancer, g as getContextMergeTags, a as getIconNameByBlockType } from "./index2.js";
|
2
2
|
import "react";
|
3
3
|
import "easy-email-editor";
|
4
4
|
import "easy-email-core";
|
package/lib/index2.js
CHANGED
@@ -55,12 +55,12 @@ var __async = (__this, __arguments, generator) => {
|
|
55
55
|
};
|
56
56
|
import * as React from "react";
|
57
57
|
import React__default, { Children, isValidElement, cloneElement, createContext, useContext, Component, useMemo, memo, forwardRef, useEffect, useRef, useLayoutEffect, useState, createRef, useImperativeHandle, PureComponent, useCallback, useReducer, Fragment, createElement, Suspense } from "react";
|
58
|
-
import { IconFont, useEditorProps, Stack as Stack$6, getBlockNodeByIdx, useBlock, getEditNode, getEditContent,
|
58
|
+
import { IconFont, useEditorProps, Stack as Stack$6, getBlockNodeByIdx, useBlock, getEditNode, getEditContent, TextStyle, useFocusIdx, useEditorContext, getShadowRoot, FIXED_CONTAINER_ID, useFocusBlockLayout, scrollBlockEleIntoView, useHoverIdx, useDataTransfer, useRefState, getBlockNodeByChildEle, getDirectionPosition, DATA_ATTRIBUTE_DROP_CONTAINER, BlockAvatarWrapper, getEditorRoot, useActiveTab, ActiveTabKeys } from "easy-email-editor";
|
59
59
|
import { BasicType, ImageManager, BlockManager, getParentIdx, createBlockDataByType, getParentByIdx, getValueByIdx, getIndexByIdx, getSiblingIdx, getNodeIdxFromClassName, getNodeIdxClassName, getPageIdx, getChildIdx, MjmlToJson, JsonToMjml, getNodeTypeFromClassName } from "easy-email-core";
|
60
60
|
import ReactDOM, { findDOMNode, createPortal } from "react-dom";
|
61
61
|
import { useField, Field, useForm as useForm$1, Form as Form$3, version as version$2, useFormState } from "react-final-form";
|
62
62
|
var index$2 = "";
|
63
|
-
const title = "
|
63
|
+
const title = "_title_15yi1_1";
|
64
64
|
var styles$6 = {
|
65
65
|
title
|
66
66
|
};
|
@@ -38460,7 +38460,7 @@ function enhancer(Component2, changeAdapter) {
|
|
38460
38460
|
onChange(val);
|
38461
38461
|
}, 100, {
|
38462
38462
|
maxWait: 500
|
38463
|
-
}), []);
|
38463
|
+
}), [onChange]);
|
38464
38464
|
useEffect(() => {
|
38465
38465
|
setCurrentValue(value);
|
38466
38466
|
}, [value]);
|
@@ -38468,7 +38468,6 @@ function enhancer(Component2, changeAdapter) {
|
|
38468
38468
|
return `enhancer-${primaryId++}`;
|
38469
38469
|
}, []);
|
38470
38470
|
return /* @__PURE__ */ React__default.createElement(Field, {
|
38471
|
-
key: name,
|
38472
38471
|
name,
|
38473
38472
|
validate: validate3,
|
38474
38473
|
parse
|
@@ -38770,36 +38769,13 @@ function AutoComplete(props) {
|
|
38770
38769
|
data: options2
|
38771
38770
|
}));
|
38772
38771
|
}
|
38773
|
-
function awaitForElement(idx) {
|
38774
|
-
let promiseObj = {
|
38775
|
-
cancel: () => {
|
38776
|
-
},
|
38777
|
-
promise: Promise.resolve()
|
38778
|
-
};
|
38779
|
-
promiseObj.promise = new Promise((resolve) => {
|
38780
|
-
const ele = getBlockNodeByIdx(idx);
|
38781
|
-
if (ele) {
|
38782
|
-
resolve(ele);
|
38783
|
-
return;
|
38784
|
-
}
|
38785
|
-
const timer = setInterval(() => {
|
38786
|
-
const ele2 = getBlockNodeByIdx(idx);
|
38787
|
-
if (ele2) {
|
38788
|
-
resolve(ele2);
|
38789
|
-
clearInterval(timer);
|
38790
|
-
}
|
38791
|
-
}, 50);
|
38792
|
-
promiseObj.cancel = () => {
|
38793
|
-
clearInterval(timer);
|
38794
|
-
};
|
38795
|
-
});
|
38796
|
-
return promiseObj;
|
38797
|
-
}
|
38798
38772
|
const ToolItem$1 = (props) => {
|
38799
38773
|
return /* @__PURE__ */ React__default.createElement(Tooltip$1, {
|
38800
38774
|
mini: true,
|
38775
|
+
position: "bottom",
|
38801
38776
|
content: props.title
|
38802
38777
|
}, /* @__PURE__ */ React__default.createElement("button", {
|
38778
|
+
tabIndex: -1,
|
38803
38779
|
className: "easy-email-extensions-emailToolItem",
|
38804
38780
|
title: props.title,
|
38805
38781
|
onClick: props.onClick
|
@@ -38867,27 +38843,46 @@ function Link$1(props) {
|
|
38867
38843
|
style: { color: "#333" }
|
38868
38844
|
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38869
38845
|
vertical: true,
|
38870
|
-
spacing: "
|
38871
|
-
}, /* @__PURE__ */ React__default.createElement(
|
38846
|
+
spacing: "none"
|
38847
|
+
}, /* @__PURE__ */ React__default.createElement(SearchField, {
|
38848
|
+
size: "small",
|
38872
38849
|
name: "link",
|
38873
38850
|
label: "Link",
|
38874
38851
|
labelHidden: true,
|
38875
38852
|
searchButton: "Apply",
|
38876
38853
|
placeholder: "https://www.example.com",
|
38877
38854
|
onSearch: () => handleSubmit()
|
38878
|
-
}), /* @__PURE__ */ React__default.createElement(
|
38855
|
+
})), /* @__PURE__ */ React__default.createElement(Grid.Row, null, /* @__PURE__ */ React__default.createElement(Grid.Col, {
|
38856
|
+
span: 12
|
38857
|
+
}, /* @__PURE__ */ React__default.createElement(Space$1, {
|
38858
|
+
align: "center",
|
38859
|
+
size: "mini"
|
38860
|
+
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
38861
|
+
size: "smallest"
|
38862
|
+
}, "Target"), /* @__PURE__ */ React__default.createElement(SwitchField, {
|
38863
|
+
size: "small",
|
38879
38864
|
label: "Target",
|
38865
|
+
labelHidden: true,
|
38880
38866
|
name: "blank",
|
38881
38867
|
checkedText: "blank",
|
38882
38868
|
uncheckedText: "self",
|
38883
38869
|
inline: true
|
38884
|
-
}), /* @__PURE__ */ React__default.createElement(
|
38870
|
+
}))), /* @__PURE__ */ React__default.createElement(Grid.Col, {
|
38871
|
+
span: 12
|
38872
|
+
}, /* @__PURE__ */ React__default.createElement(Space$1, {
|
38873
|
+
align: "center",
|
38874
|
+
size: "mini"
|
38875
|
+
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
38876
|
+
size: "smallest"
|
38877
|
+
}, "Underline"), /* @__PURE__ */ React__default.createElement(SwitchField, {
|
38878
|
+
size: "small",
|
38885
38879
|
label: "Underline",
|
38880
|
+
labelHidden: true,
|
38886
38881
|
name: "underline",
|
38887
38882
|
checkedText: "off",
|
38888
38883
|
uncheckedText: "on",
|
38889
38884
|
inline: true
|
38890
|
-
}))))
|
38885
|
+
})))))
|
38891
38886
|
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
38892
38887
|
title: "Link",
|
38893
38888
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
@@ -41410,7 +41405,23 @@ function Tools(props) {
|
|
41410
41405
|
display: "flex",
|
41411
41406
|
alignItems: "center"
|
41412
41407
|
}
|
41413
|
-
}, /* @__PURE__ */ React__default.createElement(
|
41408
|
+
}, mergeTags2 && /* @__PURE__ */ React__default.createElement(Popover$1, {
|
41409
|
+
trigger: "click",
|
41410
|
+
color: "#fff",
|
41411
|
+
position: "left",
|
41412
|
+
content: /* @__PURE__ */ React__default.createElement(MergeTags, {
|
41413
|
+
value: "",
|
41414
|
+
onChange: (val) => execCommand("insertHTML", val)
|
41415
|
+
}),
|
41416
|
+
getPopupContainer: getPopoverMountNode
|
41417
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41418
|
+
title: "Merge tag",
|
41419
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41420
|
+
iconName: "icon-merge-tags"
|
41421
|
+
})
|
41422
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
41423
|
+
className: "easy-email-extensions-divider"
|
41424
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
41414
41425
|
className: "easy-email-extensions-divider"
|
41415
41426
|
}), /* @__PURE__ */ React__default.createElement(Popover$1, {
|
41416
41427
|
className: "easy-email-extensions-Tools-Popover",
|
@@ -41489,22 +41500,6 @@ function Tools(props) {
|
|
41489
41500
|
getPopupContainer: getPopoverMountNode
|
41490
41501
|
}), /* @__PURE__ */ React__default.createElement("div", {
|
41491
41502
|
className: "easy-email-extensions-divider"
|
41492
|
-
}), mergeTags2 && /* @__PURE__ */ React__default.createElement(Popover$1, {
|
41493
|
-
trigger: "click",
|
41494
|
-
color: "#fff",
|
41495
|
-
position: "bottom",
|
41496
|
-
content: /* @__PURE__ */ React__default.createElement(MergeTags, {
|
41497
|
-
value: "",
|
41498
|
-
onChange: (val) => execCommand("insertHTML", val)
|
41499
|
-
}),
|
41500
|
-
getPopupContainer: getPopoverMountNode
|
41501
|
-
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41502
|
-
title: "Merge tag",
|
41503
|
-
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
41504
|
-
iconName: "icon-merge-tags"
|
41505
|
-
})
|
41506
|
-
})), /* @__PURE__ */ React__default.createElement("div", {
|
41507
|
-
className: "easy-email-extensions-divider"
|
41508
41503
|
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
41509
41504
|
onClick: () => execCommand("justifyLeft"),
|
41510
41505
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
@@ -41571,41 +41566,10 @@ function Tools(props) {
|
|
41571
41566
|
}
|
41572
41567
|
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";
|
41573
41568
|
function RichTextToolBar(props) {
|
41574
|
-
const
|
41575
|
-
|
41576
|
-
const { focusBlock: focusBlock2 } = useBlock();
|
41577
|
-
const { pageData: pageData2 } = useEditorContext();
|
41578
|
-
const { focusIdx: focusIdx2 } = useFocusIdx();
|
41579
|
-
+(pageData2.attributes.width || "600").replace("px", "");
|
41580
|
-
useEffect(() => {
|
41581
|
-
const promiseObj = awaitForElement(focusIdx2);
|
41582
|
-
promiseObj.promise.then((blockNode2) => {
|
41583
|
-
setBlockNode(blockNode2);
|
41584
|
-
});
|
41585
|
-
return () => {
|
41586
|
-
promiseObj.cancel();
|
41587
|
-
};
|
41588
|
-
}, [focusIdx2, focusBlock2]);
|
41589
|
-
useEffect(() => {
|
41590
|
-
const ele = getShadowRoot().querySelector(".shadow-container");
|
41591
|
-
if (!blockNode || !ele)
|
41592
|
-
return;
|
41593
|
-
const check = () => {
|
41594
|
-
const { top, left } = blockNode.getBoundingClientRect();
|
41595
|
-
setPosition({ top, left });
|
41596
|
-
};
|
41597
|
-
const onScroll = () => {
|
41598
|
-
check();
|
41599
|
-
};
|
41600
|
-
check();
|
41601
|
-
ele.addEventListener("scroll", onScroll, true);
|
41602
|
-
return () => {
|
41603
|
-
ele.removeEventListener("scroll", onScroll, true);
|
41604
|
-
};
|
41605
|
-
}, [blockNode]);
|
41606
|
-
if (!blockNode)
|
41569
|
+
const { focusBlockNode, focusBlockRect } = useFocusBlockLayout();
|
41570
|
+
if (!focusBlockNode || !focusBlockRect)
|
41607
41571
|
return null;
|
41608
|
-
const editorContainer =
|
41572
|
+
const editorContainer = getEditNode(focusBlockNode);
|
41609
41573
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, createPortal(/* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", {
|
41610
41574
|
dangerouslySetInnerHTML: { __html: styleText }
|
41611
41575
|
}), /* @__PURE__ */ React__default.createElement("div", {
|
@@ -41615,8 +41579,8 @@ function RichTextToolBar(props) {
|
|
41615
41579
|
boxSizing: "border-box",
|
41616
41580
|
position: "fixed",
|
41617
41581
|
zIndex: 100,
|
41618
|
-
top:
|
41619
|
-
left:
|
41582
|
+
top: focusBlockRect.top - 24,
|
41583
|
+
left: focusBlockRect.left
|
41620
41584
|
}
|
41621
41585
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
41622
41586
|
style: {
|
@@ -41630,7 +41594,7 @@ function RichTextToolBar(props) {
|
|
41630
41594
|
}), /* @__PURE__ */ React__default.createElement(Tools, {
|
41631
41595
|
container: editorContainer,
|
41632
41596
|
onChange: props.onChange
|
41633
|
-
}))),
|
41597
|
+
}))), focusBlockNode));
|
41634
41598
|
}
|
41635
41599
|
const RichTextField = (props) => {
|
41636
41600
|
const { focusBlock: focusBlock2 } = useBlock();
|
@@ -41649,7 +41613,7 @@ function FieldWrapper(props) {
|
|
41649
41613
|
const _a = props, { input } = _a, rest = __objRest(_a, ["input"]);
|
41650
41614
|
const debounceCallbackChange = useCallback(lodash.exports.debounce((val) => {
|
41651
41615
|
input.onChange(val);
|
41652
|
-
},
|
41616
|
+
}, 100), [input]);
|
41653
41617
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(RichTextToolBar, {
|
41654
41618
|
onChange: debounceCallbackChange
|
41655
41619
|
}), /* @__PURE__ */ React__default.createElement(InlineText, __spreadProps(__spreadValues({}, rest), {
|
@@ -41838,14 +41802,8 @@ function useAvatarWrapperDrop() {
|
|
41838
41802
|
const {
|
41839
41803
|
formState: { values: values2 }
|
41840
41804
|
} = useEditorContext();
|
41841
|
-
const valuesRef =
|
41842
|
-
const dataTransferRef =
|
41843
|
-
useEffect(() => {
|
41844
|
-
valuesRef.current = values2;
|
41845
|
-
}, [values2]);
|
41846
|
-
useEffect(() => {
|
41847
|
-
dataTransferRef.current = dataTransfer;
|
41848
|
-
}, [dataTransfer]);
|
41805
|
+
const valuesRef = useRefState(values2);
|
41806
|
+
const dataTransferRef = useRefState(dataTransfer);
|
41849
41807
|
function isKeyObject(o) {
|
41850
41808
|
return o.key !== void 0;
|
41851
41809
|
}
|
@@ -42018,21 +41976,25 @@ const iconsMap = {
|
|
42018
41976
|
function getIconNameByBlockType(type) {
|
42019
41977
|
return lodash.exports.get(iconsMap, type) || "icon-number";
|
42020
41978
|
}
|
41979
|
+
const tempEle = document.createElement("div");
|
41980
|
+
function getBlockTitle(blockData, isFromContent = true) {
|
41981
|
+
var _a;
|
41982
|
+
if (blockData.title)
|
41983
|
+
return blockData.title;
|
41984
|
+
if (isFromContent && (blockData.type === BasicType.TEXT || blockData.type === BasicType.BUTTON)) {
|
41985
|
+
tempEle.innerHTML = blockData.data.value.content;
|
41986
|
+
return tempEle.innerText;
|
41987
|
+
}
|
41988
|
+
const blockName = (_a = BlockManager.getBlockByType(blockData.type)) == null ? void 0 : _a.name;
|
41989
|
+
return blockName;
|
41990
|
+
}
|
42021
41991
|
function BlockLayer() {
|
42022
41992
|
const { pageData: pageData2 } = useEditorContext();
|
42023
41993
|
const { focusIdx: focusIdx2, setFocusIdx } = useFocusIdx();
|
42024
41994
|
const { setHoverIdx, setIsDragging, setDirection } = useHoverIdx();
|
42025
41995
|
const { moveBlock, setValueByIdx: setValueByIdx2, copyBlock, removeBlock, values: values2 } = useBlock();
|
42026
|
-
const {
|
42027
|
-
|
42028
|
-
allowDrop,
|
42029
|
-
blockLayerRef,
|
42030
|
-
removeHightLightClassName
|
42031
|
-
} = useAvatarWrapperDrop();
|
42032
|
-
const valueRef = useRef(values2);
|
42033
|
-
useEffect(() => {
|
42034
|
-
valueRef.current = values2;
|
42035
|
-
}, [values2]);
|
41996
|
+
const { setBlockLayerRef, allowDrop, removeHightLightClassName } = useAvatarWrapperDrop();
|
41997
|
+
const valueRef = useRefState(values2);
|
42036
41998
|
const [contextMenuData, setContextMenuData] = useState(null);
|
42037
41999
|
const onToggleVisible = useCallback(({ id }, e) => {
|
42038
42000
|
e.stopPropagation();
|
@@ -42043,8 +42005,8 @@ function BlockLayer() {
|
|
42043
42005
|
}
|
42044
42006
|
}, [setValueByIdx2]);
|
42045
42007
|
const renderTitle = useCallback((data) => {
|
42046
|
-
const block2 = BlockManager.getBlockByType(data.type);
|
42047
42008
|
const isPage = data.type === BasicType.PAGE;
|
42009
|
+
const title2 = getBlockTitle(data);
|
42048
42010
|
return /* @__PURE__ */ React__default.createElement("div", {
|
42049
42011
|
"data-tree-idx": data.id,
|
42050
42012
|
className: classnames(styles$6.title, !isPage && getNodeIdxClassName(data.id), !isPage && "email-block")
|
@@ -42054,9 +42016,12 @@ function BlockLayer() {
|
|
42054
42016
|
}, /* @__PURE__ */ React__default.createElement(IconFont, {
|
42055
42017
|
iconName: getIconNameByBlockType(data.type),
|
42056
42018
|
style: { fontSize: 12, color: "#999" }
|
42057
|
-
}), /* @__PURE__ */ React__default.createElement(
|
42019
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
42020
|
+
title: title2,
|
42021
|
+
style: { overflow: "hidden", whiteSpace: "nowrap", width: "5em" }
|
42022
|
+
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
42058
42023
|
size: "smallest"
|
42059
|
-
},
|
42024
|
+
}, title2))), /* @__PURE__ */ React__default.createElement("div", {
|
42060
42025
|
className: styles$6.eyeIcon
|
42061
42026
|
}, /* @__PURE__ */ React__default.createElement(EyeIcon$1, {
|
42062
42027
|
blockData: data,
|
@@ -44450,7 +44415,8 @@ function ShortcutToolbar() {
|
|
44450
44415
|
padding: "0px 0px 0px 0px",
|
44451
44416
|
border: "none",
|
44452
44417
|
"vertical-align": "top"
|
44453
|
-
}
|
44418
|
+
},
|
44419
|
+
children: []
|
44454
44420
|
},
|
44455
44421
|
{
|
44456
44422
|
type: "column",
|
@@ -44461,7 +44427,8 @@ function ShortcutToolbar() {
|
|
44461
44427
|
padding: "0px 0px 0px 0px",
|
44462
44428
|
border: "none",
|
44463
44429
|
"vertical-align": "top"
|
44464
|
-
}
|
44430
|
+
},
|
44431
|
+
children: []
|
44465
44432
|
}
|
44466
44433
|
]
|
44467
44434
|
},
|
@@ -44572,33 +44539,12 @@ function SourceCodePanel() {
|
|
44572
44539
|
onBlur: onMjmlChange
|
44573
44540
|
})));
|
44574
44541
|
}
|
44575
|
-
function Toolbar({
|
44576
|
-
|
44577
|
-
blockNode
|
44578
|
-
}) {
|
44579
|
-
const { moveBlock, copyBlock, removeBlock } = useBlock();
|
44542
|
+
function Toolbar() {
|
44543
|
+
const { moveBlock, copyBlock, removeBlock, focusBlock: focusBlock2 } = useBlock();
|
44580
44544
|
const { focusIdx: focusIdx2, setFocusIdx } = useFocusIdx();
|
44581
|
-
const {
|
44545
|
+
const { focusBlockRect } = useFocusBlockLayout();
|
44582
44546
|
const { modal, setModalVisible } = useAddToCollection();
|
44583
|
-
const
|
44584
|
-
const isPage = block2.type === BasicType.PAGE;
|
44585
|
-
useEffect(() => {
|
44586
|
-
const check = () => {
|
44587
|
-
const { top, left } = blockNode.getBoundingClientRect();
|
44588
|
-
setPosition({ top, left });
|
44589
|
-
};
|
44590
|
-
const ele = getShadowRoot().querySelector(".shadow-container");
|
44591
|
-
if (!ele || !initialized)
|
44592
|
-
return;
|
44593
|
-
check();
|
44594
|
-
const onScroll = () => {
|
44595
|
-
check();
|
44596
|
-
};
|
44597
|
-
ele.addEventListener("scroll", onScroll, true);
|
44598
|
-
return () => {
|
44599
|
-
ele.removeEventListener("scroll", onScroll, true);
|
44600
|
-
};
|
44601
|
-
}, [blockNode, initialized]);
|
44547
|
+
const isPage = (focusBlock2 == null ? void 0 : focusBlock2.type) === BasicType.PAGE;
|
44602
44548
|
const handleAddToCollection = () => {
|
44603
44549
|
if (document.activeElement instanceof HTMLElement) {
|
44604
44550
|
document.activeElement.blur();
|
@@ -44623,13 +44569,15 @@ function Toolbar({
|
|
44623
44569
|
}
|
44624
44570
|
setFocusIdx(getParentIdx(focusIdx2));
|
44625
44571
|
};
|
44572
|
+
if (!focusBlockRect)
|
44573
|
+
return null;
|
44626
44574
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
|
44627
44575
|
id: "easy-email-extensions-InteractivePrompt-Toolbar",
|
44628
44576
|
style: {
|
44629
44577
|
position: "fixed",
|
44630
|
-
left:
|
44578
|
+
left: focusBlockRect.left,
|
44631
44579
|
height: 0,
|
44632
|
-
top:
|
44580
|
+
top: focusBlockRect.top,
|
44633
44581
|
zIndex: 100
|
44634
44582
|
}
|
44635
44583
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
@@ -44649,9 +44597,11 @@ function Toolbar({
|
|
44649
44597
|
display: "inline-flex",
|
44650
44598
|
padding: "1px 5px",
|
44651
44599
|
boxSizing: "border-box",
|
44652
|
-
whiteSpace: "nowrap"
|
44600
|
+
whiteSpace: "nowrap",
|
44601
|
+
maxWidth: 300,
|
44602
|
+
overflow: "hidden"
|
44653
44603
|
}
|
44654
|
-
},
|
44604
|
+
}, focusBlock2 && getBlockTitle(focusBlock2, false)), /* @__PURE__ */ React__default.createElement("div", {
|
44655
44605
|
onClick: (e) => {
|
44656
44606
|
e.stopPropagation();
|
44657
44607
|
},
|
@@ -44698,25 +44648,11 @@ function ToolItem(props) {
|
|
44698
44648
|
});
|
44699
44649
|
}
|
44700
44650
|
function FocusTooltip() {
|
44701
|
-
const [blockNode, setBlockNode] = useState(null);
|
44702
44651
|
const { focusBlock: focusBlock2 } = useBlock();
|
44703
44652
|
const { focusIdx: focusIdx2 } = useFocusIdx();
|
44653
|
+
const { focusBlockNode } = useFocusBlockLayout();
|
44704
44654
|
const isPage = (focusBlock2 == null ? void 0 : focusBlock2.type) === BasicType.PAGE;
|
44705
|
-
|
44706
|
-
const promiseObj = awaitForElement(focusIdx2);
|
44707
|
-
promiseObj.promise.then((blockNode2) => {
|
44708
|
-
setBlockNode(blockNode2);
|
44709
|
-
});
|
44710
|
-
return () => {
|
44711
|
-
promiseObj.cancel();
|
44712
|
-
};
|
44713
|
-
}, [focusIdx2, focusBlock2]);
|
44714
|
-
const block2 = useMemo(() => {
|
44715
|
-
if (!focusBlock2)
|
44716
|
-
return null;
|
44717
|
-
return BlockManager.getBlockByType(focusBlock2.type);
|
44718
|
-
}, [focusBlock2]);
|
44719
|
-
if (!block2 || !blockNode)
|
44655
|
+
if (!focusBlockNode || !focusBlock2)
|
44720
44656
|
return null;
|
44721
44657
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, createPortal(/* @__PURE__ */ React__default.createElement("div", {
|
44722
44658
|
id: "easy-email-extensions-InteractivePrompt-FocusTooltip",
|
@@ -44744,7 +44680,7 @@ function FocusTooltip() {
|
|
44744
44680
|
}
|
44745
44681
|
}, /* @__PURE__ */ React__default.createElement(BlockAvatarWrapper, {
|
44746
44682
|
idx: focusIdx2,
|
44747
|
-
type:
|
44683
|
+
type: focusBlock2.type,
|
44748
44684
|
action: "move"
|
44749
44685
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
44750
44686
|
style: {
|
@@ -44777,10 +44713,32 @@ function FocusTooltip() {
|
|
44777
44713
|
outlineOffset: "-2px",
|
44778
44714
|
outline: "2px solid var(--selected-color)"
|
44779
44715
|
}
|
44780
|
-
}), /* @__PURE__ */ React__default.createElement(Toolbar,
|
44781
|
-
|
44782
|
-
|
44783
|
-
|
44716
|
+
}), /* @__PURE__ */ React__default.createElement(Toolbar, null)), focusBlockNode));
|
44717
|
+
}
|
44718
|
+
function awaitForElement(idx) {
|
44719
|
+
let promiseObj = {
|
44720
|
+
cancel: () => {
|
44721
|
+
},
|
44722
|
+
promise: Promise.resolve()
|
44723
|
+
};
|
44724
|
+
promiseObj.promise = new Promise((resolve) => {
|
44725
|
+
const ele = getBlockNodeByIdx(idx);
|
44726
|
+
if (ele) {
|
44727
|
+
resolve(ele);
|
44728
|
+
return;
|
44729
|
+
}
|
44730
|
+
const timer = setInterval(() => {
|
44731
|
+
const ele2 = getBlockNodeByIdx(idx);
|
44732
|
+
if (ele2) {
|
44733
|
+
resolve(ele2);
|
44734
|
+
clearInterval(timer);
|
44735
|
+
}
|
44736
|
+
}, 50);
|
44737
|
+
promiseObj.cancel = () => {
|
44738
|
+
clearInterval(timer);
|
44739
|
+
};
|
44740
|
+
});
|
44741
|
+
return promiseObj;
|
44784
44742
|
}
|
44785
44743
|
function HoverTooltip() {
|
44786
44744
|
const { hoverIdx, direction, isDragging } = useHoverIdx();
|
@@ -44889,9 +44847,7 @@ function TipNode(props) {
|
|
44889
44847
|
}
|
44890
44848
|
}, type === "hover" && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
|
44891
44849
|
style: {
|
44892
|
-
position: "
|
44893
|
-
left: 0,
|
44894
|
-
top: 0,
|
44850
|
+
position: "fixed",
|
44895
44851
|
backgroundColor: color,
|
44896
44852
|
color: "#ffffff",
|
44897
44853
|
height: "22px",
|
@@ -45225,5 +45181,5 @@ const SimpleLayout = (props) => {
|
|
45225
45181
|
title: "Source code"
|
45226
45182
|
}, /* @__PURE__ */ React__default.createElement(SourceCodePanel, null))))), /* @__PURE__ */ React__default.createElement(InteractivePrompt, null)));
|
45227
45183
|
};
|
45228
|
-
export {
|
45184
|
+
export { RadioGroupField as $, AttributePanel as A, BlockLayer as B, Color as C, Decoration as D, TextField as E, FontFamily as F, InputWithUnitField as G, Height as H, InteractivePrompt as I, SearchField as J, TextAreaField as K, LetterSpacing as L, Margin as M, NavbarLinkPadding as N, NumberField as O, Padding as P, SliderField as Q, ColorPickerField as R, ShortcutToolbar as S, TextAlign as T, UploadField as U, VerticalAlign as V, Width as W, ImageUploaderField as X, SelectField as Y, TreeSelectField as Z, AutoCompleteField as _, getIconNameByBlockType as a, SwitchField as a0, DatePickerField as a1, CheckboxField as a2, EditTabField as a3, InlineTextField as a4, enhancer as a5, RichTextField as a6, BlockAttributeConfigurationManager as b, commonjsGlobal as c, Align as d, AttributesPanelWrapper as e, ContainerBackgroundColor as f, getContextMergeTags as g, TextDecoration as h, Background as i, LineHeight as j, TextTransform as k, BackgroundColor as l, Direction as m, Link as n, Border as o, BorderColor as p, FontSize as q, MergeTags as r, BorderStyle as s, FontStyle as t, BorderWidth as u, FontWeight as v, BlockMarketManager as w, BlockMaskWrapper as x, SourceCodePanel as y, SimpleLayout as z };
|
45229
45185
|
//# sourceMappingURL=index2.js.map
|