easy-email-pro-theme 1.50.9 → 1.50.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js
CHANGED
|
@@ -15714,23 +15714,55 @@ const MergeTag = React__default.memo(() => {
|
|
|
15714
15714
|
}
|
|
15715
15715
|
));
|
|
15716
15716
|
});
|
|
15717
|
+
function styleStringToObject(styleString) {
|
|
15718
|
+
return styleString.split(";").filter(Boolean).reduce(
|
|
15719
|
+
(acc, style) => {
|
|
15720
|
+
const [property, value] = style.split(":").map((str) => str.trim());
|
|
15721
|
+
acc[property] = value;
|
|
15722
|
+
return acc;
|
|
15723
|
+
},
|
|
15724
|
+
{}
|
|
15725
|
+
);
|
|
15726
|
+
}
|
|
15717
15727
|
const TextAlign$1 = () => {
|
|
15728
|
+
var _a, _b;
|
|
15718
15729
|
const editor = useSlate();
|
|
15719
15730
|
const [match] = Editor.nodes(editor, {
|
|
15720
15731
|
match: (n) => NodeUtils.isContentElement(n),
|
|
15721
15732
|
mode: "all"
|
|
15722
15733
|
});
|
|
15734
|
+
const [matchHtmlBlockNode] = Editor.nodes(editor, {
|
|
15735
|
+
match: (node2) => {
|
|
15736
|
+
return NodeUtils.isHTMLBlockNodeElement(node2);
|
|
15737
|
+
},
|
|
15738
|
+
mode: "lowest"
|
|
15739
|
+
});
|
|
15723
15740
|
const { enabledHtmlBlockNodeAlign } = useEditorProps();
|
|
15724
15741
|
const node = match == null ? void 0 : match[0];
|
|
15725
15742
|
const { setFieldValue } = useEditorContext();
|
|
15726
|
-
|
|
15743
|
+
let styleObject;
|
|
15744
|
+
if (matchHtmlBlockNode == null ? void 0 : matchHtmlBlockNode[0]) {
|
|
15745
|
+
styleObject = styleStringToObject(
|
|
15746
|
+
((_b = (_a = matchHtmlBlockNode == null ? void 0 : matchHtmlBlockNode[0]) == null ? void 0 : _a.attributes) == null ? void 0 : _b.style) || ""
|
|
15747
|
+
);
|
|
15748
|
+
}
|
|
15749
|
+
const matchAlign = get(styleObject, "text-align") || get(node.attributes, "align");
|
|
15727
15750
|
const onAlignHandle = (align) => {
|
|
15751
|
+
var _a2;
|
|
15728
15752
|
if (!match)
|
|
15729
15753
|
return;
|
|
15730
15754
|
if (!enabledHtmlBlockNodeAlign) {
|
|
15731
15755
|
setFieldValue(match[1], "attributes.align", align);
|
|
15732
15756
|
return;
|
|
15733
15757
|
}
|
|
15758
|
+
const selection = editor.selection;
|
|
15759
|
+
const mergeNodeEntry = editor.selection ? editor.findSelfOrAncestorNodeByType({
|
|
15760
|
+
type: ElementType.MERGETAG,
|
|
15761
|
+
path: (_a2 = editor.selection) == null ? void 0 : _a2.anchor.path
|
|
15762
|
+
}) : null;
|
|
15763
|
+
const isCollapsed = Boolean(
|
|
15764
|
+
selection && (Range.isCollapsed(selection) || Editor.string(editor, selection) === "") && !mergeNodeEntry
|
|
15765
|
+
);
|
|
15734
15766
|
const htmlBlockNodeElementEntry = Editor.above(editor, {
|
|
15735
15767
|
match(node2, path2) {
|
|
15736
15768
|
return NodeUtils.isHTMLBlockNodeElement(node2);
|
|
@@ -15738,6 +15770,30 @@ const TextAlign$1 = () => {
|
|
|
15738
15770
|
mode: "highest"
|
|
15739
15771
|
});
|
|
15740
15772
|
if (!htmlBlockNodeElementEntry) {
|
|
15773
|
+
if (isCollapsed) {
|
|
15774
|
+
setFieldValue(match[1], "attributes.align", align);
|
|
15775
|
+
return;
|
|
15776
|
+
}
|
|
15777
|
+
const nodes = Array.from(
|
|
15778
|
+
Editor.nodes(editor, {
|
|
15779
|
+
match: (node2) => {
|
|
15780
|
+
return NodeUtils.isHTMLBlockNodeElement(node2);
|
|
15781
|
+
},
|
|
15782
|
+
mode: "lowest"
|
|
15783
|
+
})
|
|
15784
|
+
);
|
|
15785
|
+
if (nodes.length > 1) {
|
|
15786
|
+
Editor.withoutNormalizing(editor, () => {
|
|
15787
|
+
nodes.forEach((node2) => {
|
|
15788
|
+
Transforms.setNodes(editor, {
|
|
15789
|
+
attributes: __spreadProps(__spreadValues({}, node2[0].attributes), {
|
|
15790
|
+
style: `text-align:${align};`
|
|
15791
|
+
})
|
|
15792
|
+
});
|
|
15793
|
+
});
|
|
15794
|
+
});
|
|
15795
|
+
return;
|
|
15796
|
+
}
|
|
15741
15797
|
Transforms.wrapNodes(
|
|
15742
15798
|
editor,
|
|
15743
15799
|
{
|
|
@@ -15751,7 +15807,9 @@ const TextAlign$1 = () => {
|
|
|
15751
15807
|
}
|
|
15752
15808
|
},
|
|
15753
15809
|
{
|
|
15754
|
-
match: (node2) =>
|
|
15810
|
+
match: (node2) => NodeUtils.isTextNode(node2) || NodeUtils.isInlineElement(node2),
|
|
15811
|
+
mode: "highest",
|
|
15812
|
+
at: match[1]
|
|
15755
15813
|
}
|
|
15756
15814
|
);
|
|
15757
15815
|
} else {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function styleStringToObject(styleString: string): Record<string, string>;
|