@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.
- package/dist/blocks/index.cjs +1 -1
- package/dist/extensions/index.cjs +46 -15
- package/dist/extensions/index.mjs +1 -1
- package/dist/index.cjs +8137 -2944
- package/dist/index.mjs +1 -1
- package/dist/{use-maily-editor-BP6Mt8Nn.cjs → use-maily-editor-Atvy2kSO.cjs} +4 -2
- package/dist/{use-maily-editor-DFuhg38t.cjs → use-maily-editor-CByaDhmT.cjs} +148 -132
- package/dist/{use-maily-editor-xVILP7H8.mjs → use-maily-editor-idL0RNsG.mjs} +148 -132
- package/package.json +4 -4
|
@@ -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(
|
|
2766
|
+
const $ = c(65);
|
|
2767
2767
|
const { editor, getPos, node, updateAttributes } = props;
|
|
2768
|
-
const { align, alt, src, width } = node.attrs;
|
|
2769
|
-
|
|
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 ($[
|
|
2779
|
-
t1 = (
|
|
2780
|
-
$[
|
|
2781
|
-
$[
|
|
2782
|
-
} else t1 = $[
|
|
2783
|
-
|
|
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 ($[
|
|
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:
|
|
2802
|
+
onWidthCommitted: t4
|
|
2789
2803
|
};
|
|
2790
|
-
$[
|
|
2791
|
-
$[
|
|
2792
|
-
$[
|
|
2793
|
-
} else
|
|
2794
|
-
const { containerRef, handleResize, imageWrapperRef, isResizing, setShouldShowDragHandles, shouldShowDragHandles } = useImageResizeController(
|
|
2795
|
-
let
|
|
2796
|
-
if ($[
|
|
2797
|
-
|
|
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
|
-
$[
|
|
2808
|
-
$[
|
|
2809
|
-
$[
|
|
2810
|
-
} else
|
|
2811
|
-
const handlePointerDown =
|
|
2812
|
-
let
|
|
2813
|
-
if ($[
|
|
2814
|
-
|
|
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
|
-
$[
|
|
2821
|
-
$[
|
|
2822
|
-
$[
|
|
2823
|
-
$[
|
|
2824
|
-
} else
|
|
2825
|
-
const handleFileSelect =
|
|
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
|
|
2828
|
-
const
|
|
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] !==
|
|
2844
|
-
t10 =
|
|
2845
|
-
$[
|
|
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] !==
|
|
2850
|
-
t11 =
|
|
2851
|
-
$[21] =
|
|
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] !==
|
|
2856
|
-
t12 =
|
|
2857
|
-
$[23] =
|
|
2858
|
-
$[24] =
|
|
2859
|
-
|
|
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 ($[
|
|
2865
|
-
t13 =
|
|
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
|
-
$[
|
|
2870
|
-
$[
|
|
2871
|
-
$[
|
|
2872
|
-
$[
|
|
2873
|
-
$[
|
|
2874
|
-
} else
|
|
2875
|
-
let
|
|
2876
|
-
if ($[
|
|
2877
|
-
|
|
2878
|
-
$[
|
|
2879
|
-
$[
|
|
2880
|
-
} else
|
|
2881
|
-
let
|
|
2882
|
-
if ($[
|
|
2883
|
-
|
|
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
|
-
$[
|
|
2897
|
-
$[
|
|
2898
|
-
$[
|
|
2899
|
-
$[
|
|
2900
|
-
$[
|
|
2901
|
-
$[
|
|
2902
|
-
$[
|
|
2903
|
-
$[
|
|
2904
|
-
$[
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
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:
|
|
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
|
-
$[
|
|
2922
|
-
$[
|
|
2923
|
-
$[
|
|
2924
|
-
$[
|
|
2925
|
-
$[
|
|
2926
|
-
$[
|
|
2927
|
-
$[
|
|
2928
|
-
$[
|
|
2929
|
-
$[
|
|
2930
|
-
} else
|
|
2931
|
-
let
|
|
2932
|
-
if ($[
|
|
2933
|
-
|
|
2934
|
-
"data-drag-handle":
|
|
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:
|
|
2937
|
-
onMouseEnter:
|
|
2938
|
-
onMouseLeave:
|
|
2952
|
+
draggable: t9,
|
|
2953
|
+
onMouseEnter: t10,
|
|
2954
|
+
onMouseLeave: t11,
|
|
2939
2955
|
ref: containerRef,
|
|
2940
|
-
children:
|
|
2956
|
+
children: t18
|
|
2941
2957
|
});
|
|
2942
|
-
$[
|
|
2943
|
-
$[
|
|
2944
|
-
$[
|
|
2945
|
-
$[
|
|
2946
|
-
$[
|
|
2947
|
-
$[
|
|
2948
|
-
$[
|
|
2949
|
-
} else
|
|
2950
|
-
return
|
|
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.
|
|
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.
|
|
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.
|
|
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",
|