easy-email-extensions 3.0.8 → 3.0.12
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 -8
- 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 +3 -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 -0
- 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 +311 -288
- 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,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 { useField, useForm as useForm$1, Form as Form$3, version as version$2 } from "react-final-form";
|
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";
|
@@ -38484,75 +38484,76 @@ function enhancer(Component2, changeAdapter) {
|
|
38484
38484
|
"debounceTime"
|
38485
38485
|
]);
|
38486
38486
|
const {
|
38487
|
-
input: { value,
|
38488
|
-
meta: { touched, error: error2 }
|
38487
|
+
input: { value, onChange }
|
38489
38488
|
} = useField(name, {
|
38490
38489
|
validate: validate3
|
38491
38490
|
});
|
38492
38491
|
const [currentValue, setCurrentValue] = useState(value);
|
38493
|
-
const id = useMemo(() => {
|
38494
|
-
return `enhancer-${primaryId++}`;
|
38495
|
-
}, []);
|
38496
|
-
const { change, mutators } = useForm$1();
|
38497
38492
|
const debounceCallbackChange = useCallback(lodash.exports.debounce((val) => {
|
38498
|
-
|
38499
|
-
},
|
38500
|
-
maxWait:
|
38501
|
-
}), [
|
38493
|
+
onChange(val);
|
38494
|
+
}, 100, {
|
38495
|
+
maxWait: 500
|
38496
|
+
}), []);
|
38502
38497
|
useEffect(() => {
|
38503
38498
|
setCurrentValue(value);
|
38504
38499
|
}, [value]);
|
38505
|
-
const
|
38506
|
-
|
38507
|
-
|
38508
|
-
|
38509
|
-
|
38510
|
-
|
38511
|
-
|
38512
|
-
|
38513
|
-
|
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), {
|
38514
38548
|
id,
|
38515
38549
|
name,
|
38516
38550
|
checked: valueAdapter ? valueAdapter(currentValue) : currentValue,
|
38517
38551
|
value: valueAdapter ? valueAdapter(currentValue) : currentValue,
|
38518
38552
|
onChange: onFieldChange
|
38519
|
-
}))
|
38520
|
-
|
38521
|
-
|
38522
|
-
|
38523
|
-
help: touched && error2
|
38524
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38525
|
-
vertical: true,
|
38526
|
-
spacing: "extraTight"
|
38527
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6, {
|
38528
|
-
spacing: inline ? void 0 : "extraTight",
|
38529
|
-
wrap: false,
|
38530
|
-
vertical: !inline,
|
38531
|
-
alignment: alignment ? alignment : inline ? "center" : void 0,
|
38532
|
-
distribution
|
38533
|
-
}, /* @__PURE__ */ React__default.createElement(Stack$6.Item, null, /* @__PURE__ */ React__default.createElement("label", {
|
38534
|
-
className: labelHidden2 ? styles$5["label-hidden"] : void 0,
|
38535
|
-
htmlFor: id
|
38536
|
-
}, /* @__PURE__ */ React__default.createElement("span", {
|
38537
|
-
style: { whiteSpace: "pre" }
|
38538
|
-
}, required && /* @__PURE__ */ React__default.createElement("span", {
|
38539
|
-
style: { color: "#ff4d4f" }
|
38540
|
-
}, "* "), /* @__PURE__ */ React__default.createElement(TextStyle, {
|
38541
|
-
size: size === "small" ? "smallest" : "small"
|
38542
|
-
}, label)))), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
38543
|
-
fill: inline
|
38544
|
-
}, /* @__PURE__ */ React__default.createElement(Component2, __spreadProps(__spreadValues({
|
38545
|
-
size
|
38546
|
-
}, rest), {
|
38547
|
-
mutators,
|
38548
|
-
id,
|
38549
|
-
name,
|
38550
|
-
checked: valueAdapter ? valueAdapter(currentValue) : currentValue,
|
38551
|
-
value: valueAdapter ? valueAdapter(currentValue) : currentValue,
|
38552
|
-
onChange: onFieldChange
|
38553
|
-
})))), /* @__PURE__ */ React__default.createElement("div", {
|
38554
|
-
className: styles$5.helperText
|
38555
|
-
}, /* @__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
|
+
});
|
38556
38557
|
};
|
38557
38558
|
}
|
38558
38559
|
function Input(props) {
|
@@ -38650,12 +38651,10 @@ function awaitForElement$1(idx) {
|
|
38650
38651
|
});
|
38651
38652
|
return promiseObj;
|
38652
38653
|
}
|
38653
|
-
function InlineText({
|
38654
|
-
|
38655
|
-
|
38656
|
-
|
38657
|
-
mutators: { setFieldTouched }
|
38658
|
-
}) {
|
38654
|
+
function InlineText({ idx, onChange, children }) {
|
38655
|
+
const {
|
38656
|
+
mutators: { setFieldTouched }
|
38657
|
+
} = useForm$1();
|
38659
38658
|
const [isFocus, setIsFocus] = useState(false);
|
38660
38659
|
const [textContainer, setTextContainer] = useState(null);
|
38661
38660
|
useField(idx);
|
@@ -38755,56 +38754,37 @@ function AutoComplete(props) {
|
|
38755
38754
|
data: options2
|
38756
38755
|
}));
|
38757
38756
|
}
|
38758
|
-
|
38759
|
-
|
38760
|
-
|
38761
|
-
|
38762
|
-
|
38763
|
-
}
|
38764
|
-
|
38765
|
-
|
38766
|
-
|
38767
|
-
|
38768
|
-
|
38769
|
-
initX = event2.clientX;
|
38770
|
-
initY = event2.clientY;
|
38771
|
-
} else {
|
38772
|
-
initX = event2.touches[0].clientX;
|
38773
|
-
initY = event2.touches[0].clientY;
|
38774
|
-
}
|
38775
|
-
const onDragMove = lodash.exports.debounce((mEvt) => {
|
38776
|
-
let movX = 0;
|
38777
|
-
let movY = 0;
|
38778
|
-
if (isMouseEvent(mEvt)) {
|
38779
|
-
movX = mEvt.clientX;
|
38780
|
-
movY = mEvt.clientY;
|
38781
|
-
} else {
|
38782
|
-
movX = mEvt.touches[0].clientX;
|
38783
|
-
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;
|
38784
38768
|
}
|
38785
|
-
const
|
38786
|
-
|
38787
|
-
|
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
|
+
};
|
38788
38779
|
});
|
38789
|
-
|
38790
|
-
|
38791
|
-
document.removeEventListener("touchmove", onDragMove);
|
38792
|
-
document.removeEventListener("touchend", onDragEnd);
|
38793
|
-
document.removeEventListener("mousemove", onDragMove);
|
38794
|
-
document.removeEventListener("mousemove", onDragEnd);
|
38795
|
-
};
|
38796
|
-
document.addEventListener("touchmove", onDragMove);
|
38797
|
-
document.addEventListener("touchend", onDragEnd);
|
38798
|
-
document.addEventListener("mousemove", onDragMove);
|
38799
|
-
document.addEventListener("mouseup", onDragEnd);
|
38800
|
-
};
|
38780
|
+
return promiseObj;
|
38781
|
+
}
|
38801
38782
|
const ToolItem$1 = (props) => {
|
38802
|
-
return /* @__PURE__ */ React__default.createElement(
|
38783
|
+
return /* @__PURE__ */ React__default.createElement("button", {
|
38784
|
+
className: "easy-email-extensions-emailToolItem",
|
38803
38785
|
title: props.title,
|
38804
|
-
size: "mini",
|
38805
|
-
icon: props.icon,
|
38806
38786
|
onClick: props.onClick
|
38807
|
-
});
|
38787
|
+
}, props.icon);
|
38808
38788
|
};
|
38809
38789
|
function getAnchorElement(node, matchLength) {
|
38810
38790
|
var _a, _b;
|
@@ -38837,7 +38817,7 @@ function Link$1(props) {
|
|
38837
38817
|
const initialValues = useMemo(() => {
|
38838
38818
|
let link = "";
|
38839
38819
|
let blank = true;
|
38840
|
-
let underline =
|
38820
|
+
let underline = true;
|
38841
38821
|
let linkNode = getLinkNode(props.currentRange);
|
38842
38822
|
if (linkNode) {
|
38843
38823
|
link = linkNode.href;
|
@@ -38889,9 +38869,8 @@ function Link$1(props) {
|
|
38889
38869
|
uncheckedText: "on",
|
38890
38870
|
inline: true
|
38891
38871
|
}))))
|
38892
|
-
}), /* @__PURE__ */ React__default.createElement(
|
38872
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
38893
38873
|
title: "Link",
|
38894
|
-
size: "mini",
|
38895
38874
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
38896
38875
|
iconName: "icon-link"
|
38897
38876
|
})
|
@@ -38929,7 +38908,14 @@ function FontSizeList(props) {
|
|
38929
38908
|
label: "48px"
|
38930
38909
|
}
|
38931
38910
|
];
|
38932
|
-
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, {
|
38933
38919
|
onClickMenuItem: (item2) => {
|
38934
38920
|
props.onChange(item2);
|
38935
38921
|
},
|
@@ -38938,13 +38924,13 @@ function FontSizeList(props) {
|
|
38938
38924
|
}, list2.map((item2) => /* @__PURE__ */ React__default.createElement(Menu$1.Item, {
|
38939
38925
|
style: { lineHeight: "30px", height: 30 },
|
38940
38926
|
key: item2.value
|
38941
|
-
}, item2.label)));
|
38927
|
+
}, item2.label))));
|
38942
38928
|
}
|
38943
38929
|
function FontFamily$1(props) {
|
38944
38930
|
const { fontList: fontList2 = [] } = useEditorProps();
|
38945
38931
|
return /* @__PURE__ */ React__default.createElement("div", {
|
38946
38932
|
style: {
|
38947
|
-
|
38933
|
+
maxWidth: 150,
|
38948
38934
|
maxHeight: 350,
|
38949
38935
|
overflowY: "auto",
|
38950
38936
|
overflowX: "hidden"
|
@@ -38954,7 +38940,7 @@ function FontFamily$1(props) {
|
|
38954
38940
|
props.onChange(item2);
|
38955
38941
|
},
|
38956
38942
|
selectedKeys: [],
|
38957
|
-
style: { border: "none" }
|
38943
|
+
style: { border: "none", padding: 0 }
|
38958
38944
|
}, fontList2.map((item2) => /* @__PURE__ */ React__default.createElement(Menu$1.Item, {
|
38959
38945
|
style: { lineHeight: "30px", height: 30 },
|
38960
38946
|
key: item2.value
|
@@ -39000,7 +38986,8 @@ const MergeTags$1 = React__default.memo((props) => {
|
|
39000
38986
|
onSelect: (vals) => onSelect(vals[0])
|
39001
38987
|
}));
|
39002
38988
|
});
|
39003
|
-
|
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) {
|
39004
38991
|
const { container: container2 } = props;
|
39005
38992
|
const { mergeTags } = useEditorProps();
|
39006
38993
|
const [selectionRange, setSelectionRange] = useState(null);
|
@@ -39066,47 +39053,60 @@ function TextToolbar(props) {
|
|
39066
39053
|
};
|
39067
39054
|
const getPopoverMountNode = () => document.getElementById(FIXED_CONTAINER_ID);
|
39068
39055
|
return /* @__PURE__ */ React__default.createElement("div", {
|
39069
|
-
id: "
|
39056
|
+
id: "Tools",
|
39070
39057
|
style: { display: "flex", flexWrap: "nowrap" }
|
39071
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39072
|
-
|
39073
|
-
|
39074
|
-
|
39075
|
-
|
39076
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39077
|
-
|
39078
|
-
|
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, {
|
39079
39069
|
onChange: (val) => execCommand("fontName", val)
|
39080
|
-
}),
|
39070
|
+
})),
|
39081
39071
|
getPopupContainer: getPopoverMountNode
|
39082
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39083
|
-
|
39072
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39073
|
+
title: "font family",
|
39084
39074
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39085
39075
|
iconName: "icon-font-family"
|
39086
39076
|
})
|
39087
|
-
})), /* @__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",
|
39088
39081
|
color: "#fff",
|
39089
|
-
|
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, {
|
39090
39084
|
onChange: (val) => execCommand("fontSize", val)
|
39091
|
-
}),
|
39085
|
+
})),
|
39092
39086
|
getPopupContainer: getPopoverMountNode
|
39093
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39094
|
-
|
39087
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39088
|
+
title: "line-height",
|
39095
39089
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39096
39090
|
iconName: "icon-line-height"
|
39097
39091
|
})
|
39098
|
-
})), /* @__PURE__ */ React__default.createElement(
|
39092
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
39093
|
+
className: "easy-email-extensions-divider"
|
39094
|
+
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39099
39095
|
onClick: () => execCommand("bold"),
|
39100
39096
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39101
39097
|
iconName: "icon-bold"
|
39102
39098
|
}),
|
39103
39099
|
title: "Bold"
|
39100
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39101
|
+
className: "easy-email-extensions-divider"
|
39104
39102
|
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39105
39103
|
onClick: () => execCommand("italic"),
|
39106
39104
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39107
39105
|
iconName: "icon-italic"
|
39108
39106
|
}),
|
39109
39107
|
title: "Italic"
|
39108
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39109
|
+
className: "easy-email-extensions-divider"
|
39110
39110
|
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
39111
39111
|
label: "",
|
39112
39112
|
position: "tl",
|
@@ -39118,7 +39118,9 @@ function TextToolbar(props) {
|
|
39118
39118
|
iconName: "icon-font-color"
|
39119
39119
|
}),
|
39120
39120
|
title: "Text color"
|
39121
|
-
})), /* @__PURE__ */ React__default.createElement(
|
39121
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
39122
|
+
className: "easy-email-extensions-divider"
|
39123
|
+
}), /* @__PURE__ */ React__default.createElement(ColorPicker, {
|
39122
39124
|
label: "",
|
39123
39125
|
showInput: false,
|
39124
39126
|
position: "tl",
|
@@ -39129,10 +39131,14 @@ function TextToolbar(props) {
|
|
39129
39131
|
iconName: "icon-bg-colors"
|
39130
39132
|
}),
|
39131
39133
|
title: "Background color"
|
39132
|
-
})), /* @__PURE__ */ React__default.createElement(
|
39134
|
+
})), /* @__PURE__ */ React__default.createElement("div", {
|
39135
|
+
className: "easy-email-extensions-divider"
|
39136
|
+
}), /* @__PURE__ */ React__default.createElement(Link$1, {
|
39133
39137
|
currentRange: selectionRange,
|
39134
39138
|
onChange: (values2) => execCommand("createLink", values2),
|
39135
39139
|
getPopupContainer: getPopoverMountNode
|
39140
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39141
|
+
className: "easy-email-extensions-divider"
|
39136
39142
|
}), mergeTags && /* @__PURE__ */ React__default.createElement(Tooltip$1, {
|
39137
39143
|
color: "#fff",
|
39138
39144
|
position: "bottom",
|
@@ -39141,21 +39147,14 @@ function TextToolbar(props) {
|
|
39141
39147
|
onChange: (val) => execCommand("insertHTML", val)
|
39142
39148
|
}),
|
39143
39149
|
getPopupContainer: getPopoverMountNode
|
39144
|
-
}, /* @__PURE__ */ React__default.createElement(
|
39145
|
-
size: "mini",
|
39150
|
+
}, /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39146
39151
|
title: "Merge tag",
|
39147
39152
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39148
39153
|
iconName: "icon-merge-tags"
|
39149
39154
|
})
|
39150
|
-
})), /* @__PURE__ */ React__default.createElement(
|
39151
|
-
|
39152
|
-
|
39153
|
-
iconName: "icon-close"
|
39154
|
-
}),
|
39155
|
-
title: "Remove format"
|
39156
|
-
})), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
39157
|
-
spacing: "extraTight"
|
39158
|
-
}, /* @__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, {
|
39159
39158
|
onClick: () => execCommand("justifyLeft"),
|
39160
39159
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
39161
39160
|
iconName: "icon-align-left"
|
@@ -39173,6 +39172,8 @@ function TextToolbar(props) {
|
|
39173
39172
|
iconName: "icon-align-right"
|
39174
39173
|
}),
|
39175
39174
|
title: "Align right"
|
39175
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39176
|
+
className: "easy-email-extensions-divider"
|
39176
39177
|
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39177
39178
|
onClick: () => execCommand("insertOrderedList"),
|
39178
39179
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
@@ -39185,6 +39186,8 @@ function TextToolbar(props) {
|
|
39185
39186
|
iconName: "icon-list-ul"
|
39186
39187
|
}),
|
39187
39188
|
title: "Unorderlist"
|
39189
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
39190
|
+
className: "easy-email-extensions-divider"
|
39188
39191
|
}), /* @__PURE__ */ React__default.createElement(ToolItem$1, {
|
39189
39192
|
onClick: () => execCommand("strikeThrough"),
|
39190
39193
|
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
@@ -39203,77 +39206,108 @@ function TextToolbar(props) {
|
|
39203
39206
|
iconName: "icon-line"
|
39204
39207
|
}),
|
39205
39208
|
title: "Line"
|
39206
|
-
})
|
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
|
+
})));
|
39207
39220
|
}
|
39208
|
-
|
39209
|
-
|
39210
|
-
const
|
39211
|
-
const
|
39212
|
-
const [
|
39213
|
-
const
|
39214
|
-
const {
|
39215
|
-
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", "");
|
39216
39230
|
useEffect(() => {
|
39217
|
-
const
|
39218
|
-
|
39219
|
-
|
39220
|
-
|
39221
|
-
|
39222
|
-
|
39223
|
-
});
|
39224
|
-
}
|
39225
|
-
}, [idx, locationState == null ? void 0 : locationState.left, locationState == null ? void 0 : locationState.top]);
|
39226
|
-
const onChange = useCallback(() => {
|
39227
|
-
}, []);
|
39228
|
-
const editorContainer = container2 && getEditNode(container2);
|
39229
|
-
const textToolbar = useMemo(() => {
|
39230
|
-
const onMoveTextToolbar = (event2) => {
|
39231
|
-
onDrag({
|
39232
|
-
event: event2,
|
39233
|
-
onMove(x, y) {
|
39234
|
-
setPosition({
|
39235
|
-
left: position.left + x,
|
39236
|
-
top: position.top + y
|
39237
|
-
});
|
39238
|
-
setLocationState({
|
39239
|
-
left: position.left + x,
|
39240
|
-
top: position.top + y
|
39241
|
-
});
|
39242
|
-
},
|
39243
|
-
onEnd() {
|
39244
|
-
}
|
39245
|
-
});
|
39231
|
+
const promiseObj = awaitForElement(focusIdx2);
|
39232
|
+
promiseObj.promise.then((blockNode2) => {
|
39233
|
+
setBlockNode(blockNode2);
|
39234
|
+
});
|
39235
|
+
return () => {
|
39236
|
+
promiseObj.cancel();
|
39246
39237
|
};
|
39247
|
-
|
39248
|
-
|
39249
|
-
|
39250
|
-
|
39251
|
-
|
39252
|
-
|
39253
|
-
|
39254
|
-
|
39255
|
-
|
39256
|
-
|
39257
|
-
|
39258
|
-
|
39259
|
-
|
39260
|
-
|
39261
|
-
|
39262
|
-
|
39263
|
-
width
|
39264
|
-
left
|
39265
|
-
|
39266
|
-
|
39267
|
-
|
39268
|
-
|
39269
|
-
|
39270
|
-
|
39271
|
-
|
39272
|
-
|
39273
|
-
|
39274
|
-
|
39275
|
-
|
39276
|
-
|
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)));
|
39277
39311
|
};
|
39278
39312
|
const RichTextField = (props) => {
|
39279
39313
|
const { focusBlock: focusBlock2 } = useBlock();
|
@@ -39983,32 +40017,39 @@ function Page() {
|
|
39983
40017
|
}
|
39984
40018
|
function Padding(props = {}) {
|
39985
40019
|
const { title: title2 = "Padding", attributeName = "padding" } = props;
|
39986
|
-
const { focusBlock: focusBlock2 } = useBlock();
|
40020
|
+
const { focusBlock: focusBlock2, change } = useBlock();
|
39987
40021
|
const { focusIdx: focusIdx2 } = useFocusIdx();
|
39988
|
-
const
|
39989
|
-
const
|
39990
|
-
|
39991
|
-
|
39992
|
-
|
39993
|
-
|
39994
|
-
|
39995
|
-
|
39996
|
-
|
39997
|
-
|
39998
|
-
|
39999
|
-
|
40000
|
-
|
40001
|
-
|
40002
|
-
|
40003
|
-
|
40004
|
-
|
40005
|
-
|
40006
|
-
vals[index2] = newVal;
|
40007
|
-
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
|
40008
40040
|
};
|
40009
|
-
}, [
|
40010
|
-
|
40011
|
-
|
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, {
|
40012
40053
|
vertical: true,
|
40013
40054
|
spacing: "extraTight"
|
40014
40055
|
}, /* @__PURE__ */ React__default.createElement(TextStyle, {
|
@@ -40020,18 +40061,14 @@ function Padding(props = {}) {
|
|
40020
40061
|
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40021
40062
|
label: /* @__PURE__ */ React__default.createElement("span", null, "Top\xA0"),
|
40022
40063
|
quickchange: true,
|
40023
|
-
name:
|
40024
|
-
valueAdapter: getVal(0),
|
40025
|
-
onChangeAdapter: setVal(0),
|
40064
|
+
name: "top",
|
40026
40065
|
inline: true
|
40027
40066
|
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
40028
40067
|
fill: true
|
40029
40068
|
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40030
40069
|
label: "Bottom",
|
40031
40070
|
quickchange: true,
|
40032
|
-
name:
|
40033
|
-
valueAdapter: getVal(2),
|
40034
|
-
onChangeAdapter: setVal(2),
|
40071
|
+
name: "bottom",
|
40035
40072
|
inline: true
|
40036
40073
|
}))), /* @__PURE__ */ React__default.createElement(Stack$6, {
|
40037
40074
|
wrap: false
|
@@ -40040,22 +40077,29 @@ function Padding(props = {}) {
|
|
40040
40077
|
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40041
40078
|
label: /* @__PURE__ */ React__default.createElement("span", null, "Left"),
|
40042
40079
|
quickchange: true,
|
40043
|
-
name:
|
40044
|
-
valueAdapter: getVal(3),
|
40045
|
-
onChangeAdapter: setVal(3),
|
40080
|
+
name: "left",
|
40046
40081
|
inline: true
|
40047
40082
|
})), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
|
40048
40083
|
fill: true
|
40049
40084
|
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
40050
40085
|
label: /* @__PURE__ */ React__default.createElement("span", null, "Right\xA0"),
|
40051
40086
|
quickchange: true,
|
40052
|
-
name:
|
40053
|
-
valueAdapter: getVal(1),
|
40054
|
-
onChangeAdapter: setVal(1),
|
40087
|
+
name: "right",
|
40055
40088
|
inline: true
|
40056
|
-
}))))
|
40057
|
-
|
40089
|
+
})))), /* @__PURE__ */ React__default.createElement(PaddingChangeWrapper, {
|
40090
|
+
onChange: onChancePadding
|
40091
|
+
}));
|
40092
|
+
});
|
40058
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
|
+
};
|
40059
40103
|
function BackgroundColor({
|
40060
40104
|
title: title2 = "Background color"
|
40061
40105
|
}) {
|
@@ -43990,7 +44034,6 @@ const BlocksPanel = (props) => {
|
|
43990
44034
|
tabPosition: "left",
|
43991
44035
|
size: "large"
|
43992
44036
|
}, filterCategories.map((category, index2) => /* @__PURE__ */ React__default.createElement(Tabs$1.TabPane, {
|
43993
|
-
className: "no-scrollbar",
|
43994
44037
|
style: {
|
43995
44038
|
padding: 0,
|
43996
44039
|
overflow: "auto"
|
@@ -44177,31 +44220,6 @@ function SourceCodePanel() {
|
|
44177
44220
|
onBlur: onMjmlChange
|
44178
44221
|
})));
|
44179
44222
|
}
|
44180
|
-
function awaitForElement(idx) {
|
44181
|
-
let promiseObj = {
|
44182
|
-
cancel: () => {
|
44183
|
-
},
|
44184
|
-
promise: Promise.resolve()
|
44185
|
-
};
|
44186
|
-
promiseObj.promise = new Promise((resolve) => {
|
44187
|
-
const ele = getBlockNodeByIdx(idx);
|
44188
|
-
if (ele) {
|
44189
|
-
resolve(ele);
|
44190
|
-
return;
|
44191
|
-
}
|
44192
|
-
const timer = setInterval(() => {
|
44193
|
-
const ele2 = getBlockNodeByIdx(idx);
|
44194
|
-
if (ele2) {
|
44195
|
-
resolve(ele2);
|
44196
|
-
clearInterval(timer);
|
44197
|
-
}
|
44198
|
-
}, 50);
|
44199
|
-
promiseObj.cancel = () => {
|
44200
|
-
clearInterval(timer);
|
44201
|
-
};
|
44202
|
-
});
|
44203
|
-
return promiseObj;
|
44204
|
-
}
|
44205
44223
|
function Toolbar({
|
44206
44224
|
block: block2,
|
44207
44225
|
direction
|
@@ -44314,22 +44332,27 @@ function FocusTooltip() {
|
|
44314
44332
|
useEffect(() => {
|
44315
44333
|
if (blockNode) {
|
44316
44334
|
const options2 = {
|
44317
|
-
rootMargin: "-24px 0px
|
44318
|
-
root: getShadowRoot().
|
44319
|
-
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]
|
44320
44338
|
};
|
44321
44339
|
const checkDirection = (ev) => {
|
44322
44340
|
const [current] = ev;
|
44323
|
-
const { top
|
44341
|
+
const { top } = current.intersectionRect;
|
44324
44342
|
const rootBounds = current.rootBounds;
|
44343
|
+
const intersectionRatio = current.intersectionRatio;
|
44325
44344
|
if (!rootBounds)
|
44326
44345
|
return;
|
44327
|
-
if (
|
44346
|
+
if (intersectionRatio === 1) {
|
44328
44347
|
setDirection("top");
|
44329
|
-
} else if (rootBounds.top === top) {
|
44330
|
-
setDirection("bottom");
|
44331
44348
|
} else {
|
44332
|
-
|
44349
|
+
if (top) {
|
44350
|
+
if (top > rootBounds.top) {
|
44351
|
+
setDirection("top");
|
44352
|
+
} else {
|
44353
|
+
setDirection("bottom");
|
44354
|
+
}
|
44355
|
+
}
|
44333
44356
|
}
|
44334
44357
|
};
|
44335
44358
|
const observer = new IntersectionObserver(checkDirection, options2);
|