@maily-to/core 0.3.4 → 0.3.5
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/extensions/index.cjs +6 -5
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.mjs +6 -5
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.cjs +18 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +18 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/LICENSE +0 -21
package/dist/index.mjs
CHANGED
|
@@ -5643,7 +5643,8 @@ function ImageView(props) {
|
|
|
5643
5643
|
newHeight = IMAGE_MAX_HEIGHT;
|
|
5644
5644
|
}
|
|
5645
5645
|
if (node.attrs.lockAspectRatio) {
|
|
5646
|
-
|
|
5646
|
+
const aspectRatio = node.attrs.aspectRatio && isFinite(node.attrs.aspectRatio) && node.attrs.aspectRatio > 0 ? node.attrs.aspectRatio : currentWidth / currentHeight;
|
|
5647
|
+
newHeight = getNewHeight(newWidth, aspectRatio);
|
|
5647
5648
|
}
|
|
5648
5649
|
setResizingStyle({ width: newWidth, height: newHeight });
|
|
5649
5650
|
if (!event2.buttons) {
|
|
@@ -5819,8 +5820,8 @@ function ImageView(props) {
|
|
|
5819
5820
|
"data-drag-handle": editor.isEditable,
|
|
5820
5821
|
className: cn("mly-image-drop-zone", isDraggingOver && "mly-drag-over"),
|
|
5821
5822
|
style: __spreadValues(__spreadProps(__spreadValues({}, hasImageSrc && status === "loaded" ? __spreadValues({
|
|
5822
|
-
width: width ? `${width}px` : void 0,
|
|
5823
|
-
height: height ? `${height}px` : void 0
|
|
5823
|
+
width: width && width !== "auto" ? `${width}px` : void 0,
|
|
5824
|
+
height: height && height !== "auto" ? `${height}px` : void 0
|
|
5824
5825
|
}, resizingStyle) : {}), {
|
|
5825
5826
|
overflow: "hidden",
|
|
5826
5827
|
position: "relative",
|
|
@@ -5872,8 +5873,8 @@ function ImageView(props) {
|
|
|
5872
5873
|
objectFit: "fill",
|
|
5873
5874
|
marginBottom: 0,
|
|
5874
5875
|
borderRadius: borderRadius2,
|
|
5875
|
-
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width ? `${width}px` : "auto",
|
|
5876
|
-
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height ? `${height}px` : "auto"
|
|
5876
|
+
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width && width !== "auto" ? `${width}px` : "auto",
|
|
5877
|
+
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height && height !== "auto" ? `${height}px` : "auto"
|
|
5877
5878
|
}),
|
|
5878
5879
|
draggable: editor.isEditable,
|
|
5879
5880
|
className: cn(
|
|
@@ -8023,10 +8024,13 @@ function ImageBubbleMenu(props) {
|
|
|
8023
8024
|
const width = Math.min(Number(value) || 0, IMAGE_MAX_WIDTH);
|
|
8024
8025
|
const currentHeight = Number(state.height) || 0;
|
|
8025
8026
|
const currentWidth = Number(state.width) || 0;
|
|
8026
|
-
const
|
|
8027
|
+
const hasValidAspectRatio = state.aspectRatio && isFinite(state.aspectRatio) && state.aspectRatio > 0;
|
|
8028
|
+
const currentAspectRatio = hasValidAspectRatio ? state.aspectRatio : currentHeight > 0 ? currentWidth / currentHeight : 1;
|
|
8029
|
+
const isHeightAuto = !state.height || state.height === "auto";
|
|
8030
|
+
const shouldUpdateHeight = (lockAspectRatio || isHeightAuto) && value && (hasValidAspectRatio || currentHeight > 0);
|
|
8027
8031
|
editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
|
|
8028
8032
|
width: String(width)
|
|
8029
|
-
},
|
|
8033
|
+
}, shouldUpdateHeight ? {
|
|
8030
8034
|
height: String(
|
|
8031
8035
|
getNewHeight(width, currentAspectRatio)
|
|
8032
8036
|
)
|
|
@@ -8043,10 +8047,13 @@ function ImageBubbleMenu(props) {
|
|
|
8043
8047
|
const height = Number(value) || 0;
|
|
8044
8048
|
const currentHeight = Number(state.height) || 0;
|
|
8045
8049
|
const currentWidth = Number(state.width) || 0;
|
|
8046
|
-
const
|
|
8050
|
+
const hasValidAspectRatio = state.aspectRatio && isFinite(state.aspectRatio) && state.aspectRatio > 0;
|
|
8051
|
+
const currentAspectRatio = hasValidAspectRatio ? state.aspectRatio : currentHeight > 0 ? currentWidth / currentHeight : 1;
|
|
8052
|
+
const isWidthAuto = !state.width || state.width === "auto";
|
|
8053
|
+
const shouldUpdateWidth = (lockAspectRatio || isWidthAuto) && value && (hasValidAspectRatio || currentWidth > 0);
|
|
8047
8054
|
editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
|
|
8048
8055
|
height: String(height)
|
|
8049
|
-
},
|
|
8056
|
+
}, shouldUpdateWidth ? {
|
|
8050
8057
|
width: String(
|
|
8051
8058
|
getNewWidth(height, currentAspectRatio)
|
|
8052
8059
|
)
|
|
@@ -8172,8 +8179,8 @@ var InlineImageExtension = Node5.create({
|
|
|
8172
8179
|
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
8173
8180
|
const attrs = mergeAttributes4(this.options.HTMLAttributes, HTMLAttributes2, {
|
|
8174
8181
|
"data-type": this.name,
|
|
8175
|
-
class: "mly:
|
|
8176
|
-
style:
|
|
8182
|
+
class: "mly:relative",
|
|
8183
|
+
style: `display: inline; --mly-inline-image-height: ${HTMLAttributes2.height}px; --mly-inline-image-width: ${HTMLAttributes2.width}px; margin:0; vertical-align: middle;`,
|
|
8177
8184
|
draggable: "false",
|
|
8178
8185
|
loading: "lazy"
|
|
8179
8186
|
});
|