easy-email-pro-theme 1.50.9 → 1.50.10

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
- const matchAlign = match && get(node.attributes, "align");
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,10 @@ 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
+ }
15741
15777
  Transforms.wrapNodes(
15742
15778
  editor,
15743
15779
  {
@@ -15751,7 +15787,9 @@ const TextAlign$1 = () => {
15751
15787
  }
15752
15788
  },
15753
15789
  {
15754
- match: (node2) => !NodeUtils.isBlockElement(node2) && !NodeUtils.isHTMLBlockNodeElement(node2)
15790
+ match: (node2) => NodeUtils.isTextNode(node2) || NodeUtils.isInlineElement(node2),
15791
+ mode: "highest",
15792
+ at: match[1]
15755
15793
  }
15756
15794
  );
15757
15795
  } else {
@@ -0,0 +1 @@
1
+ export declare function styleStringToObject(styleString: string): Record<string, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-email-pro-theme",
3
- "version": "1.50.9",
3
+ "version": "1.50.10",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib"