@maily-to/core 2.0.0-beta.8 → 2.0.0-beta.9

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.
@@ -2763,38 +2763,52 @@ function useUploadStatus(editor, src) {
2763
2763
  return status ?? IMAGE_UPLOAD_STATUSES.LOADED;
2764
2764
  }
2765
2765
  function ImageView(props) {
2766
- const $ = c(60);
2766
+ const $ = c(65);
2767
2767
  const { editor, getPos, node, updateAttributes } = props;
2768
- const { align, alt, src, width } = node.attrs;
2769
- let t0;
2770
- if ($[0] !== src) {
2771
- t0 = !!src && hasVariableInText(src);
2772
- $[0] = src;
2773
- $[1] = t0;
2774
- } else t0 = $[1];
2775
- const isSrcVariable = t0;
2776
- const status = useUploadStatus(editor, isSrcVariable ? void 0 : src);
2768
+ const { align, alt, src, width, style } = node.attrs;
2769
+ const t0 = style ?? "";
2777
2770
  let t1;
2778
- if ($[2] !== updateAttributes) {
2779
- t1 = (committed) => updateAttributes({ width: `${committed}%` });
2780
- $[2] = updateAttributes;
2781
- $[3] = t1;
2782
- } else t1 = $[3];
2783
- const t2 = t1;
2771
+ if ($[0] !== t0) {
2772
+ t1 = parseInlineStyles(t0);
2773
+ $[0] = t0;
2774
+ $[1] = t1;
2775
+ } else t1 = $[1];
2776
+ let authoredStyle;
2777
+ if ($[2] !== t1) {
2778
+ const { width: _width, maxWidth: _maxWidth, height: _height, ...t2 } = t1;
2779
+ authoredStyle = t2;
2780
+ $[2] = t1;
2781
+ $[3] = authoredStyle;
2782
+ } else authoredStyle = $[3];
2783
+ let t2;
2784
+ if ($[4] !== src) {
2785
+ t2 = !!src && hasVariableInText(src);
2786
+ $[4] = src;
2787
+ $[5] = t2;
2788
+ } else t2 = $[5];
2789
+ const isSrcVariable = t2;
2790
+ const status = useUploadStatus(editor, isSrcVariable ? void 0 : src);
2784
2791
  let t3;
2785
- if ($[4] !== align || $[5] !== t2) {
2786
- t3 = {
2792
+ if ($[6] !== updateAttributes) {
2793
+ t3 = (committed) => updateAttributes({ width: `${committed}%` });
2794
+ $[6] = updateAttributes;
2795
+ $[7] = t3;
2796
+ } else t3 = $[7];
2797
+ const t4 = t3;
2798
+ let t5;
2799
+ if ($[8] !== align || $[9] !== t4) {
2800
+ t5 = {
2787
2801
  align,
2788
- onWidthCommitted: t2
2802
+ onWidthCommitted: t4
2789
2803
  };
2790
- $[4] = align;
2791
- $[5] = t2;
2792
- $[6] = t3;
2793
- } else t3 = $[6];
2794
- const { containerRef, handleResize, imageWrapperRef, isResizing, setShouldShowDragHandles, shouldShowDragHandles } = useImageResizeController(t3);
2795
- let t4;
2796
- if ($[7] !== handleResize || $[8] !== imageWrapperRef) {
2797
- t4 = (handle, event) => {
2804
+ $[8] = align;
2805
+ $[9] = t4;
2806
+ $[10] = t5;
2807
+ } else t5 = $[10];
2808
+ const { containerRef, handleResize, imageWrapperRef, isResizing, setShouldShowDragHandles, shouldShowDragHandles } = useImageResizeController(t5);
2809
+ let t6;
2810
+ if ($[11] !== handleResize || $[12] !== imageWrapperRef) {
2811
+ t6 = (handle, event) => {
2798
2812
  const imageWrapper = imageWrapperRef.current;
2799
2813
  if (!imageWrapper) return;
2800
2814
  event.preventDefault();
@@ -2804,88 +2818,89 @@ function ImageView(props) {
2804
2818
  initialWidth: imageWrapper.clientWidth
2805
2819
  });
2806
2820
  };
2807
- $[7] = handleResize;
2808
- $[8] = imageWrapperRef;
2809
- $[9] = t4;
2810
- } else t4 = $[9];
2811
- const handlePointerDown = t4;
2812
- let t5;
2813
- if ($[10] !== editor || $[11] !== getPos || $[12] !== node.nodeSize) {
2814
- t5 = (file) => {
2821
+ $[11] = handleResize;
2822
+ $[12] = imageWrapperRef;
2823
+ $[13] = t6;
2824
+ } else t6 = $[13];
2825
+ const handlePointerDown = t6;
2826
+ let t7;
2827
+ if ($[14] !== editor || $[15] !== getPos || $[16] !== node.nodeSize) {
2828
+ t7 = (file) => {
2815
2829
  const pos = getPos();
2816
2830
  if (pos == null) return;
2817
2831
  editor.view.dispatch(editor.state.tr.delete(pos, pos + node.nodeSize));
2818
2832
  uploadImageFile(editor, file, pos);
2819
2833
  };
2820
- $[10] = editor;
2821
- $[11] = getPos;
2822
- $[12] = node.nodeSize;
2823
- $[13] = t5;
2824
- } else t5 = $[13];
2825
- const handleFileSelect = t5;
2834
+ $[14] = editor;
2835
+ $[15] = getPos;
2836
+ $[16] = node.nodeSize;
2837
+ $[17] = t7;
2838
+ } else t7 = $[17];
2839
+ const handleFileSelect = t7;
2826
2840
  const isLoaded = status === IMAGE_UPLOAD_STATUSES.LOADED;
2827
- const t6 = editor.isEditable && isLoaded;
2828
- const t7 = editor.isEditable && isLoaded;
2829
- let t8;
2830
- if ($[14] !== editor.isEditable || $[15] !== setShouldShowDragHandles) {
2831
- t8 = () => setShouldShowDragHandles(editor.isEditable);
2832
- $[14] = editor.isEditable;
2833
- $[15] = setShouldShowDragHandles;
2834
- $[16] = t8;
2835
- } else t8 = $[16];
2836
- let t9;
2837
- if ($[17] !== setShouldShowDragHandles) {
2838
- t9 = () => setShouldShowDragHandles(false);
2839
- $[17] = setShouldShowDragHandles;
2840
- $[18] = t9;
2841
- } else t9 = $[18];
2841
+ const t8 = editor.isEditable && isLoaded;
2842
+ const t9 = editor.isEditable && isLoaded;
2842
2843
  let t10;
2843
- if ($[19] !== width) {
2844
- t10 = { width };
2845
- $[19] = width;
2844
+ if ($[18] !== editor.isEditable || $[19] !== setShouldShowDragHandles) {
2845
+ t10 = () => setShouldShowDragHandles(editor.isEditable);
2846
+ $[18] = editor.isEditable;
2847
+ $[19] = setShouldShowDragHandles;
2846
2848
  $[20] = t10;
2847
2849
  } else t10 = $[20];
2848
2850
  let t11;
2849
- if ($[21] !== isSrcVariable) {
2850
- t11 = isSrcVariable ? /* @__PURE__ */ jsx(ImageVariableState, {}) : null;
2851
- $[21] = isSrcVariable;
2851
+ if ($[21] !== setShouldShowDragHandles) {
2852
+ t11 = () => setShouldShowDragHandles(false);
2853
+ $[21] = setShouldShowDragHandles;
2852
2854
  $[22] = t11;
2853
2855
  } else t11 = $[22];
2854
2856
  let t12;
2855
- if ($[23] !== editor.isEditable || $[24] !== handleFileSelect || $[25] !== isSrcVariable || $[26] !== status) {
2856
- t12 = !isSrcVariable && status === IMAGE_UPLOAD_STATUSES.IDLE ? editor.isEditable ? /* @__PURE__ */ jsx(ImagePlaceholder, { onFileSelect: handleFileSelect }) : /* @__PURE__ */ jsx(ImageIdleState, {}) : null;
2857
- $[23] = editor.isEditable;
2858
- $[24] = handleFileSelect;
2859
- $[25] = isSrcVariable;
2860
- $[26] = status;
2861
- $[27] = t12;
2862
- } else t12 = $[27];
2857
+ if ($[23] !== width) {
2858
+ t12 = { width };
2859
+ $[23] = width;
2860
+ $[24] = t12;
2861
+ } else t12 = $[24];
2863
2862
  let t13;
2864
- if ($[28] !== alt || $[29] !== isSrcVariable || $[30] !== src || $[31] !== status) {
2865
- t13 = !isSrcVariable && status === IMAGE_UPLOAD_STATUSES.LOADING ? /* @__PURE__ */ jsx(ImageLoadingState, {
2863
+ if ($[25] !== isSrcVariable) {
2864
+ t13 = isSrcVariable ? /* @__PURE__ */ jsx(ImageVariableState, {}) : null;
2865
+ $[25] = isSrcVariable;
2866
+ $[26] = t13;
2867
+ } else t13 = $[26];
2868
+ let t14;
2869
+ if ($[27] !== editor.isEditable || $[28] !== handleFileSelect || $[29] !== isSrcVariable || $[30] !== status) {
2870
+ t14 = !isSrcVariable && status === IMAGE_UPLOAD_STATUSES.IDLE ? editor.isEditable ? /* @__PURE__ */ jsx(ImagePlaceholder, { onFileSelect: handleFileSelect }) : /* @__PURE__ */ jsx(ImageIdleState, {}) : null;
2871
+ $[27] = editor.isEditable;
2872
+ $[28] = handleFileSelect;
2873
+ $[29] = isSrcVariable;
2874
+ $[30] = status;
2875
+ $[31] = t14;
2876
+ } else t14 = $[31];
2877
+ let t15;
2878
+ if ($[32] !== alt || $[33] !== isSrcVariable || $[34] !== src || $[35] !== status) {
2879
+ t15 = !isSrcVariable && status === IMAGE_UPLOAD_STATUSES.LOADING ? /* @__PURE__ */ jsx(ImageLoadingState, {
2866
2880
  alt,
2867
2881
  src
2868
2882
  }) : null;
2869
- $[28] = alt;
2870
- $[29] = isSrcVariable;
2871
- $[30] = src;
2872
- $[31] = status;
2873
- $[32] = t13;
2874
- } else t13 = $[32];
2875
- let t14;
2876
- if ($[33] !== status) {
2877
- t14 = status === IMAGE_UPLOAD_STATUSES.ERROR ? /* @__PURE__ */ jsx(ImageErrorState, {}) : null;
2878
- $[33] = status;
2879
- $[34] = t14;
2880
- } else t14 = $[34];
2881
- let t15;
2882
- if ($[35] !== alt || $[36] !== editor.isEditable || $[37] !== handlePointerDown || $[38] !== isLoaded || $[39] !== isResizing || $[40] !== isSrcVariable || $[41] !== shouldShowDragHandles || $[42] !== src) {
2883
- t15 = !isSrcVariable && isLoaded ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("img", {
2883
+ $[32] = alt;
2884
+ $[33] = isSrcVariable;
2885
+ $[34] = src;
2886
+ $[35] = status;
2887
+ $[36] = t15;
2888
+ } else t15 = $[36];
2889
+ let t16;
2890
+ if ($[37] !== status) {
2891
+ t16 = status === IMAGE_UPLOAD_STATUSES.ERROR ? /* @__PURE__ */ jsx(ImageErrorState, {}) : null;
2892
+ $[37] = status;
2893
+ $[38] = t16;
2894
+ } else t16 = $[38];
2895
+ let t17;
2896
+ if ($[39] !== alt || $[40] !== authoredStyle || $[41] !== editor.isEditable || $[42] !== handlePointerDown || $[43] !== isLoaded || $[44] !== isResizing || $[45] !== isSrcVariable || $[46] !== shouldShowDragHandles || $[47] !== src) {
2897
+ t17 = !isSrcVariable && isLoaded ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("img", {
2884
2898
  alt: alt ?? void 0,
2885
2899
  contentEditable: false,
2886
2900
  "data-mly-image": "",
2887
2901
  draggable: editor.isEditable,
2888
- src
2902
+ src,
2903
+ style: authoredStyle
2889
2904
  }), shouldShowDragHandles || isResizing ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ImageHandle, {
2890
2905
  handle: "left",
2891
2906
  onPointerDown: (event_0) => handlePointerDown("left", event_0)
@@ -2893,61 +2908,62 @@ function ImageView(props) {
2893
2908
  handle: "right",
2894
2909
  onPointerDown: (event_1) => handlePointerDown("right", event_1)
2895
2910
  })] }) : null] }) : null;
2896
- $[35] = alt;
2897
- $[36] = editor.isEditable;
2898
- $[37] = handlePointerDown;
2899
- $[38] = isLoaded;
2900
- $[39] = isResizing;
2901
- $[40] = isSrcVariable;
2902
- $[41] = shouldShowDragHandles;
2903
- $[42] = src;
2904
- $[43] = t15;
2905
- } else t15 = $[43];
2906
- let t16;
2907
- if ($[44] !== align || $[45] !== imageWrapperRef || $[46] !== t10 || $[47] !== t11 || $[48] !== t12 || $[49] !== t13 || $[50] !== t14 || $[51] !== t15) {
2908
- t16 = /* @__PURE__ */ jsxs("div", {
2911
+ $[39] = alt;
2912
+ $[40] = authoredStyle;
2913
+ $[41] = editor.isEditable;
2914
+ $[42] = handlePointerDown;
2915
+ $[43] = isLoaded;
2916
+ $[44] = isResizing;
2917
+ $[45] = isSrcVariable;
2918
+ $[46] = shouldShowDragHandles;
2919
+ $[47] = src;
2920
+ $[48] = t17;
2921
+ } else t17 = $[48];
2922
+ let t18;
2923
+ if ($[49] !== align || $[50] !== imageWrapperRef || $[51] !== t12 || $[52] !== t13 || $[53] !== t14 || $[54] !== t15 || $[55] !== t16 || $[56] !== t17) {
2924
+ t18 = /* @__PURE__ */ jsxs("div", {
2909
2925
  "data-align": align,
2910
2926
  "data-mly-image-wrapper": "",
2911
2927
  ref: imageWrapperRef,
2912
- style: t10,
2928
+ style: t12,
2913
2929
  children: [
2914
- t11,
2915
- t12,
2916
2930
  t13,
2917
2931
  t14,
2918
- t15
2932
+ t15,
2933
+ t16,
2934
+ t17
2919
2935
  ]
2920
2936
  });
2921
- $[44] = align;
2922
- $[45] = imageWrapperRef;
2923
- $[46] = t10;
2924
- $[47] = t11;
2925
- $[48] = t12;
2926
- $[49] = t13;
2927
- $[50] = t14;
2928
- $[51] = t15;
2929
- $[52] = t16;
2930
- } else t16 = $[52];
2931
- let t17;
2932
- if ($[53] !== containerRef || $[54] !== t16 || $[55] !== t6 || $[56] !== t7 || $[57] !== t8 || $[58] !== t9) {
2933
- t17 = /* @__PURE__ */ jsx(NodeViewWrapper, {
2934
- "data-drag-handle": t6,
2937
+ $[49] = align;
2938
+ $[50] = imageWrapperRef;
2939
+ $[51] = t12;
2940
+ $[52] = t13;
2941
+ $[53] = t14;
2942
+ $[54] = t15;
2943
+ $[55] = t16;
2944
+ $[56] = t17;
2945
+ $[57] = t18;
2946
+ } else t18 = $[57];
2947
+ let t19;
2948
+ if ($[58] !== containerRef || $[59] !== t10 || $[60] !== t11 || $[61] !== t18 || $[62] !== t8 || $[63] !== t9) {
2949
+ t19 = /* @__PURE__ */ jsx(NodeViewWrapper, {
2950
+ "data-drag-handle": t8,
2935
2951
  "data-mly-image-view": "",
2936
- draggable: t7,
2937
- onMouseEnter: t8,
2938
- onMouseLeave: t9,
2952
+ draggable: t9,
2953
+ onMouseEnter: t10,
2954
+ onMouseLeave: t11,
2939
2955
  ref: containerRef,
2940
- children: t16
2956
+ children: t18
2941
2957
  });
2942
- $[53] = containerRef;
2943
- $[54] = t16;
2944
- $[55] = t6;
2945
- $[56] = t7;
2946
- $[57] = t8;
2947
- $[58] = t9;
2948
- $[59] = t17;
2949
- } else t17 = $[59];
2950
- return t17;
2958
+ $[58] = containerRef;
2959
+ $[59] = t10;
2960
+ $[60] = t11;
2961
+ $[61] = t18;
2962
+ $[62] = t8;
2963
+ $[63] = t9;
2964
+ $[64] = t19;
2965
+ } else t19 = $[64];
2966
+ return t19;
2951
2967
  }
2952
2968
  //#endregion
2953
2969
  //#region src/extensions/image/image.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maily-to/core",
3
- "version": "2.0.0-beta.8",
3
+ "version": "2.0.0-beta.9",
4
4
  "private": false,
5
5
  "description": "Powerful editor for creating beautiful, pre-designed, mobile-ready emails.",
6
6
  "keywords": [
@@ -87,7 +87,7 @@
87
87
  "lucide-react": "^1.28.0",
88
88
  "unit-field": "^0.0.3",
89
89
  "zustand": "^5.0.14",
90
- "@maily-to/shared": "2.0.0-beta.8"
90
+ "@maily-to/shared": "2.0.0-beta.9"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@react-email/components": "^1.0.12",
@@ -109,9 +109,9 @@
109
109
  "yjs": "^13.6.33",
110
110
  "@maily-to/extension-ai-actions": "0.0.1",
111
111
  "@maily-to/extension-inline-suggestion": "0.0.1",
112
+ "@maily-to/tsconfig": "0.0.0",
112
113
  "@maily-to/extension-variable": "0.0.1",
113
- "@maily-to/render": "2.0.0-beta.8",
114
- "@maily-to/tsconfig": "0.0.0"
114
+ "@maily-to/render": "2.0.0-beta.9"
115
115
  },
116
116
  "peerDependencies": {
117
117
  "@tiptap/core": "^3.29.2",