easy-email-pro-theme 1.53.0 → 1.54.0
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/index.js +929 -281
- package/lib/style.css +64 -3
- package/lib/typings/components/ConfigurationPanel/Schemas/PageFooter.d.ts +2 -0
- package/lib/typings/components/ConfigurationPanel/Schemas/PageHeader.d.ts +2 -0
- package/lib/typings/components/EditorContainer/index.d.ts +5 -0
- package/lib/typings/components/Form/ImageUploaderField/index.d.ts +1 -0
- package/lib/typings/components/HoveringToolbar/RichTextBar.d.ts +6 -1
- package/lib/typings/components/index.d.ts +3 -1
- package/lib/typings/constants/index.d.ts +1 -0
- package/lib/typings/utils/normalizeElements.d.ts +2 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -516,36 +516,51 @@ const RetroStyleText = '[data-slate-block=page] {\n min-height: 300px;\n}\n\n[d
|
|
|
516
516
|
const withTheme$1 = (editor) => {
|
|
517
517
|
const { insertBreak, normalizeNode, deleteBackward, apply: apply2, insertSoftBreak } = editor;
|
|
518
518
|
editor.insertBreak = (...args) => {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
519
|
+
try {
|
|
520
|
+
if (!editor.selection) {
|
|
521
|
+
insertBreak(...args);
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
const node = Editor.above(editor, {
|
|
525
|
+
match: NodeUtils.isTextElement
|
|
526
|
+
});
|
|
527
|
+
if (!node)
|
|
528
|
+
return;
|
|
529
|
+
insertBreak(...args);
|
|
530
|
+
} catch (error2) {
|
|
531
|
+
insertBreak(...args);
|
|
532
|
+
}
|
|
525
533
|
};
|
|
526
534
|
editor.insertSoftBreak = () => {
|
|
527
535
|
};
|
|
528
536
|
editor.deleteBackward = (unit) => {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
if (contentElementEntry && editor.selection) {
|
|
533
|
-
const elementLength = contentElementEntry[1].length;
|
|
534
|
-
const childPath = editor.selection.anchor.path.filter(
|
|
535
|
-
(_, index2) => index2 > elementLength - 1
|
|
536
|
-
);
|
|
537
|
-
const isCollapsed = Boolean(
|
|
538
|
-
editor.selection && (Range.isCollapsed(editor.selection) || Editor.string(editor, editor.selection) === "")
|
|
539
|
-
);
|
|
540
|
-
const isFirstNode = childPath.every((item2) => item2 === 0);
|
|
541
|
-
if (isCollapsed && editor.selection.anchor.offset === 0 && editor.selection.focus.offset === 0 && isFirstNode) {
|
|
542
|
-
if (editor.selection && Editor.string(editor, editor.selection) === Editor.string(editor, contentElementEntry[1])) {
|
|
543
|
-
editor.unwrapNodes({
|
|
544
|
-
match: NodeUtils.isHTMLBlockNodeElement
|
|
545
|
-
});
|
|
546
|
-
}
|
|
537
|
+
try {
|
|
538
|
+
if (!editor.selection) {
|
|
539
|
+
deleteBackward(unit);
|
|
547
540
|
return;
|
|
548
541
|
}
|
|
542
|
+
const contentElementEntry = Editor.above(editor, {
|
|
543
|
+
match: NodeUtils.isContentElement
|
|
544
|
+
});
|
|
545
|
+
if (contentElementEntry && editor.selection) {
|
|
546
|
+
const elementLength = contentElementEntry[1].length;
|
|
547
|
+
const childPath = editor.selection.anchor.path.filter(
|
|
548
|
+
(_, index2) => index2 > elementLength - 1
|
|
549
|
+
);
|
|
550
|
+
const isCollapsed = Boolean(
|
|
551
|
+
editor.selection && (Range.isCollapsed(editor.selection) || Editor.string(editor, editor.selection) === "")
|
|
552
|
+
);
|
|
553
|
+
const isFirstNode = childPath.every((item2) => item2 === 0);
|
|
554
|
+
if (isCollapsed && editor.selection.anchor.offset === 0 && editor.selection.focus.offset === 0 && isFirstNode) {
|
|
555
|
+
if (editor.selection && Editor.string(editor, editor.selection) === Editor.string(editor, contentElementEntry[1])) {
|
|
556
|
+
editor.unwrapNodes({
|
|
557
|
+
match: NodeUtils.isHTMLBlockNodeElement
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
} catch (error2) {
|
|
549
564
|
}
|
|
550
565
|
deleteBackward(unit);
|
|
551
566
|
};
|
|
@@ -906,6 +921,11 @@ const DraggingProvider = ({
|
|
|
906
921
|
removeSelectedStyle();
|
|
907
922
|
return;
|
|
908
923
|
}
|
|
924
|
+
const disableDragElement = NodeUtils.isPageHeaderElement(dropElement) || NodeUtils.isPageFooterElement(dropElement);
|
|
925
|
+
if (disableDragElement) {
|
|
926
|
+
removeSelectedStyle();
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
909
929
|
let dropPath = ReactEditor.findPath(editor, dropElement);
|
|
910
930
|
let source = null;
|
|
911
931
|
if ((propsData == null ? void 0 : propsData.action) === "move") {
|
|
@@ -1817,6 +1837,9 @@ const useCopyBlock = () => {
|
|
|
1817
1837
|
if (lock)
|
|
1818
1838
|
return;
|
|
1819
1839
|
const block = Node.get(editor, path2);
|
|
1840
|
+
if (NodeUtils.isPageHeaderElement(block) || NodeUtils.isPageFooterElement(block)) {
|
|
1841
|
+
return;
|
|
1842
|
+
}
|
|
1820
1843
|
const next = Path.next(path2);
|
|
1821
1844
|
const newBlock = assignIdsToElementTree(block, true);
|
|
1822
1845
|
Transforms.insertNodes(editor, newBlock, {
|
|
@@ -1887,6 +1910,10 @@ const useDeleteBlock = () => {
|
|
|
1887
1910
|
(path2) => {
|
|
1888
1911
|
if (lock)
|
|
1889
1912
|
return;
|
|
1913
|
+
const element = Node.get(editor, path2);
|
|
1914
|
+
if (NodeUtils.isPageHeaderElement(element) || NodeUtils.isPageFooterElement(element)) {
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1890
1917
|
try {
|
|
1891
1918
|
const [entry] = Editor.nodes(editor, {
|
|
1892
1919
|
match(node, currentPath) {
|
|
@@ -2292,6 +2319,7 @@ const ElementTools$1 = ({ element, nodeElement, path: path2 }) => {
|
|
|
2292
2319
|
isHideBackIcon = true;
|
|
2293
2320
|
}
|
|
2294
2321
|
const hideAddToCollection = universalElementEditing || standaloneElementEditing || !universalElementSetting;
|
|
2322
|
+
const hideInnerTools = NodeUtils.isPageHeaderElement(element) || NodeUtils.isPageFooterElement(element);
|
|
2295
2323
|
const renderContent = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
2296
2324
|
"div",
|
|
2297
2325
|
{
|
|
@@ -2320,7 +2348,7 @@ const ElementTools$1 = ({ element, nodeElement, path: path2 }) => {
|
|
|
2320
2348
|
},
|
|
2321
2349
|
/* @__PURE__ */ React__default.createElement(
|
|
2322
2350
|
"div",
|
|
2323
|
-
__spreadProps(__spreadValues({}, isEditingUniversalElement || isEditingStandaloneElement ? {} : dragHandle), {
|
|
2351
|
+
__spreadProps(__spreadValues({}, isEditingUniversalElement || isEditingStandaloneElement || hideInnerTools ? {} : dragHandle), {
|
|
2324
2352
|
style: {
|
|
2325
2353
|
cursor: isEditingUniversalElement || isEditingStandaloneElement ? "default" : "grab",
|
|
2326
2354
|
display: "flex"
|
|
@@ -2335,7 +2363,7 @@ const ElementTools$1 = ({ element, nodeElement, path: path2 }) => {
|
|
|
2335
2363
|
),
|
|
2336
2364
|
BlockManager.getBlockTitle(element)
|
|
2337
2365
|
),
|
|
2338
|
-
ElementToolsInner ? /* @__PURE__ */ React__default.createElement(
|
|
2366
|
+
!hideInnerTools && (ElementToolsInner ? /* @__PURE__ */ React__default.createElement(
|
|
2339
2367
|
ElementToolsInner,
|
|
2340
2368
|
{
|
|
2341
2369
|
element,
|
|
@@ -2349,9 +2377,30 @@ const ElementTools$1 = ({ element, nodeElement, path: path2 }) => {
|
|
|
2349
2377
|
onPointerDown: onSelectParent
|
|
2350
2378
|
},
|
|
2351
2379
|
/* @__PURE__ */ React__default.createElement(IconFont, { iconName: "icon-back-parent" })
|
|
2352
|
-
), !isEditingUniversalElement && !isEditingStandaloneElement && /* @__PURE__ */ React__default.createElement(
|
|
2380
|
+
), !isEditingUniversalElement && !isEditingStandaloneElement && /* @__PURE__ */ React__default.createElement(
|
|
2381
|
+
"div",
|
|
2382
|
+
{
|
|
2383
|
+
className: "element-tools-item",
|
|
2384
|
+
onPointerDown: onCopy
|
|
2385
|
+
},
|
|
2386
|
+
/* @__PURE__ */ React__default.createElement(IconFont, { iconName: "icon-copy" })
|
|
2387
|
+
), !hideAddToCollection && /* @__PURE__ */ React__default.createElement(
|
|
2388
|
+
"div",
|
|
2389
|
+
{
|
|
2390
|
+
className: "element-tools-item",
|
|
2391
|
+
onPointerDown: openModal
|
|
2392
|
+
},
|
|
2393
|
+
/* @__PURE__ */ React__default.createElement(IconFont, { iconName: "icon-collection" })
|
|
2394
|
+
), !isEditingUniversalElement && !isEditingStandaloneElement && /* @__PURE__ */ React__default.createElement(
|
|
2395
|
+
"div",
|
|
2396
|
+
{
|
|
2397
|
+
className: "element-tools-item",
|
|
2398
|
+
onPointerDown: onDelete
|
|
2399
|
+
},
|
|
2400
|
+
/* @__PURE__ */ React__default.createElement(IconFont, { iconName: "icon-delete" })
|
|
2401
|
+
)))
|
|
2353
2402
|
),
|
|
2354
|
-
showDragMoveIcon && !isEditingUniversalElement && !isEditingStandaloneElement && /* @__PURE__ */ React__default.createElement("div", __spreadValues({ className: "element-tools-move-handle" }, dragHandleV2), /* @__PURE__ */ React__default.createElement(IconFont, { iconName: "icon-move" }))
|
|
2403
|
+
showDragMoveIcon && !hideInnerTools && !isEditingUniversalElement && !isEditingStandaloneElement && /* @__PURE__ */ React__default.createElement("div", __spreadValues({ className: "element-tools-move-handle" }, dragHandleV2), /* @__PURE__ */ React__default.createElement(IconFont, { iconName: "icon-move" }))
|
|
2355
2404
|
), /* @__PURE__ */ React__default.createElement("div", { className: "element-dragover" }), /* @__PURE__ */ React__default.createElement("style", null, styleText$g));
|
|
2356
2405
|
return /* @__PURE__ */ React__default.createElement("div", null, renderContent);
|
|
2357
2406
|
};
|
|
@@ -2366,6 +2415,9 @@ const ElementHover$1 = ({
|
|
|
2366
2415
|
return null;
|
|
2367
2416
|
if (NodeUtils.isUnsetElement(element))
|
|
2368
2417
|
return null;
|
|
2418
|
+
if ((NodeUtils.isPageHeaderElement(element) || NodeUtils.isPageFooterElement(element)) && !element.data.editable) {
|
|
2419
|
+
return null;
|
|
2420
|
+
}
|
|
2369
2421
|
const renderContent = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(ElementTools$1, { element, nodeElement, path: path2 }), /* @__PURE__ */ React__default.createElement("style", null, styleText$f));
|
|
2370
2422
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderContent);
|
|
2371
2423
|
};
|
|
@@ -2373,6 +2425,9 @@ const styleText$e = "[data-slate-selected=true] .element-tools-container,\n[data
|
|
|
2373
2425
|
const ElementSelected = ({ element, nodeElement, path: path2 }) => {
|
|
2374
2426
|
if (NodeUtils.isUnsetElement(element))
|
|
2375
2427
|
return null;
|
|
2428
|
+
if ((NodeUtils.isPageHeaderElement(element) || NodeUtils.isPageFooterElement(element)) && !element.data.editable) {
|
|
2429
|
+
return null;
|
|
2430
|
+
}
|
|
2376
2431
|
const renderContent = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(ElementTools$1, { element, nodeElement, path: path2 }), /* @__PURE__ */ React__default.createElement("style", null, styleText$e));
|
|
2377
2432
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderContent);
|
|
2378
2433
|
};
|
|
@@ -7536,6 +7591,21 @@ const BlockLayer = () => {
|
|
|
7536
7591
|
handleCollapseToggle(defaultCollapsedAll);
|
|
7537
7592
|
}
|
|
7538
7593
|
}, [defaultCollapsedAll, handleCollapseToggle]);
|
|
7594
|
+
const filterItems = useMemo(() => {
|
|
7595
|
+
return pageElement.children.filter((child) => {
|
|
7596
|
+
return !(NodeUtils.isPageHeaderElement(child) || NodeUtils.isPageFooterElement(child));
|
|
7597
|
+
});
|
|
7598
|
+
}, [pageElement.children]);
|
|
7599
|
+
const pageHeaderElement = useMemo(() => {
|
|
7600
|
+
return pageElement.children.find(
|
|
7601
|
+
(child) => NodeUtils.isPageHeaderElement(child)
|
|
7602
|
+
);
|
|
7603
|
+
}, [pageElement.children]);
|
|
7604
|
+
const pageFooterElement = useMemo(() => {
|
|
7605
|
+
return pageElement.children.find(
|
|
7606
|
+
(child) => NodeUtils.isPageFooterElement(child)
|
|
7607
|
+
);
|
|
7608
|
+
}, [pageElement.children]);
|
|
7539
7609
|
if (!inited)
|
|
7540
7610
|
return null;
|
|
7541
7611
|
return /* @__PURE__ */ React__default.createElement("div", { onMouseOut: (e) => e.stopPropagation() }, /* @__PURE__ */ React__default.createElement(
|
|
@@ -7557,15 +7627,113 @@ const BlockLayer = () => {
|
|
|
7557
7627
|
style: { marginRight: 12 }
|
|
7558
7628
|
}
|
|
7559
7629
|
), /* @__PURE__ */ React__default.createElement(Typography$1.Text, { style: { fontSize: 14, color: "#333" } }, t("Collapse All")))
|
|
7560
|
-
), /* @__PURE__ */ React__default.createElement(
|
|
7630
|
+
), pageHeaderElement && /* @__PURE__ */ React__default.createElement(HeaderFooterItem, { element: pageHeaderElement }), filterItems.length > 0 && /* @__PURE__ */ React__default.createElement(
|
|
7561
7631
|
ElementList,
|
|
7562
7632
|
{
|
|
7563
|
-
blocks:
|
|
7633
|
+
blocks: filterItems,
|
|
7564
7634
|
collapsedItems,
|
|
7565
7635
|
onToggleCollapse: toggleItemCollapse
|
|
7566
7636
|
}
|
|
7567
|
-
));
|
|
7637
|
+
), pageFooterElement && /* @__PURE__ */ React__default.createElement(HeaderFooterItem, { element: pageFooterElement }));
|
|
7568
7638
|
};
|
|
7639
|
+
function HeaderFooterItem({ element }) {
|
|
7640
|
+
const { setSelectedNodePath, setHoverNodePath } = useEditorActions();
|
|
7641
|
+
const { hoverNodePath, selectedNodePath } = useEditorState();
|
|
7642
|
+
const editor = useSlateStatic();
|
|
7643
|
+
const path2 = useMemo(() => {
|
|
7644
|
+
try {
|
|
7645
|
+
return ReactEditor.findPath(editor, element);
|
|
7646
|
+
} catch (error2) {
|
|
7647
|
+
return null;
|
|
7648
|
+
}
|
|
7649
|
+
}, [element, editor]);
|
|
7650
|
+
const onClick = () => {
|
|
7651
|
+
if (!path2)
|
|
7652
|
+
return;
|
|
7653
|
+
setSelectedNodePath(path2);
|
|
7654
|
+
};
|
|
7655
|
+
const label = BlockManager.getBlockTitle(element);
|
|
7656
|
+
const isHovered = useMemo(() => {
|
|
7657
|
+
if (!path2 || !hoverNodePath)
|
|
7658
|
+
return false;
|
|
7659
|
+
return Path.equals(path2, hoverNodePath);
|
|
7660
|
+
}, [path2, hoverNodePath]);
|
|
7661
|
+
const isSelected = useMemo(() => {
|
|
7662
|
+
if (!path2 || !selectedNodePath)
|
|
7663
|
+
return false;
|
|
7664
|
+
return Path.equals(path2, selectedNodePath);
|
|
7665
|
+
}, [path2, selectedNodePath]);
|
|
7666
|
+
const handleMouseEnter = () => {
|
|
7667
|
+
if (path2) {
|
|
7668
|
+
setHoverNodePath(path2);
|
|
7669
|
+
}
|
|
7670
|
+
};
|
|
7671
|
+
const handleMouseLeave = () => {
|
|
7672
|
+
setHoverNodePath(null);
|
|
7673
|
+
};
|
|
7674
|
+
const getBackgroundColor = () => {
|
|
7675
|
+
if (isSelected) {
|
|
7676
|
+
return "rgba(var(--primary-6), 0.15)";
|
|
7677
|
+
}
|
|
7678
|
+
if (isHovered) {
|
|
7679
|
+
return "#e8e8e8";
|
|
7680
|
+
}
|
|
7681
|
+
return "#f5f5f5";
|
|
7682
|
+
};
|
|
7683
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
7684
|
+
"div",
|
|
7685
|
+
{
|
|
7686
|
+
className: styles$4.item,
|
|
7687
|
+
onClick,
|
|
7688
|
+
onMouseEnter: handleMouseEnter,
|
|
7689
|
+
onMouseLeave: handleMouseLeave,
|
|
7690
|
+
style: {
|
|
7691
|
+
backgroundColor: getBackgroundColor(),
|
|
7692
|
+
marginTop: "8px",
|
|
7693
|
+
marginBottom: "8px",
|
|
7694
|
+
borderRadius: "4px",
|
|
7695
|
+
borderLeft: isSelected ? "3px solid var(--primary-6)" : "none",
|
|
7696
|
+
transition: "background-color 0.2s"
|
|
7697
|
+
}
|
|
7698
|
+
},
|
|
7699
|
+
/* @__PURE__ */ React__default.createElement(
|
|
7700
|
+
"div",
|
|
7701
|
+
{
|
|
7702
|
+
className: styles$4.itemContent,
|
|
7703
|
+
style: {
|
|
7704
|
+
backgroundColor: "transparent",
|
|
7705
|
+
padding: "8px 10px"
|
|
7706
|
+
}
|
|
7707
|
+
},
|
|
7708
|
+
/* @__PURE__ */ React__default.createElement("div", { className: styles$4.itemTitle }, /* @__PURE__ */ React__default.createElement("div", { className: styles$4.itemLabelWrapper }, /* @__PURE__ */ React__default.createElement(
|
|
7709
|
+
SharedComponents.ElementIcon,
|
|
7710
|
+
{
|
|
7711
|
+
type: element.type,
|
|
7712
|
+
width: 16,
|
|
7713
|
+
height: 16
|
|
7714
|
+
}
|
|
7715
|
+
), /* @__PURE__ */ React__default.createElement("div", { className: styles$4.itemLabel }, label))),
|
|
7716
|
+
/* @__PURE__ */ React__default.createElement(
|
|
7717
|
+
"div",
|
|
7718
|
+
{
|
|
7719
|
+
className: styles$4.itemActions,
|
|
7720
|
+
style: { opacity: 1 },
|
|
7721
|
+
onClick: (e) => e.stopPropagation()
|
|
7722
|
+
},
|
|
7723
|
+
/* @__PURE__ */ React__default.createElement("div", { className: styles$4.action }, /* @__PURE__ */ React__default.createElement(
|
|
7724
|
+
"svg",
|
|
7725
|
+
{
|
|
7726
|
+
viewBox: "0 0 1024 1024",
|
|
7727
|
+
width: "16",
|
|
7728
|
+
height: "16",
|
|
7729
|
+
fill: "currentColor"
|
|
7730
|
+
},
|
|
7731
|
+
/* @__PURE__ */ React__default.createElement("path", { d: "M716.8 512L332.8 128c-12.8-12.8-12.8-32 0-44.8s32-12.8 44.8 0l409.6 409.6c12.8 12.8 12.8 32 0 44.8L377.6 940.8c-12.8 12.8-32 12.8-44.8 0s-12.8-32 0-44.8L716.8 512z" })
|
|
7732
|
+
))
|
|
7733
|
+
)
|
|
7734
|
+
)
|
|
7735
|
+
);
|
|
7736
|
+
}
|
|
7569
7737
|
const BlockSideBar = ({ height }) => {
|
|
7570
7738
|
const { setSelectedNodePath } = useEditorActions();
|
|
7571
7739
|
const selectedNodePath = useSelectedNodePath();
|
|
@@ -8127,7 +8295,7 @@ const Controller = () => {
|
|
|
8127
8295
|
position: "fixed",
|
|
8128
8296
|
bottom: offset.bottom,
|
|
8129
8297
|
left: offset.left,
|
|
8130
|
-
zIndex:
|
|
8298
|
+
zIndex: 1,
|
|
8131
8299
|
cursor: "grab"
|
|
8132
8300
|
}
|
|
8133
8301
|
},
|
|
@@ -14481,41 +14649,62 @@ const getElementPageLayout = (params) => {
|
|
|
14481
14649
|
relativedElementVisible
|
|
14482
14650
|
};
|
|
14483
14651
|
};
|
|
14652
|
+
const EDITOR_CONTAINER = "EditorContainer";
|
|
14484
14653
|
const HoveringToolbar = () => {
|
|
14485
14654
|
const ref = useRef(null);
|
|
14486
14655
|
const editor = useSlate();
|
|
14487
14656
|
const { hoveringToolbar } = useEditorProps();
|
|
14488
14657
|
const { selectedNode } = useSelectedNode();
|
|
14489
14658
|
const [isFocus, setIsFocus] = useState(false);
|
|
14490
|
-
const {
|
|
14491
|
-
const
|
|
14659
|
+
const { lock } = useEditorState();
|
|
14660
|
+
const selection = editor.selection;
|
|
14661
|
+
const nodePath = selectedNode && (selection == null ? void 0 : selection.anchor.path) && Node.has(editor, selection.anchor.path) ? selection.anchor.path : null;
|
|
14492
14662
|
const isTable2 = selectedNode && NodeUtils.isTable2Element(selectedNode);
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
|
-
|
|
14497
|
-
|
|
14663
|
+
let contentElements = [];
|
|
14664
|
+
try {
|
|
14665
|
+
contentElements = Array.from(
|
|
14666
|
+
Editor.nodes(editor, {
|
|
14667
|
+
match: (node) => isTable2 ? NodeUtils.isTable2TdElement(node) : NodeUtils.isContentElement(node)
|
|
14668
|
+
})
|
|
14669
|
+
);
|
|
14670
|
+
} catch (error2) {
|
|
14671
|
+
}
|
|
14498
14672
|
let selectedContentBlockNodeEntry = null;
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
|
|
14506
|
-
|
|
14673
|
+
let mergetagNodeEntry = null;
|
|
14674
|
+
if (nodePath) {
|
|
14675
|
+
try {
|
|
14676
|
+
mergetagNodeEntry = Editor.above(editor, {
|
|
14677
|
+
at: nodePath,
|
|
14678
|
+
match: NodeUtils.isMergetagElement
|
|
14679
|
+
});
|
|
14680
|
+
} catch (error2) {
|
|
14681
|
+
}
|
|
14682
|
+
}
|
|
14683
|
+
let htmlNodeImgEntry = null;
|
|
14684
|
+
if (nodePath) {
|
|
14685
|
+
try {
|
|
14686
|
+
htmlNodeImgEntry = Editor.above(editor, {
|
|
14687
|
+
at: nodePath,
|
|
14688
|
+
match: (node) => NodeUtils.isHTMLNodeElement(node) && node.data.tagName === "img"
|
|
14689
|
+
});
|
|
14690
|
+
} catch (error2) {
|
|
14691
|
+
}
|
|
14692
|
+
}
|
|
14507
14693
|
const mergetagNode = mergetagNodeEntry == null ? void 0 : mergetagNodeEntry[0];
|
|
14508
14694
|
const isMergeTagSelected = Boolean(mergetagNode);
|
|
14509
14695
|
if (nodePath) {
|
|
14510
|
-
|
|
14511
|
-
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14696
|
+
try {
|
|
14697
|
+
selectedContentBlockNodeEntry = Editor.above(editor, {
|
|
14698
|
+
at: nodePath,
|
|
14699
|
+
match: NodeUtils.isTextElement
|
|
14700
|
+
});
|
|
14701
|
+
if (!selectedContentBlockNodeEntry) {
|
|
14702
|
+
const entry = Editor.node(editor, nodePath);
|
|
14703
|
+
if (NodeUtils.isTextElement(entry[0])) {
|
|
14704
|
+
selectedContentBlockNodeEntry = entry;
|
|
14705
|
+
}
|
|
14518
14706
|
}
|
|
14707
|
+
} catch (error2) {
|
|
14519
14708
|
}
|
|
14520
14709
|
}
|
|
14521
14710
|
let contentWindow = null;
|
|
@@ -14525,9 +14714,13 @@ const HoveringToolbar = () => {
|
|
|
14525
14714
|
}
|
|
14526
14715
|
const selectedContentBlockNode = selectedContentBlockNodeEntry == null ? void 0 : selectedContentBlockNodeEntry[0];
|
|
14527
14716
|
const isNotSelect = !selection;
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14717
|
+
let isCollapsed = true;
|
|
14718
|
+
if (selection) {
|
|
14719
|
+
try {
|
|
14720
|
+
isCollapsed = Range.isCollapsed(selection) || Editor.string(editor, selection) === "";
|
|
14721
|
+
} catch (error2) {
|
|
14722
|
+
}
|
|
14723
|
+
}
|
|
14531
14724
|
useEffect(() => {
|
|
14532
14725
|
if (!contentWindow)
|
|
14533
14726
|
return;
|
|
@@ -14549,7 +14742,7 @@ const HoveringToolbar = () => {
|
|
|
14549
14742
|
};
|
|
14550
14743
|
}, [contentWindow, editor]);
|
|
14551
14744
|
const setHoveringBarStyle = useEventCallback(() => {
|
|
14552
|
-
var _a
|
|
14745
|
+
var _a;
|
|
14553
14746
|
if (!selectedNode)
|
|
14554
14747
|
return;
|
|
14555
14748
|
if (hoveringToolbar == null ? void 0 : hoveringToolbar.fixed)
|
|
@@ -14588,9 +14781,12 @@ const HoveringToolbar = () => {
|
|
|
14588
14781
|
pageYOffset
|
|
14589
14782
|
} = layout;
|
|
14590
14783
|
el2.style.opacity = list.length === 0 ? "0" : "1";
|
|
14784
|
+
const sectionPath = [0, 0];
|
|
14785
|
+
if (!Node.has(editor, sectionPath))
|
|
14786
|
+
return;
|
|
14591
14787
|
const sectionDomNode = ReactEditor.toDOMNode(
|
|
14592
14788
|
editor,
|
|
14593
|
-
Node.get(editor,
|
|
14789
|
+
Node.get(editor, sectionPath)
|
|
14594
14790
|
);
|
|
14595
14791
|
const overlayRectWidth = overlayRect.width || relativedElementReact.width;
|
|
14596
14792
|
const sectionDomNodeRect = sectionDomNode.getBoundingClientRect();
|
|
@@ -14621,8 +14817,8 @@ const HoveringToolbar = () => {
|
|
|
14621
14817
|
return;
|
|
14622
14818
|
const domRange = domSelection.getRangeAt(0);
|
|
14623
14819
|
let rect = domRange.getBoundingClientRect();
|
|
14624
|
-
if (rect.top === 0 && rect.left === 0 && ((_a = editor.selection) == null ? void 0 : _a.anchor.path)) {
|
|
14625
|
-
const textNode = Node.get(editor,
|
|
14820
|
+
if (rect.top === 0 && rect.left === 0 && ((_a = editor.selection) == null ? void 0 : _a.anchor.path) && Node.has(editor, editor.selection.anchor.path)) {
|
|
14821
|
+
const textNode = Node.get(editor, editor.selection.anchor.path);
|
|
14626
14822
|
const rangeNode = ReactEditor.toDOMNode(editor, textNode);
|
|
14627
14823
|
const rang = document.createRange();
|
|
14628
14824
|
rang.selectNode(rangeNode);
|
|
@@ -14742,23 +14938,46 @@ const HoveringToolbar = () => {
|
|
|
14742
14938
|
if (hoveringToolbar == null ? void 0 : hoveringToolbar.fixed) {
|
|
14743
14939
|
return /* @__PURE__ */ React__default.createElement("div", null, content);
|
|
14744
14940
|
}
|
|
14941
|
+
const editorContainer = document.getElementById(EDITOR_CONTAINER);
|
|
14745
14942
|
return createPortal(
|
|
14746
|
-
/* @__PURE__ */ React__default.createElement(
|
|
14943
|
+
/* @__PURE__ */ React__default.createElement(
|
|
14747
14944
|
"div",
|
|
14748
14945
|
{
|
|
14749
|
-
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14946
|
+
style: {
|
|
14947
|
+
position: "fixed",
|
|
14948
|
+
top: 0,
|
|
14949
|
+
left: 0,
|
|
14950
|
+
zIndex: 9999
|
|
14951
|
+
},
|
|
14952
|
+
onPointerDownCapture: (e) => {
|
|
14953
|
+
e.preventDefault();
|
|
14954
|
+
e.stopPropagation();
|
|
14955
|
+
}
|
|
14754
14956
|
},
|
|
14755
|
-
|
|
14756
|
-
|
|
14957
|
+
/* @__PURE__ */ React__default.createElement(
|
|
14958
|
+
"div",
|
|
14959
|
+
{
|
|
14960
|
+
key: String(isNotSelect),
|
|
14961
|
+
id: "HoveringToolbar",
|
|
14962
|
+
ref,
|
|
14963
|
+
"data-follow": (hoveringToolbar == null ? void 0 : hoveringToolbar.follow) || "selection",
|
|
14964
|
+
className: "HoveringToolbar"
|
|
14965
|
+
},
|
|
14966
|
+
/* @__PURE__ */ React__default.createElement(
|
|
14967
|
+
"div",
|
|
14968
|
+
{
|
|
14969
|
+
className: "HoveringToolbar-list",
|
|
14970
|
+
style: { visibility: lock ? "hidden" : "visible" }
|
|
14971
|
+
},
|
|
14972
|
+
content
|
|
14973
|
+
),
|
|
14974
|
+
/* @__PURE__ */ React__default.createElement("style", null, `#HoveringToolbar {
|
|
14757
14975
|
--hovering-bar-icon-size: ${(hoveringToolbar == null ? void 0 : hoveringToolbar.iconSize) || 12}px;
|
|
14758
14976
|
|
|
14759
14977
|
}`)
|
|
14760
|
-
|
|
14761
|
-
|
|
14978
|
+
)
|
|
14979
|
+
),
|
|
14980
|
+
editorContainer || document.body
|
|
14762
14981
|
);
|
|
14763
14982
|
};
|
|
14764
14983
|
function ColorPickerContent(props) {
|
|
@@ -14852,21 +15071,40 @@ function ColorPickerContent(props) {
|
|
|
14852
15071
|
}
|
|
14853
15072
|
const BgColor = () => {
|
|
14854
15073
|
const editor = useSlate();
|
|
14855
|
-
|
|
14856
|
-
|
|
14857
|
-
|
|
14858
|
-
|
|
14859
|
-
|
|
14860
|
-
|
|
14861
|
-
|
|
15074
|
+
const { getPopupContainer } = useContext(RichTextBarContext);
|
|
15075
|
+
let nodeEntry = null;
|
|
15076
|
+
try {
|
|
15077
|
+
if (editor.selection && Node.has(editor, editor.selection.anchor.path)) {
|
|
15078
|
+
const nodes = Editor.nodes(editor, {
|
|
15079
|
+
match: (node) => {
|
|
15080
|
+
return Text$2.isText(node);
|
|
15081
|
+
},
|
|
15082
|
+
mode: "lowest",
|
|
15083
|
+
voids: true
|
|
15084
|
+
});
|
|
15085
|
+
const first = nodes.next().value;
|
|
15086
|
+
if (first) {
|
|
15087
|
+
nodeEntry = first;
|
|
15088
|
+
}
|
|
15089
|
+
}
|
|
15090
|
+
} catch (error2) {
|
|
15091
|
+
}
|
|
14862
15092
|
if (!nodeEntry) {
|
|
14863
|
-
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
|
|
14868
|
-
|
|
14869
|
-
|
|
15093
|
+
try {
|
|
15094
|
+
if (editor.selection && Node.has(editor, editor.selection.anchor.path)) {
|
|
15095
|
+
const nodes = Editor.nodes(editor, {
|
|
15096
|
+
match: (node) => {
|
|
15097
|
+
return NodeUtils.isMergetagElement(node);
|
|
15098
|
+
},
|
|
15099
|
+
mode: "lowest"
|
|
15100
|
+
});
|
|
15101
|
+
const first = nodes.next().value;
|
|
15102
|
+
if (first) {
|
|
15103
|
+
nodeEntry = first;
|
|
15104
|
+
}
|
|
15105
|
+
}
|
|
15106
|
+
} catch (error2) {
|
|
15107
|
+
}
|
|
14870
15108
|
}
|
|
14871
15109
|
const { setFieldValue } = useEditorContext();
|
|
14872
15110
|
const activeTab = useActiveTab();
|
|
@@ -14933,6 +15171,9 @@ const BgColor = () => {
|
|
|
14933
15171
|
popupStyle: { padding: "10px" }
|
|
14934
15172
|
},
|
|
14935
15173
|
getPopupContainer: (node) => {
|
|
15174
|
+
if (getPopupContainer) {
|
|
15175
|
+
return getPopupContainer(node);
|
|
15176
|
+
}
|
|
14936
15177
|
return Array.from(document.querySelectorAll(".RichTextBar")).find(
|
|
14937
15178
|
(item2) => item2.contains(node)
|
|
14938
15179
|
);
|
|
@@ -14972,25 +15213,38 @@ const BgColor = () => {
|
|
|
14972
15213
|
"A"
|
|
14973
15214
|
)))
|
|
14974
15215
|
);
|
|
14975
|
-
}, [color2, onChange, onClose, textNode == null ? void 0 : textNode.color]);
|
|
15216
|
+
}, [color2, getPopupContainer, onChange, onClose, textNode == null ? void 0 : textNode.color]);
|
|
14976
15217
|
};
|
|
14977
15218
|
const FontColor = () => {
|
|
15219
|
+
const { getPopupContainer } = useContext(RichTextBarContext);
|
|
14978
15220
|
const editor = useSlate();
|
|
14979
|
-
let
|
|
14980
|
-
|
|
14981
|
-
|
|
14982
|
-
|
|
14983
|
-
|
|
14984
|
-
|
|
14985
|
-
|
|
15221
|
+
let nodeEntry = null;
|
|
15222
|
+
try {
|
|
15223
|
+
if (editor.selection && Node.has(editor, editor.selection.anchor.path)) {
|
|
15224
|
+
const [entry] = Editor.nodes(editor, {
|
|
15225
|
+
match: (node) => {
|
|
15226
|
+
return Text$2.isText(node);
|
|
15227
|
+
},
|
|
15228
|
+
mode: "lowest",
|
|
15229
|
+
voids: true
|
|
15230
|
+
});
|
|
15231
|
+
nodeEntry = entry;
|
|
15232
|
+
}
|
|
15233
|
+
} catch (error2) {
|
|
15234
|
+
}
|
|
14986
15235
|
if (!nodeEntry) {
|
|
14987
|
-
|
|
14988
|
-
|
|
14989
|
-
|
|
14990
|
-
|
|
14991
|
-
|
|
14992
|
-
|
|
14993
|
-
|
|
15236
|
+
try {
|
|
15237
|
+
if (editor.selection && Node.has(editor, editor.selection.anchor.path)) {
|
|
15238
|
+
const [mergetagNodeEntry] = Editor.nodes(editor, {
|
|
15239
|
+
match: (node) => {
|
|
15240
|
+
return NodeUtils.isMergetagElement(node);
|
|
15241
|
+
},
|
|
15242
|
+
mode: "lowest"
|
|
15243
|
+
});
|
|
15244
|
+
nodeEntry = mergetagNodeEntry;
|
|
15245
|
+
}
|
|
15246
|
+
} catch (error2) {
|
|
15247
|
+
}
|
|
14994
15248
|
}
|
|
14995
15249
|
const { setFieldValue } = useEditorContext();
|
|
14996
15250
|
const activeTab = useActiveTab();
|
|
@@ -15052,6 +15306,9 @@ const FontColor = () => {
|
|
|
15052
15306
|
popupStyle: { padding: "10px" }
|
|
15053
15307
|
},
|
|
15054
15308
|
getPopupContainer: (node) => {
|
|
15309
|
+
if (getPopupContainer) {
|
|
15310
|
+
return getPopupContainer(node);
|
|
15311
|
+
}
|
|
15055
15312
|
return Array.from(document.querySelectorAll(".RichTextBar")).find(
|
|
15056
15313
|
(item2) => item2.contains(node)
|
|
15057
15314
|
);
|
|
@@ -15105,7 +15362,44 @@ const FormatButton = (_a) => {
|
|
|
15105
15362
|
]);
|
|
15106
15363
|
const { setFieldValue, getFieldValue } = useEditorContext();
|
|
15107
15364
|
const editor = useSlate();
|
|
15108
|
-
const
|
|
15365
|
+
const contentNodeEntry = useMemo(() => {
|
|
15366
|
+
var _a2, _b2;
|
|
15367
|
+
return editor.selection ? editor.findSelfOrAncestorNodeByCategory({
|
|
15368
|
+
category: ElementCategory.TEXT,
|
|
15369
|
+
path: (_a2 = editor.selection) == null ? void 0 : _a2.anchor.path
|
|
15370
|
+
}) || editor.findSelfOrAncestorNodeByType({
|
|
15371
|
+
type: ElementType.STANDARD_TABLE2,
|
|
15372
|
+
path: (_b2 = editor.selection) == null ? void 0 : _b2.anchor.path
|
|
15373
|
+
}) : null;
|
|
15374
|
+
}, [editor, editor.selection]);
|
|
15375
|
+
const active = useMemo(() => {
|
|
15376
|
+
if (rest.active)
|
|
15377
|
+
return true;
|
|
15378
|
+
if (!format)
|
|
15379
|
+
return false;
|
|
15380
|
+
if (isFormatActive(editor, format))
|
|
15381
|
+
return true;
|
|
15382
|
+
if (contentNodeEntry) {
|
|
15383
|
+
const node = contentNodeEntry[0];
|
|
15384
|
+
if (format === TextFormat.BOLD) {
|
|
15385
|
+
const val = get(node, "attributes.font-weight");
|
|
15386
|
+
return val === "bold" || parseInt(val) > 500;
|
|
15387
|
+
}
|
|
15388
|
+
if (format === TextFormat.ITALIC) {
|
|
15389
|
+
const val = get(node, "attributes.font-style");
|
|
15390
|
+
return val === "italic";
|
|
15391
|
+
}
|
|
15392
|
+
if (format === TextFormat.UNDERLINE) {
|
|
15393
|
+
const val = get(node, "attributes.text-decoration");
|
|
15394
|
+
return val === "underline" || typeof val === "string" && val.includes("underline");
|
|
15395
|
+
}
|
|
15396
|
+
if (format === TextFormat.STRIKETHROUGH) {
|
|
15397
|
+
const val = get(node, "attributes.text-decoration");
|
|
15398
|
+
return val === "line-through" || typeof val === "string" && val.includes("line-through");
|
|
15399
|
+
}
|
|
15400
|
+
}
|
|
15401
|
+
return false;
|
|
15402
|
+
}, [rest.active, format, editor, contentNodeEntry]);
|
|
15109
15403
|
const onClick = () => {
|
|
15110
15404
|
var _a2, _b2, _c;
|
|
15111
15405
|
if (onClickHandle) {
|
|
@@ -15118,16 +15412,16 @@ const FormatButton = (_a) => {
|
|
|
15118
15412
|
type: ElementType.MERGETAG,
|
|
15119
15413
|
path: (_a2 = editor.selection) == null ? void 0 : _a2.anchor.path
|
|
15120
15414
|
}) : null;
|
|
15121
|
-
const
|
|
15415
|
+
const contentNodeEntry2 = editor.selection ? editor.findSelfOrAncestorNodeByCategory({
|
|
15122
15416
|
category: ElementCategory.TEXT,
|
|
15123
15417
|
path: (_b2 = editor.selection) == null ? void 0 : _b2.anchor.path
|
|
15124
15418
|
}) || editor.findSelfOrAncestorNodeByType({
|
|
15125
15419
|
type: ElementType.STANDARD_TABLE2,
|
|
15126
15420
|
path: (_c = editor.selection) == null ? void 0 : _c.anchor.path
|
|
15127
15421
|
}) : null;
|
|
15128
|
-
if (!
|
|
15422
|
+
if (!contentNodeEntry2)
|
|
15129
15423
|
return;
|
|
15130
|
-
const contentNodePath =
|
|
15424
|
+
const contentNodePath = contentNodeEntry2[1];
|
|
15131
15425
|
const selection = editor.selection;
|
|
15132
15426
|
const isCollapsed = Boolean(
|
|
15133
15427
|
selection && (Range.isCollapsed(selection) || Editor.string(editor, selection) === "") && !mergeNodeEntry
|
|
@@ -15201,14 +15495,18 @@ const FormatButton = (_a) => {
|
|
|
15201
15495
|
));
|
|
15202
15496
|
};
|
|
15203
15497
|
const getLinkNode = (editor) => {
|
|
15204
|
-
|
|
15205
|
-
match
|
|
15206
|
-
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
|
|
15211
|
-
|
|
15498
|
+
try {
|
|
15499
|
+
const [match] = Editor.nodes(editor, {
|
|
15500
|
+
match: (n) => {
|
|
15501
|
+
return Text$2.isText(n) && Boolean(n[TextFormat.LINK]);
|
|
15502
|
+
},
|
|
15503
|
+
mode: "lowest",
|
|
15504
|
+
voids: true
|
|
15505
|
+
});
|
|
15506
|
+
return match;
|
|
15507
|
+
} catch (error2) {
|
|
15508
|
+
return void 0;
|
|
15509
|
+
}
|
|
15212
15510
|
};
|
|
15213
15511
|
class Uploader {
|
|
15214
15512
|
constructor(uploadServer, options2) {
|
|
@@ -15664,7 +15962,6 @@ function isValidHttpUrl(str) {
|
|
|
15664
15962
|
const TextLink = () => {
|
|
15665
15963
|
const editor = useSlate();
|
|
15666
15964
|
const linkNodeEntry = getLinkNode(editor);
|
|
15667
|
-
console.log(linkNodeEntry);
|
|
15668
15965
|
const ref = useRef(null);
|
|
15669
15966
|
const linkNode = linkNodeEntry == null ? void 0 : linkNodeEntry[0];
|
|
15670
15967
|
const selectedNodePath = useSelectedNodePath();
|
|
@@ -15960,9 +16257,15 @@ const options$9 = [
|
|
|
15960
16257
|
];
|
|
15961
16258
|
const TurnInto = () => {
|
|
15962
16259
|
const editor = useSlate();
|
|
15963
|
-
|
|
15964
|
-
|
|
15965
|
-
|
|
16260
|
+
let nodeEntry = null;
|
|
16261
|
+
try {
|
|
16262
|
+
if (editor.selection && Node.has(editor, editor.selection.anchor.path)) {
|
|
16263
|
+
nodeEntry = Editor.above(editor, {
|
|
16264
|
+
match: NodeUtils.isBlockElement
|
|
16265
|
+
});
|
|
16266
|
+
}
|
|
16267
|
+
} catch (error2) {
|
|
16268
|
+
}
|
|
15966
16269
|
const node = nodeEntry == null ? void 0 : nodeEntry[0];
|
|
15967
16270
|
const onChange = (value) => {
|
|
15968
16271
|
var _a;
|
|
@@ -16062,26 +16365,46 @@ function styleStringToObject(styleString) {
|
|
|
16062
16365
|
const TextAlign$1 = () => {
|
|
16063
16366
|
var _a, _b;
|
|
16064
16367
|
const editor = useSlate();
|
|
16065
|
-
|
|
16066
|
-
|
|
16067
|
-
|
|
16068
|
-
|
|
16069
|
-
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
|
|
16073
|
-
|
|
16074
|
-
|
|
16368
|
+
let match = null;
|
|
16369
|
+
try {
|
|
16370
|
+
if (editor.selection && Node.has(editor, editor.selection.anchor.path)) {
|
|
16371
|
+
const nodes = Editor.nodes(editor, {
|
|
16372
|
+
match: (n) => NodeUtils.isContentElement(n),
|
|
16373
|
+
mode: "all"
|
|
16374
|
+
});
|
|
16375
|
+
const first = nodes.next().value;
|
|
16376
|
+
if (first) {
|
|
16377
|
+
match = first;
|
|
16378
|
+
}
|
|
16379
|
+
}
|
|
16380
|
+
} catch (error2) {
|
|
16381
|
+
}
|
|
16382
|
+
let matchHtmlBlockNode = null;
|
|
16383
|
+
try {
|
|
16384
|
+
if (editor.selection && Node.has(editor, editor.selection.anchor.path)) {
|
|
16385
|
+
const nodes = Editor.nodes(editor, {
|
|
16386
|
+
match: (node2) => {
|
|
16387
|
+
return NodeUtils.isHTMLBlockNodeElement(node2);
|
|
16388
|
+
},
|
|
16389
|
+
mode: "lowest"
|
|
16390
|
+
});
|
|
16391
|
+
const first = nodes.next().value;
|
|
16392
|
+
if (first) {
|
|
16393
|
+
matchHtmlBlockNode = first;
|
|
16394
|
+
}
|
|
16395
|
+
}
|
|
16396
|
+
} catch (error2) {
|
|
16397
|
+
}
|
|
16075
16398
|
const { enabledHtmlBlockNodeAlign } = useEditorProps();
|
|
16076
|
-
const node = match == null ? void 0 : match[0];
|
|
16077
16399
|
const { setFieldValue } = useEditorContext();
|
|
16400
|
+
const node = match == null ? void 0 : match[0];
|
|
16078
16401
|
let styleObject;
|
|
16079
16402
|
if (matchHtmlBlockNode == null ? void 0 : matchHtmlBlockNode[0]) {
|
|
16080
16403
|
styleObject = styleStringToObject(
|
|
16081
16404
|
((_b = (_a = matchHtmlBlockNode == null ? void 0 : matchHtmlBlockNode[0]) == null ? void 0 : _a.attributes) == null ? void 0 : _b.style) || ""
|
|
16082
16405
|
);
|
|
16083
16406
|
}
|
|
16084
|
-
const matchAlign = get(styleObject, "text-align") || get(node.attributes, "align");
|
|
16407
|
+
const matchAlign = get(styleObject, "text-align") || ((node == null ? void 0 : node.attributes) ? get(node.attributes, "align") : void 0);
|
|
16085
16408
|
const onAlignHandle = (align) => {
|
|
16086
16409
|
var _a2;
|
|
16087
16410
|
if (!match)
|
|
@@ -16184,22 +16507,41 @@ const FontSize$2 = () => {
|
|
|
16184
16507
|
const { fontSizeList } = useEditorProps();
|
|
16185
16508
|
const [fontSizeValue, setFontSizeValue] = useState();
|
|
16186
16509
|
const { setFieldValue } = useEditorContext();
|
|
16187
|
-
const
|
|
16188
|
-
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
},
|
|
16192
|
-
mode: "lowest",
|
|
16193
|
-
voids: true
|
|
16510
|
+
const { selectedNode } = useSelectedNode();
|
|
16511
|
+
const elementDefault = useElementDefault({
|
|
16512
|
+
path: null,
|
|
16513
|
+
type: (selectedNode == null ? void 0 : selectedNode.type) || null
|
|
16194
16514
|
});
|
|
16515
|
+
const editor = useSlate();
|
|
16516
|
+
let nodeEntry = null;
|
|
16517
|
+
try {
|
|
16518
|
+
const selection = editor.selection;
|
|
16519
|
+
if (selection && Range.isCollapsed(selection) && Node.has(editor, selection.anchor.path)) {
|
|
16520
|
+
const entries = Editor.nodes(editor, {
|
|
16521
|
+
match: (node) => Text$2.isText(node),
|
|
16522
|
+
mode: "lowest",
|
|
16523
|
+
voids: true
|
|
16524
|
+
});
|
|
16525
|
+
const first = entries.next().value;
|
|
16526
|
+
if (first)
|
|
16527
|
+
nodeEntry = first;
|
|
16528
|
+
}
|
|
16529
|
+
} catch (error2) {
|
|
16530
|
+
}
|
|
16195
16531
|
if (!nodeEntry) {
|
|
16196
|
-
|
|
16197
|
-
|
|
16198
|
-
|
|
16199
|
-
|
|
16200
|
-
|
|
16201
|
-
|
|
16202
|
-
|
|
16532
|
+
try {
|
|
16533
|
+
const selection = editor.selection;
|
|
16534
|
+
if (selection && Range.isCollapsed(selection) && Node.has(editor, selection.anchor.path)) {
|
|
16535
|
+
const entries = Editor.nodes(editor, {
|
|
16536
|
+
match: (node) => NodeUtils.isMergetagElement(node),
|
|
16537
|
+
mode: "lowest"
|
|
16538
|
+
});
|
|
16539
|
+
const first = entries.next().value;
|
|
16540
|
+
if (first)
|
|
16541
|
+
nodeEntry = first;
|
|
16542
|
+
}
|
|
16543
|
+
} catch (error2) {
|
|
16544
|
+
}
|
|
16203
16545
|
}
|
|
16204
16546
|
const textNode = nodeEntry == null ? void 0 : nodeEntry[0];
|
|
16205
16547
|
useEffect(() => {
|
|
@@ -16211,6 +16553,9 @@ const FontSize$2 = () => {
|
|
|
16211
16553
|
} catch (error2) {
|
|
16212
16554
|
}
|
|
16213
16555
|
}
|
|
16556
|
+
if (!fontSizeValue2) {
|
|
16557
|
+
fontSizeValue2 = get(elementDefault.attributes, "font-size");
|
|
16558
|
+
}
|
|
16214
16559
|
setFontSizeValue(fontSizeValue2);
|
|
16215
16560
|
}, [editor, textNode, textNode == null ? void 0 : textNode.fontSize]);
|
|
16216
16561
|
const optionsList = useMemo(() => {
|
|
@@ -16284,13 +16629,27 @@ const FontFamily$2 = () => {
|
|
|
16284
16629
|
const editor = useSlate();
|
|
16285
16630
|
const { setFieldValue } = useEditorContext();
|
|
16286
16631
|
const [fontFamilyValue, setFontFamilyValue] = useState();
|
|
16287
|
-
const
|
|
16288
|
-
|
|
16289
|
-
|
|
16290
|
-
|
|
16291
|
-
voids: true,
|
|
16292
|
-
mode: "lowest"
|
|
16632
|
+
const { selectedNode } = useSelectedNode();
|
|
16633
|
+
const elementDefault = useElementDefault({
|
|
16634
|
+
path: null,
|
|
16635
|
+
type: (selectedNode == null ? void 0 : selectedNode.type) || null
|
|
16293
16636
|
});
|
|
16637
|
+
let nodeEntry = null;
|
|
16638
|
+
try {
|
|
16639
|
+
const selection = editor.selection;
|
|
16640
|
+
if (selection && Range.isCollapsed(selection) && Node.has(editor, selection.anchor.path)) {
|
|
16641
|
+
const entries = Editor.nodes(editor, {
|
|
16642
|
+
match: (node) => Text$2.isText(node),
|
|
16643
|
+
voids: true,
|
|
16644
|
+
mode: "lowest"
|
|
16645
|
+
});
|
|
16646
|
+
const first = entries.next().value;
|
|
16647
|
+
if (first)
|
|
16648
|
+
nodeEntry = first;
|
|
16649
|
+
}
|
|
16650
|
+
} catch (error2) {
|
|
16651
|
+
console.warn("FontFamily: failed to get nodes safely", error2);
|
|
16652
|
+
}
|
|
16294
16653
|
const textNode = nodeEntry == null ? void 0 : nodeEntry[0];
|
|
16295
16654
|
useEffect(() => {
|
|
16296
16655
|
var _a;
|
|
@@ -16302,8 +16661,11 @@ const FontFamily$2 = () => {
|
|
|
16302
16661
|
} catch (error2) {
|
|
16303
16662
|
}
|
|
16304
16663
|
}
|
|
16664
|
+
if (!fontFamilyValue2) {
|
|
16665
|
+
fontFamilyValue2 = get(elementDefault.attributes, "font-family");
|
|
16666
|
+
}
|
|
16305
16667
|
setFontFamilyValue(fontFamilyValue2);
|
|
16306
|
-
}, [editor, textNode, textNode == null ? void 0 : textNode.fontFamily]);
|
|
16668
|
+
}, [editor, textNode, textNode == null ? void 0 : textNode.fontFamily, elementDefault.attributes]);
|
|
16307
16669
|
const optionsList = useMemo(() => {
|
|
16308
16670
|
const list = [...fontList];
|
|
16309
16671
|
if (fontFamilyValue) {
|
|
@@ -16376,20 +16738,28 @@ const List = () => {
|
|
|
16376
16738
|
const onToggleList = (format) => {
|
|
16377
16739
|
if (!editor.selection)
|
|
16378
16740
|
return;
|
|
16379
|
-
|
|
16380
|
-
|
|
16381
|
-
|
|
16382
|
-
|
|
16383
|
-
|
|
16384
|
-
|
|
16741
|
+
let elementEntry = null;
|
|
16742
|
+
try {
|
|
16743
|
+
elementEntry = Editor.above(editor, {
|
|
16744
|
+
match(node, path2) {
|
|
16745
|
+
return NodeUtils.isBlockElement(node);
|
|
16746
|
+
},
|
|
16747
|
+
mode: "lowest"
|
|
16748
|
+
});
|
|
16749
|
+
} catch (error2) {
|
|
16750
|
+
}
|
|
16385
16751
|
if (!elementEntry)
|
|
16386
16752
|
return;
|
|
16387
|
-
|
|
16388
|
-
|
|
16389
|
-
|
|
16390
|
-
|
|
16391
|
-
|
|
16392
|
-
|
|
16753
|
+
let htmlBlockNodeElementEntry = null;
|
|
16754
|
+
try {
|
|
16755
|
+
htmlBlockNodeElementEntry = Editor.above(editor, {
|
|
16756
|
+
match(node, path2) {
|
|
16757
|
+
return NodeUtils.isHTMLBlockNodeElement(node);
|
|
16758
|
+
},
|
|
16759
|
+
mode: "lowest"
|
|
16760
|
+
});
|
|
16761
|
+
} catch (error2) {
|
|
16762
|
+
}
|
|
16393
16763
|
if (!htmlBlockNodeElementEntry) {
|
|
16394
16764
|
Transforms.wrapNodes(
|
|
16395
16765
|
editor,
|
|
@@ -16407,12 +16777,16 @@ const List = () => {
|
|
|
16407
16777
|
}
|
|
16408
16778
|
);
|
|
16409
16779
|
}
|
|
16410
|
-
|
|
16411
|
-
|
|
16412
|
-
|
|
16413
|
-
|
|
16414
|
-
|
|
16415
|
-
|
|
16780
|
+
let match = null;
|
|
16781
|
+
try {
|
|
16782
|
+
[match] = Array.from(
|
|
16783
|
+
Editor.nodes(editor, {
|
|
16784
|
+
at: Editor.unhangRange(editor, editor.selection),
|
|
16785
|
+
match: (n) => !Editor.isEditor(n) && NodeUtils.isHTMLBlockNodeElement(n) && n.data.tagName === format
|
|
16786
|
+
})
|
|
16787
|
+
);
|
|
16788
|
+
} catch (error2) {
|
|
16789
|
+
}
|
|
16416
16790
|
const isActive = !!match;
|
|
16417
16791
|
Transforms.unwrapNodes(editor, {
|
|
16418
16792
|
match: (n) => NodeUtils.isHTMLBlockNodeElement(n) && LIST_TYPES.includes(n.data.tagName),
|
|
@@ -16454,9 +16828,12 @@ const Image$5 = () => {
|
|
|
16454
16828
|
const editor = useSlate();
|
|
16455
16829
|
const ref = useRef(null);
|
|
16456
16830
|
const { onUpload } = useEditorProps();
|
|
16831
|
+
const { lock } = useEditorState();
|
|
16457
16832
|
const [from] = Form.useForm();
|
|
16458
16833
|
const onSubmit = (values) => {
|
|
16459
16834
|
var _a;
|
|
16835
|
+
if (lock)
|
|
16836
|
+
return;
|
|
16460
16837
|
let style = `max-width:100%;display:inline-block;`;
|
|
16461
16838
|
if (values.width) {
|
|
16462
16839
|
style += `width:${values.width};`;
|
|
@@ -16494,7 +16871,7 @@ const Image$5 = () => {
|
|
|
16494
16871
|
popupStyle: { padding: "0px" }
|
|
16495
16872
|
},
|
|
16496
16873
|
getPopupContainer: (node) => {
|
|
16497
|
-
return Array.from(document.querySelectorAll("
|
|
16874
|
+
return Array.from(document.querySelectorAll("#HoveringToolbar")).find(
|
|
16498
16875
|
(item2) => item2.contains(node)
|
|
16499
16876
|
);
|
|
16500
16877
|
},
|
|
@@ -16505,13 +16882,38 @@ const Image$5 = () => {
|
|
|
16505
16882
|
bodyStyle: { padding: "0px" },
|
|
16506
16883
|
title: /* @__PURE__ */ React__default.createElement("div", { style: { textAlign: "left" } }, t(`Insert image`))
|
|
16507
16884
|
},
|
|
16508
|
-
|
|
16885
|
+
lock && /* @__PURE__ */ React__default.createElement(
|
|
16886
|
+
Alert,
|
|
16887
|
+
{
|
|
16888
|
+
type: "warning",
|
|
16889
|
+
content: t(
|
|
16890
|
+
`This component is locked by the image drawer. Please complete your actions there first.`
|
|
16891
|
+
)
|
|
16892
|
+
}
|
|
16893
|
+
),
|
|
16894
|
+
/* @__PURE__ */ React__default.createElement("div", { style: { position: "relative" } }, lock && /* @__PURE__ */ React__default.createElement(
|
|
16895
|
+
"div",
|
|
16896
|
+
{
|
|
16897
|
+
style: {
|
|
16898
|
+
position: "absolute",
|
|
16899
|
+
top: 0,
|
|
16900
|
+
left: 0,
|
|
16901
|
+
right: 0,
|
|
16902
|
+
bottom: 0,
|
|
16903
|
+
backgroundColor: "rgba(255, 255, 255, 0.3)",
|
|
16904
|
+
zIndex: 10,
|
|
16905
|
+
cursor: "not-allowed"
|
|
16906
|
+
}
|
|
16907
|
+
}
|
|
16908
|
+
), /* @__PURE__ */ React__default.createElement(Form, { onSubmit, form: from }, /* @__PURE__ */ React__default.createElement("div", { style: { padding: "16px" } }, /* @__PURE__ */ React__default.createElement(
|
|
16509
16909
|
AttributeField.ImageUploaderField,
|
|
16510
16910
|
{
|
|
16511
16911
|
path: null,
|
|
16512
16912
|
name: "src",
|
|
16513
16913
|
label: null,
|
|
16914
|
+
enablePreview: false,
|
|
16514
16915
|
uploadHandler: onUpload,
|
|
16916
|
+
pinToParent: true,
|
|
16515
16917
|
formItem: {
|
|
16516
16918
|
wrapperCol: {
|
|
16517
16919
|
span: 24
|
|
@@ -16555,32 +16957,51 @@ const Image$5 = () => {
|
|
|
16555
16957
|
}
|
|
16556
16958
|
}
|
|
16557
16959
|
}
|
|
16558
|
-
)))), /* @__PURE__ */ React__default.createElement(Divider$2, { style: { margin: "0px" } }), /* @__PURE__ */ React__default.createElement(Grid.Row, { justify: "end", style: { padding: "16px" } }, /* @__PURE__ */ React__default.createElement(Space, null, /* @__PURE__ */ React__default.createElement(Button$2, { type: "primary", htmlType: "submit" }, t(`Apply`)), /* @__PURE__ */ React__default.createElement(Button$2, { onClick: () => {
|
|
16960
|
+
)))), /* @__PURE__ */ React__default.createElement(Divider$2, { style: { margin: "0px" } }), /* @__PURE__ */ React__default.createElement(Grid.Row, { justify: "end", style: { padding: "16px" } }, /* @__PURE__ */ React__default.createElement(Space, null, /* @__PURE__ */ React__default.createElement(Button$2, { type: "primary", htmlType: "submit", disabled: lock }, t(`Apply`)), /* @__PURE__ */ React__default.createElement(Button$2, { onClick: () => {
|
|
16559
16961
|
var _a;
|
|
16560
16962
|
return (_a = ref.current) == null ? void 0 : _a.click();
|
|
16561
|
-
} }, t(`Cancel`)))))
|
|
16963
|
+
} }, t(`Cancel`))))))
|
|
16562
16964
|
)
|
|
16563
16965
|
},
|
|
16564
16966
|
/* @__PURE__ */ React__default.createElement("span", { ref, className: classnames$1("formatButton") }, /* @__PURE__ */ React__default.createElement("span", { className: classnames$1(" iconfont icon-img") }))
|
|
16565
16967
|
);
|
|
16566
16968
|
};
|
|
16969
|
+
const RichTextBarContext = React__default.createContext({});
|
|
16567
16970
|
const RichTextBar = ({
|
|
16568
|
-
list
|
|
16971
|
+
list,
|
|
16972
|
+
wrap: wrap2,
|
|
16973
|
+
getPopupContainer
|
|
16569
16974
|
}) => {
|
|
16975
|
+
const contextValue = useMemo(
|
|
16976
|
+
() => ({ getPopupContainer }),
|
|
16977
|
+
[getPopupContainer]
|
|
16978
|
+
);
|
|
16570
16979
|
const { MergetagPopover: MergetagPopover2, mergetags, AIAssistant: AIAssistant2 } = useEditorProps();
|
|
16571
16980
|
const { selectedNode } = useSelectedNode();
|
|
16572
16981
|
const editor = useSlate();
|
|
16573
16982
|
const { selection } = editor;
|
|
16574
|
-
const nodePath = selectedNode && (selection == null ? void 0 : selection.anchor.path) ? selection.anchor.path : null;
|
|
16575
|
-
|
|
16576
|
-
|
|
16577
|
-
|
|
16578
|
-
|
|
16983
|
+
const nodePath = selectedNode && (selection == null ? void 0 : selection.anchor.path) && Node.has(editor, selection.anchor.path) ? selection.anchor.path : null;
|
|
16984
|
+
let mergetagNodeEntry = null;
|
|
16985
|
+
if (nodePath) {
|
|
16986
|
+
try {
|
|
16987
|
+
mergetagNodeEntry = Editor.above(editor, {
|
|
16988
|
+
at: nodePath,
|
|
16989
|
+
match: NodeUtils.isMergetagElement
|
|
16990
|
+
});
|
|
16991
|
+
} catch (error2) {
|
|
16992
|
+
}
|
|
16993
|
+
}
|
|
16579
16994
|
const mergetagNode = mergetagNodeEntry == null ? void 0 : mergetagNodeEntry[0];
|
|
16580
16995
|
const onSave = useCallback(
|
|
16581
16996
|
(val) => {
|
|
16582
16997
|
if (!mergetagNode)
|
|
16583
16998
|
return;
|
|
16999
|
+
let path2;
|
|
17000
|
+
try {
|
|
17001
|
+
path2 = ReactEditor.findPath(editor, mergetagNode);
|
|
17002
|
+
} catch (error2) {
|
|
17003
|
+
return;
|
|
17004
|
+
}
|
|
16584
17005
|
Transforms.setNodes(
|
|
16585
17006
|
editor,
|
|
16586
17007
|
{
|
|
@@ -16589,7 +17010,7 @@ const RichTextBar = ({
|
|
|
16589
17010
|
}
|
|
16590
17011
|
},
|
|
16591
17012
|
{
|
|
16592
|
-
at:
|
|
17013
|
+
at: path2
|
|
16593
17014
|
}
|
|
16594
17015
|
);
|
|
16595
17016
|
},
|
|
@@ -16654,12 +17075,17 @@ const RichTextBar = ({
|
|
|
16654
17075
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: index2 }, isFunction$4(Com) ? /* @__PURE__ */ React__default.createElement(Com, null) : toolsMapping[item2]);
|
|
16655
17076
|
});
|
|
16656
17077
|
}, [AIAssistant2, list, mergetagNode, mergetags]);
|
|
16657
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
17078
|
+
return /* @__PURE__ */ React__default.createElement(RichTextBarContext.Provider, { value: contextValue }, /* @__PURE__ */ React__default.createElement(
|
|
16658
17079
|
"div",
|
|
16659
17080
|
{
|
|
16660
17081
|
id: "RichTextBar",
|
|
16661
17082
|
className: "RichTextBar",
|
|
16662
|
-
style: {
|
|
17083
|
+
style: {
|
|
17084
|
+
display: "inline-flex",
|
|
17085
|
+
alignItems: "center",
|
|
17086
|
+
flexWrap: wrap2 ? "wrap" : "nowrap",
|
|
17087
|
+
rowGap: "4px"
|
|
17088
|
+
}
|
|
16663
17089
|
},
|
|
16664
17090
|
content
|
|
16665
17091
|
), /* @__PURE__ */ React__default.createElement("div", { className: "mergtag-popover" }, mergetagNode && MergetagPopover2 && /* @__PURE__ */ React__default.createElement(
|
|
@@ -27489,7 +27915,9 @@ function ImageUploader(props) {
|
|
|
27489
27915
|
const [isUploading, setIsUploading] = useState(false);
|
|
27490
27916
|
const [preview, setPreview] = useState(false);
|
|
27491
27917
|
const [unsplashVisible, setUnsplashVisible] = useState(false);
|
|
27918
|
+
const popupContainerRef = useRef(null);
|
|
27492
27919
|
const [popupVisible, setPopupVisible] = useState(false);
|
|
27920
|
+
const pinToParent = props.pinToParent;
|
|
27493
27921
|
const onChangeMergeTag = useCallback(
|
|
27494
27922
|
(mergetag) => {
|
|
27495
27923
|
props.onChange(PluginManager.generateVariable(mergetag));
|
|
@@ -27659,17 +28087,11 @@ function ImageUploader(props) {
|
|
|
27659
28087
|
});
|
|
27660
28088
|
const onCloseUnsplash = useEventCallback(() => __async(this, null, function* () {
|
|
27661
28089
|
if (dirty) {
|
|
27662
|
-
|
|
28090
|
+
props.onChange(initialVal.current);
|
|
27663
28091
|
}
|
|
27664
28092
|
setUnsplashVisible(false);
|
|
27665
28093
|
setLock(false);
|
|
27666
28094
|
}));
|
|
27667
|
-
useEffect(() => {
|
|
27668
|
-
if (!unsplashVisible)
|
|
27669
|
-
return;
|
|
27670
|
-
const isLock = dirty;
|
|
27671
|
-
setLock(isLock);
|
|
27672
|
-
}, [dirty, setLock, unsplashVisible]);
|
|
27673
28095
|
const formatMergetags = useMemo(() => {
|
|
27674
28096
|
return getMergeTagsByType(mergetags || [], "image");
|
|
27675
28097
|
}, [mergetags]);
|
|
@@ -27707,20 +28129,24 @@ function ImageUploader(props) {
|
|
|
27707
28129
|
"div",
|
|
27708
28130
|
{
|
|
27709
28131
|
className: styles$2.exportFreeImage,
|
|
27710
|
-
onClick: () =>
|
|
28132
|
+
onClick: () => {
|
|
28133
|
+
setUnsplashVisible(true);
|
|
28134
|
+
setLock(true);
|
|
28135
|
+
}
|
|
27711
28136
|
},
|
|
27712
28137
|
t("Export free images")
|
|
27713
28138
|
)) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { style: { fontSize: 16 } }, t("Attach your image here.")), /* @__PURE__ */ React__default.createElement("div", { style: { color: "#606A72", fontSize: 14 } }, t("Accepts .jpg, .jpeg, .png, and .gif file types.")))
|
|
27714
28139
|
));
|
|
27715
28140
|
}
|
|
27716
28141
|
return /* @__PURE__ */ React__default.createElement("img", { src: image2, style: { maxWidth: "100%", maxHeight: "100%" } });
|
|
27717
|
-
}, [image2, isUploading, onUpload, props.value, unsplashClientId]);
|
|
28142
|
+
}, [image2, isUploading, onUpload, props.value, setLock, unsplashClientId]);
|
|
27718
28143
|
if (!props.uploadHandler) {
|
|
27719
28144
|
return /* @__PURE__ */ React__default.createElement(Input, { value: props.value, onChange });
|
|
27720
28145
|
}
|
|
27721
28146
|
return /* @__PURE__ */ React__default.createElement(
|
|
27722
28147
|
"div",
|
|
27723
28148
|
{
|
|
28149
|
+
ref: popupContainerRef,
|
|
27724
28150
|
onClick: (e) => {
|
|
27725
28151
|
e.stopPropagation();
|
|
27726
28152
|
e.preventDefault();
|
|
@@ -27763,7 +28189,10 @@ function ImageUploader(props) {
|
|
|
27763
28189
|
Select$1.Option,
|
|
27764
28190
|
{
|
|
27765
28191
|
value: "2",
|
|
27766
|
-
onClick: () =>
|
|
28192
|
+
onClick: () => {
|
|
28193
|
+
setUnsplashVisible(true);
|
|
28194
|
+
setLock(true);
|
|
28195
|
+
}
|
|
27767
28196
|
},
|
|
27768
28197
|
t("Export free images")
|
|
27769
28198
|
)
|
|
@@ -27789,6 +28218,7 @@ function ImageUploader(props) {
|
|
|
27789
28218
|
popupVisible,
|
|
27790
28219
|
onVisibleChange: setPopupVisible,
|
|
27791
28220
|
onChange: onChangeMergeTag,
|
|
28221
|
+
getPopupContainer: pinToParent ? () => popupContainerRef.current || document.body : void 0,
|
|
27792
28222
|
onClose,
|
|
27793
28223
|
value: "",
|
|
27794
28224
|
triggerElement: /* @__PURE__ */ React__default.createElement(
|
|
@@ -27810,14 +28240,6 @@ function ImageUploader(props) {
|
|
|
27810
28240
|
allowClear: true
|
|
27811
28241
|
}
|
|
27812
28242
|
))
|
|
27813
|
-
), /* @__PURE__ */ React__default.createElement(
|
|
27814
|
-
Modal,
|
|
27815
|
-
{
|
|
27816
|
-
visible: preview,
|
|
27817
|
-
footer: null,
|
|
27818
|
-
onCancel: () => setPreview(false)
|
|
27819
|
-
},
|
|
27820
|
-
/* @__PURE__ */ React__default.createElement("img", { alt: "Preview", style: { width: "100%" }, src: image2 })
|
|
27821
28243
|
)),
|
|
27822
28244
|
/* @__PURE__ */ React__default.createElement(
|
|
27823
28245
|
Drawer,
|
|
@@ -27883,6 +28305,20 @@ function ImageUploader(props) {
|
|
|
27883
28305
|
presetList: unsplash == null ? void 0 : unsplash.presetList
|
|
27884
28306
|
}
|
|
27885
28307
|
)
|
|
28308
|
+
),
|
|
28309
|
+
/* @__PURE__ */ React__default.createElement(
|
|
28310
|
+
Modal,
|
|
28311
|
+
{
|
|
28312
|
+
wrapClassName: "ImageUploaderField-preview",
|
|
28313
|
+
visible: preview,
|
|
28314
|
+
footer: null,
|
|
28315
|
+
onCancel: () => setPreview(false),
|
|
28316
|
+
getPopupContainer: () => {
|
|
28317
|
+
return document.body;
|
|
28318
|
+
},
|
|
28319
|
+
style: { zIndex: 9999 }
|
|
28320
|
+
},
|
|
28321
|
+
/* @__PURE__ */ React__default.createElement("img", { alt: "Preview", style: { width: "100%" }, src: image2 })
|
|
27886
28322
|
)
|
|
27887
28323
|
);
|
|
27888
28324
|
}
|
|
@@ -28084,9 +28520,19 @@ const RichTextField$1 = "";
|
|
|
28084
28520
|
const loop = () => {
|
|
28085
28521
|
};
|
|
28086
28522
|
const RichtextBar = (props) => {
|
|
28087
|
-
const { clientId } = useEditorProps();
|
|
28523
|
+
const { clientId, enabledAutoComplete } = useEditorProps();
|
|
28088
28524
|
const editor = useMemo(() => createEditor(), []);
|
|
28089
28525
|
const lastTemplateRef = useRef(null);
|
|
28526
|
+
const propsOnChangeRef = useRef(props.onChange);
|
|
28527
|
+
useEffect(() => {
|
|
28528
|
+
propsOnChangeRef.current = props.onChange;
|
|
28529
|
+
}, [props.onChange]);
|
|
28530
|
+
const debouncedChange = useMemo(
|
|
28531
|
+
() => debounce$2((value) => {
|
|
28532
|
+
propsOnChangeRef.current(value);
|
|
28533
|
+
}, 100),
|
|
28534
|
+
[]
|
|
28535
|
+
);
|
|
28090
28536
|
const calculateData = useMemo(() => {
|
|
28091
28537
|
if (!props.pageElement) {
|
|
28092
28538
|
const path22 = [0, 0, 0, 0];
|
|
@@ -28123,6 +28569,8 @@ const RichtextBar = (props) => {
|
|
|
28123
28569
|
return [{ subject: "", content }, path22];
|
|
28124
28570
|
}
|
|
28125
28571
|
const pageElement = cloneDeep(omit$2(props.pageElement, "children"));
|
|
28572
|
+
pageElement.attributes["margin-top"] = "0px";
|
|
28573
|
+
pageElement.attributes["margin-bottom"] = "0px";
|
|
28126
28574
|
const template2 = {
|
|
28127
28575
|
subject: "Blank",
|
|
28128
28576
|
content: pageElement
|
|
@@ -28152,34 +28600,47 @@ const RichtextBar = (props) => {
|
|
|
28152
28600
|
}));
|
|
28153
28601
|
path2 = [0, 0, 0];
|
|
28154
28602
|
} else if (NodeUtils.isContentElement(props.value)) {
|
|
28155
|
-
|
|
28156
|
-
|
|
28157
|
-
|
|
28603
|
+
if (enabledAutoComplete) {
|
|
28604
|
+
template2.content = BlockManager.getBlockByType(ElementType.PAGE).create(
|
|
28605
|
+
__spreadProps(__spreadValues({}, pageElement), {
|
|
28606
|
+
children: [props.value]
|
|
28607
|
+
})
|
|
28608
|
+
);
|
|
28609
|
+
path2 = [0, 0];
|
|
28610
|
+
} else {
|
|
28611
|
+
template2.content = BlockManager.getBlockByType(ElementType.PAGE).create(
|
|
28612
|
+
__spreadProps(__spreadValues({}, pageElement), {
|
|
28158
28613
|
children: [
|
|
28159
|
-
BlockManager.getBlockByType(ElementType.
|
|
28614
|
+
BlockManager.getBlockByType(ElementType.STANDARD_SECTION).create({
|
|
28160
28615
|
children: [
|
|
28161
28616
|
BlockManager.getBlockByType(
|
|
28162
|
-
ElementType.
|
|
28617
|
+
ElementType.STANDARD_COLUMN
|
|
28163
28618
|
).create({
|
|
28164
|
-
children: [
|
|
28619
|
+
children: [
|
|
28620
|
+
BlockManager.getBlockByType(
|
|
28621
|
+
ElementType.STANDARD_PARAGRAPH
|
|
28622
|
+
).create({
|
|
28623
|
+
children: [props.value]
|
|
28624
|
+
})
|
|
28625
|
+
]
|
|
28165
28626
|
})
|
|
28166
|
-
]
|
|
28627
|
+
],
|
|
28628
|
+
attributes: {
|
|
28629
|
+
"padding-bottom": "0px",
|
|
28630
|
+
"padding-left": "0px",
|
|
28631
|
+
"padding-right": "0px",
|
|
28632
|
+
"padding-top": "0px"
|
|
28633
|
+
}
|
|
28167
28634
|
})
|
|
28168
|
-
]
|
|
28169
|
-
attributes: {
|
|
28170
|
-
"padding-bottom": "0px",
|
|
28171
|
-
"padding-left": "0px",
|
|
28172
|
-
"padding-right": "0px",
|
|
28173
|
-
"padding-top": "0px"
|
|
28174
|
-
}
|
|
28635
|
+
]
|
|
28175
28636
|
})
|
|
28176
|
-
|
|
28177
|
-
|
|
28178
|
-
|
|
28637
|
+
);
|
|
28638
|
+
path2 = [0, 0, 0, 0];
|
|
28639
|
+
}
|
|
28179
28640
|
}
|
|
28180
28641
|
return [template2, path2];
|
|
28181
|
-
}, [props.pageElement, props.value]);
|
|
28182
|
-
const template = calculateData[0];
|
|
28642
|
+
}, [enabledAutoComplete, props.pageElement, props.value]);
|
|
28643
|
+
const template = useMemo(() => cloneDeep(calculateData[0]), [calculateData]);
|
|
28183
28644
|
const initialValue = useMemo(() => {
|
|
28184
28645
|
if (!isEqual(lastTemplateRef.current, template)) {
|
|
28185
28646
|
lastTemplateRef.current = template;
|
|
@@ -28188,12 +28649,17 @@ const RichtextBar = (props) => {
|
|
|
28188
28649
|
}, [template]);
|
|
28189
28650
|
const onPageChange = useEventCallback(
|
|
28190
28651
|
(page, editor2) => {
|
|
28191
|
-
|
|
28192
|
-
|
|
28193
|
-
|
|
28194
|
-
|
|
28652
|
+
try {
|
|
28653
|
+
if (!Node.has(editor2, calculateData[1]))
|
|
28654
|
+
return;
|
|
28655
|
+
const currentElement = Node.get(editor2, calculateData[1]);
|
|
28656
|
+
if (!currentElement) {
|
|
28657
|
+
console.error("Element not found");
|
|
28658
|
+
return;
|
|
28659
|
+
}
|
|
28660
|
+
debouncedChange(cloneDeep(currentElement));
|
|
28661
|
+
} catch (error2) {
|
|
28195
28662
|
}
|
|
28196
|
-
props.onChange(currentElement);
|
|
28197
28663
|
}
|
|
28198
28664
|
);
|
|
28199
28665
|
return useMemo(() => {
|
|
@@ -28205,16 +28671,59 @@ const RichtextBar = (props) => {
|
|
|
28205
28671
|
initialValues: initialValue,
|
|
28206
28672
|
editor,
|
|
28207
28673
|
withEnhanceEditor: withTheme$1,
|
|
28674
|
+
EnhanceProvider: PluginsProvider,
|
|
28208
28675
|
onSubmit: loop,
|
|
28209
28676
|
onPageChange,
|
|
28210
28677
|
newLineWithBr: true
|
|
28211
28678
|
},
|
|
28212
|
-
/* @__PURE__ */ React__default.createElement(
|
|
28213
|
-
|
|
28679
|
+
/* @__PURE__ */ React__default.createElement("div", { className: "RichTextField-fixed-toolbar" }, /* @__PURE__ */ React__default.createElement(
|
|
28680
|
+
SharedComponents.RichTextBar,
|
|
28681
|
+
{
|
|
28682
|
+
wrap: true,
|
|
28683
|
+
getPopupContainer: () => document.body,
|
|
28684
|
+
list: [
|
|
28685
|
+
TextFormat.FONT_SIZE,
|
|
28686
|
+
TextFormat.TEXT_COLOR,
|
|
28687
|
+
TextFormat.BACKGROUND_COLOR,
|
|
28688
|
+
TextFormat.ALIGN,
|
|
28689
|
+
TextFormat.LIST,
|
|
28690
|
+
TextFormat.BOLD,
|
|
28691
|
+
TextFormat.ITALIC,
|
|
28692
|
+
TextFormat.UNDERLINE,
|
|
28693
|
+
TextFormat.STRIKETHROUGH,
|
|
28694
|
+
TextFormat.LINK,
|
|
28695
|
+
TextFormat.MERGETAG,
|
|
28696
|
+
TextFormat.REMOVE_FORMAT
|
|
28697
|
+
]
|
|
28698
|
+
}
|
|
28699
|
+
)),
|
|
28700
|
+
/* @__PURE__ */ React__default.createElement(
|
|
28701
|
+
"div",
|
|
28702
|
+
{
|
|
28703
|
+
className: "RichTextField-content",
|
|
28704
|
+
style: { minHeight: props.height }
|
|
28705
|
+
},
|
|
28706
|
+
/* @__PURE__ */ React__default.createElement(EmailEditor, null)
|
|
28707
|
+
),
|
|
28214
28708
|
/* @__PURE__ */ React__default.createElement(SharedComponents.Hotkeys, null),
|
|
28215
|
-
/* @__PURE__ */ React__default.createElement("style", null, styleText$h)
|
|
28709
|
+
/* @__PURE__ */ React__default.createElement("style", null, styleText$h),
|
|
28710
|
+
/* @__PURE__ */ React__default.createElement(AuthSelectBlockPath, { path: calculateData[1] })
|
|
28216
28711
|
);
|
|
28217
|
-
}, [
|
|
28712
|
+
}, [
|
|
28713
|
+
props.height,
|
|
28714
|
+
clientId,
|
|
28715
|
+
initialValue,
|
|
28716
|
+
editor,
|
|
28717
|
+
onPageChange,
|
|
28718
|
+
calculateData
|
|
28719
|
+
]);
|
|
28720
|
+
};
|
|
28721
|
+
const AuthSelectBlockPath = ({ path: path2 }) => {
|
|
28722
|
+
const setSelectedNodePath = useSetSelectedNodePath();
|
|
28723
|
+
useEffect(() => {
|
|
28724
|
+
setSelectedNodePath(path2);
|
|
28725
|
+
}, [path2, setSelectedNodePath]);
|
|
28726
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
|
|
28218
28727
|
};
|
|
28219
28728
|
const DefaultRichTextField = enhancer(RichtextBar);
|
|
28220
28729
|
const RichTextField = (props) => {
|
|
@@ -33622,6 +34131,52 @@ const ConfigPanelsMap = {
|
|
|
33622
34131
|
[ElementType.STANDARD_TABLE2]: Table2,
|
|
33623
34132
|
[ElementType.STANDARD_BLOCK_QUOTE]: Blockquote
|
|
33624
34133
|
};
|
|
34134
|
+
const PageHeaderSchema = [
|
|
34135
|
+
{
|
|
34136
|
+
type: "CollapseGroup",
|
|
34137
|
+
name: "0",
|
|
34138
|
+
header: t("Logo"),
|
|
34139
|
+
defaultActive: true,
|
|
34140
|
+
children: [
|
|
34141
|
+
{
|
|
34142
|
+
type: "ImageUrl",
|
|
34143
|
+
// section->column->image
|
|
34144
|
+
name: "data.content.0.children.0.children.0.attributes.src",
|
|
34145
|
+
label: t("Logo")
|
|
34146
|
+
},
|
|
34147
|
+
{
|
|
34148
|
+
type: "PixelField",
|
|
34149
|
+
name: "data.content.0.children.0.children.0.attributes.width",
|
|
34150
|
+
label: t("Width")
|
|
34151
|
+
},
|
|
34152
|
+
{
|
|
34153
|
+
type: "BackgroundColor",
|
|
34154
|
+
name: "attributes.background-color",
|
|
34155
|
+
label: t("Background color")
|
|
34156
|
+
}
|
|
34157
|
+
]
|
|
34158
|
+
}
|
|
34159
|
+
];
|
|
34160
|
+
const PageFooterSchema = [
|
|
34161
|
+
{
|
|
34162
|
+
type: "CollapseGroup",
|
|
34163
|
+
name: "0",
|
|
34164
|
+
header: t("Footer"),
|
|
34165
|
+
defaultActive: true,
|
|
34166
|
+
children: [
|
|
34167
|
+
{
|
|
34168
|
+
type: "TextField",
|
|
34169
|
+
name: "data.content.0.children.0.children.0.children.0.text",
|
|
34170
|
+
label: t("Text")
|
|
34171
|
+
},
|
|
34172
|
+
{
|
|
34173
|
+
type: "BackgroundColor",
|
|
34174
|
+
name: "attributes.background-color",
|
|
34175
|
+
label: t("Background color")
|
|
34176
|
+
}
|
|
34177
|
+
]
|
|
34178
|
+
}
|
|
34179
|
+
];
|
|
33625
34180
|
const BlockSchemasMap = {
|
|
33626
34181
|
// // Text elements
|
|
33627
34182
|
// [ElementType.TEXT]: TextSchema,
|
|
@@ -33663,6 +34218,8 @@ const BlockSchemasMap = {
|
|
|
33663
34218
|
// [ElementType.STANDARD_SOCIAL]: SocialSchema,
|
|
33664
34219
|
// Note: Code and Widget components are too complex for schema-based approach
|
|
33665
34220
|
// They will continue to use component-based configuration
|
|
34221
|
+
[ElementType.PAGE_HEADER]: PageHeaderSchema,
|
|
34222
|
+
[ElementType.PAGE_FOOTER]: PageFooterSchema
|
|
33666
34223
|
};
|
|
33667
34224
|
const SchemaPanelRenderer = ({
|
|
33668
34225
|
schema,
|
|
@@ -38808,6 +39365,7 @@ const ContextMenu = ({
|
|
|
38808
39365
|
deleteSelectedColumn,
|
|
38809
39366
|
mergeCeils
|
|
38810
39367
|
} = useTableInteract();
|
|
39368
|
+
const ele = document.getElementById("HoveringToolbar");
|
|
38811
39369
|
return createPortal(
|
|
38812
39370
|
/* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(
|
|
38813
39371
|
"div",
|
|
@@ -38883,7 +39441,7 @@ const ContextMenu = ({
|
|
|
38883
39441
|
/* @__PURE__ */ React__default.createElement("div", { className: "easy-email-pro-table-operation-menu-text" }, "Delete selected rows")
|
|
38884
39442
|
)
|
|
38885
39443
|
), /* @__PURE__ */ React__default.createElement("style", null, styleText$b)),
|
|
38886
|
-
document.body
|
|
39444
|
+
ele || document.body
|
|
38887
39445
|
);
|
|
38888
39446
|
};
|
|
38889
39447
|
const ERROR_LIMIT = 2;
|
|
@@ -38907,12 +39465,32 @@ const TableTools = (props) => {
|
|
|
38907
39465
|
return;
|
|
38908
39466
|
const handleContextmenu = (ev) => {
|
|
38909
39467
|
ev.preventDefault();
|
|
38910
|
-
setShowContextMenu(true);
|
|
38911
39468
|
const iframeRect = iframe.getBoundingClientRect();
|
|
39469
|
+
const initialLeft = ev.clientX + iframeRect.left;
|
|
39470
|
+
const initialTop = ev.clientY + iframeRect.top;
|
|
39471
|
+
const MENU_HEIGHT = 280;
|
|
39472
|
+
const MENU_WIDTH = 220;
|
|
39473
|
+
const viewportHeight = window.innerHeight;
|
|
39474
|
+
const viewportWidth = window.innerWidth;
|
|
39475
|
+
let adjustedLeft = initialLeft;
|
|
39476
|
+
let adjustedTop = initialTop;
|
|
39477
|
+
if (initialTop + MENU_HEIGHT > viewportHeight) {
|
|
39478
|
+
adjustedTop = initialTop - MENU_HEIGHT;
|
|
39479
|
+
if (adjustedTop < 0) {
|
|
39480
|
+
adjustedTop = 8;
|
|
39481
|
+
}
|
|
39482
|
+
}
|
|
39483
|
+
if (initialLeft + MENU_WIDTH > viewportWidth) {
|
|
39484
|
+
adjustedLeft = viewportWidth - MENU_WIDTH - 8;
|
|
39485
|
+
}
|
|
39486
|
+
if (adjustedLeft < 0) {
|
|
39487
|
+
adjustedLeft = 8;
|
|
39488
|
+
}
|
|
38912
39489
|
setPosition({
|
|
38913
|
-
left:
|
|
38914
|
-
top:
|
|
39490
|
+
left: adjustedLeft + 20,
|
|
39491
|
+
top: adjustedTop
|
|
38915
39492
|
});
|
|
39493
|
+
setShowContextMenu(true);
|
|
38916
39494
|
};
|
|
38917
39495
|
props.nodeElement.addEventListener("contextmenu", handleContextmenu);
|
|
38918
39496
|
return () => {
|
|
@@ -39383,6 +39961,63 @@ const getIsLargeScreen = () => {
|
|
|
39383
39961
|
const isLargeScreen = windowSize >= 1600;
|
|
39384
39962
|
return isLargeScreen;
|
|
39385
39963
|
};
|
|
39964
|
+
const EditorContainer = ({
|
|
39965
|
+
children,
|
|
39966
|
+
style
|
|
39967
|
+
}) => {
|
|
39968
|
+
const { lock } = useEditorState();
|
|
39969
|
+
return /* @__PURE__ */ React__default.createElement("div", { style: __spreadProps(__spreadValues({}, style), { position: "relative" }), id: EDITOR_CONTAINER }, lock && /* @__PURE__ */ React__default.createElement(
|
|
39970
|
+
"div",
|
|
39971
|
+
{
|
|
39972
|
+
style: {
|
|
39973
|
+
position: "absolute",
|
|
39974
|
+
top: 0,
|
|
39975
|
+
left: 0,
|
|
39976
|
+
right: 0,
|
|
39977
|
+
bottom: 0,
|
|
39978
|
+
backgroundColor: "rgba(255, 255, 255, 0.3)",
|
|
39979
|
+
zIndex: 10,
|
|
39980
|
+
cursor: "not-allowed"
|
|
39981
|
+
},
|
|
39982
|
+
onPointerDown: (e) => {
|
|
39983
|
+
e.preventDefault();
|
|
39984
|
+
e.stopPropagation();
|
|
39985
|
+
},
|
|
39986
|
+
onClick: (e) => {
|
|
39987
|
+
e.preventDefault();
|
|
39988
|
+
e.stopPropagation();
|
|
39989
|
+
}
|
|
39990
|
+
}
|
|
39991
|
+
), children);
|
|
39992
|
+
};
|
|
39993
|
+
const normalizeElements = (element) => {
|
|
39994
|
+
const pageHeaderElements = element.children.filter(
|
|
39995
|
+
NodeUtils.isPageHeaderElement
|
|
39996
|
+
);
|
|
39997
|
+
if (pageHeaderElements.length > 1) {
|
|
39998
|
+
throw new Error("Only one page header element is allowed");
|
|
39999
|
+
}
|
|
40000
|
+
const pageFooterElements = element.children.filter(
|
|
40001
|
+
NodeUtils.isPageFooterElement
|
|
40002
|
+
);
|
|
40003
|
+
if (pageFooterElements.length > 1) {
|
|
40004
|
+
throw new Error("Only one page footer element is allowed");
|
|
40005
|
+
}
|
|
40006
|
+
if (pageHeaderElements.length === 0 && pageFooterElements.length === 0) {
|
|
40007
|
+
return assignIdsToElementTree(element);
|
|
40008
|
+
}
|
|
40009
|
+
const otherElements = element.children.filter(
|
|
40010
|
+
(child) => !NodeUtils.isPageHeaderElement(child) && !NodeUtils.isPageFooterElement(child)
|
|
40011
|
+
);
|
|
40012
|
+
const sortedChildren = [
|
|
40013
|
+
...pageHeaderElements.length > 0 ? pageHeaderElements : [],
|
|
40014
|
+
...otherElements,
|
|
40015
|
+
...pageFooterElements.length > 0 ? pageFooterElements : []
|
|
40016
|
+
];
|
|
40017
|
+
return assignIdsToElementTree(__spreadProps(__spreadValues({}, element), {
|
|
40018
|
+
children: sortedChildren
|
|
40019
|
+
}));
|
|
40020
|
+
};
|
|
39386
40021
|
const useCreateConfig$1 = (_k) => {
|
|
39387
40022
|
var _l = _k, {
|
|
39388
40023
|
interactiveStyle,
|
|
@@ -39392,7 +40027,7 @@ const useCreateConfig$1 = (_k) => {
|
|
|
39392
40027
|
"hoveringToolbar"
|
|
39393
40028
|
]);
|
|
39394
40029
|
const editor = useMemo(() => createEditor(), []);
|
|
39395
|
-
rest.initialValues.content =
|
|
40030
|
+
rest.initialValues.content = normalizeElements(
|
|
39396
40031
|
rest.initialValues.content
|
|
39397
40032
|
);
|
|
39398
40033
|
let initialValues = rest.initialValues;
|
|
@@ -39513,15 +40148,20 @@ const Layout$1 = ({ children, footer, header, tabLeft, tabRight }) => {
|
|
|
39513
40148
|
},
|
|
39514
40149
|
/* @__PURE__ */ React__default.createElement(SharedComponents.BlockSideBar, { height })
|
|
39515
40150
|
),
|
|
39516
|
-
/* @__PURE__ */ React__default.createElement(
|
|
39517
|
-
|
|
40151
|
+
/* @__PURE__ */ React__default.createElement(
|
|
40152
|
+
EditorContainer,
|
|
39518
40153
|
{
|
|
39519
|
-
|
|
39520
|
-
footer,
|
|
39521
|
-
left: tabLeft,
|
|
39522
|
-
right: tabRight
|
|
40154
|
+
style: { height, minWidth: 800, flex: 1 }
|
|
39523
40155
|
},
|
|
39524
|
-
/* @__PURE__ */ React__default.createElement(
|
|
40156
|
+
/* @__PURE__ */ React__default.createElement(
|
|
40157
|
+
SharedComponents.EditorTabs,
|
|
40158
|
+
{
|
|
40159
|
+
header,
|
|
40160
|
+
footer,
|
|
40161
|
+
left: tabLeft,
|
|
40162
|
+
right: tabRight
|
|
40163
|
+
},
|
|
40164
|
+
/* @__PURE__ */ React__default.createElement(EmailEditor, null, /* @__PURE__ */ React__default.createElement("style", { id: "Retro-CSS" }, styleText$h, RetroStyleText, `
|
|
39525
40165
|
body {
|
|
39526
40166
|
--page-width: ${pageDataWidth}px;
|
|
39527
40167
|
}
|
|
@@ -39533,7 +40173,8 @@ const Layout$1 = ({ children, footer, header, tabLeft, tabRight }) => {
|
|
|
39533
40173
|
}
|
|
39534
40174
|
|
|
39535
40175
|
`), children)
|
|
39536
|
-
|
|
40176
|
+
)
|
|
40177
|
+
),
|
|
39537
40178
|
showSidebar && compact && /* @__PURE__ */ React__default.createElement(
|
|
39538
40179
|
Layout$2.Sider,
|
|
39539
40180
|
{
|
|
@@ -40365,52 +41006,59 @@ const withTheme = (editor) => {
|
|
|
40365
41006
|
};
|
|
40366
41007
|
editor.deleteBackward = (unit) => {
|
|
40367
41008
|
var _a;
|
|
40368
|
-
|
|
40369
|
-
|
|
40370
|
-
|
|
40371
|
-
if (textElementEntry) {
|
|
40372
|
-
const text = Editor.string(editor, textElementEntry[1]);
|
|
40373
|
-
if (text.length === 0 && textElementEntry[0].type !== ElementType.STANDARD_PARAGRAPH && !NodeUtils.isTextListItemElement(textElementEntry[0])) {
|
|
40374
|
-
Transforms.setNodes(
|
|
40375
|
-
editor,
|
|
40376
|
-
{
|
|
40377
|
-
type: ElementType.STANDARD_PARAGRAPH
|
|
40378
|
-
},
|
|
40379
|
-
{
|
|
40380
|
-
at: textElementEntry[1]
|
|
40381
|
-
}
|
|
40382
|
-
);
|
|
41009
|
+
try {
|
|
41010
|
+
if (!editor.selection) {
|
|
41011
|
+
deleteBackward(unit);
|
|
40383
41012
|
return;
|
|
40384
41013
|
}
|
|
40385
|
-
|
|
40386
|
-
|
|
40387
|
-
|
|
40388
|
-
|
|
40389
|
-
|
|
40390
|
-
|
|
40391
|
-
|
|
40392
|
-
|
|
40393
|
-
|
|
40394
|
-
|
|
40395
|
-
|
|
40396
|
-
|
|
40397
|
-
|
|
40398
|
-
return NodeUtils.isTextElement(node) || NodeUtils.isButtonElement(node);
|
|
40399
|
-
},
|
|
40400
|
-
at: previousText[1]
|
|
40401
|
-
}) : [];
|
|
40402
|
-
if (previousEntry) {
|
|
40403
|
-
Transforms.select(editor, Editor.end(editor, previousEntry[1]));
|
|
40404
|
-
} else {
|
|
40405
|
-
Transforms.deselect(editor);
|
|
41014
|
+
const textElementEntry = Editor.above(editor, {
|
|
41015
|
+
match: NodeUtils.isTextElement
|
|
41016
|
+
});
|
|
41017
|
+
if (textElementEntry) {
|
|
41018
|
+
const text = Editor.string(editor, textElementEntry[1]);
|
|
41019
|
+
if (text.length === 0 && textElementEntry[0].type !== ElementType.STANDARD_PARAGRAPH && !NodeUtils.isTextListItemElement(textElementEntry[0])) {
|
|
41020
|
+
Transforms.setNodes(
|
|
41021
|
+
editor,
|
|
41022
|
+
{
|
|
41023
|
+
type: ElementType.STANDARD_PARAGRAPH
|
|
41024
|
+
},
|
|
41025
|
+
{
|
|
41026
|
+
at: textElementEntry[1]
|
|
40406
41027
|
}
|
|
40407
|
-
|
|
40408
|
-
at: contentElementEntry[1]
|
|
40409
|
-
});
|
|
40410
|
-
});
|
|
41028
|
+
);
|
|
40411
41029
|
return;
|
|
40412
41030
|
}
|
|
40413
41031
|
}
|
|
41032
|
+
const contentElementEntry = Editor.above(editor, {
|
|
41033
|
+
match: NodeUtils.isContentElement
|
|
41034
|
+
});
|
|
41035
|
+
if (contentElementEntry && !NodeUtils.isTextListItemElement(contentElementEntry[0])) {
|
|
41036
|
+
const isVoid = NodeUtils.isVoidBlockElement(contentElementEntry[0]);
|
|
41037
|
+
const textElement = contentElementEntry[0];
|
|
41038
|
+
if (textElement.children.length === 1 && !isVoid) {
|
|
41039
|
+
if (((_a = editor.selection) == null ? void 0 : _a.focus.offset) === 0) {
|
|
41040
|
+
editor.withoutNormalizing(() => {
|
|
41041
|
+
const previousText = Editor.previous(editor);
|
|
41042
|
+
const [previousEntry] = previousText ? Editor.nodes(editor, {
|
|
41043
|
+
match: (node) => {
|
|
41044
|
+
return NodeUtils.isTextElement(node) || NodeUtils.isButtonElement(node);
|
|
41045
|
+
},
|
|
41046
|
+
at: previousText[1]
|
|
41047
|
+
}) : [];
|
|
41048
|
+
if (previousEntry) {
|
|
41049
|
+
Transforms.select(editor, Editor.end(editor, previousEntry[1]));
|
|
41050
|
+
} else {
|
|
41051
|
+
Transforms.deselect(editor);
|
|
41052
|
+
}
|
|
41053
|
+
Transforms.delete(editor, {
|
|
41054
|
+
at: contentElementEntry[1]
|
|
41055
|
+
});
|
|
41056
|
+
});
|
|
41057
|
+
return;
|
|
41058
|
+
}
|
|
41059
|
+
}
|
|
41060
|
+
}
|
|
41061
|
+
} catch (error2) {
|
|
40414
41062
|
}
|
|
40415
41063
|
deleteBackward(unit);
|
|
40416
41064
|
};
|