@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.cjs
CHANGED
|
@@ -5648,7 +5648,8 @@ function ImageView(props) {
|
|
|
5648
5648
|
newHeight = IMAGE_MAX_HEIGHT;
|
|
5649
5649
|
}
|
|
5650
5650
|
if (node.attrs.lockAspectRatio) {
|
|
5651
|
-
|
|
5651
|
+
const aspectRatio = node.attrs.aspectRatio && isFinite(node.attrs.aspectRatio) && node.attrs.aspectRatio > 0 ? node.attrs.aspectRatio : currentWidth / currentHeight;
|
|
5652
|
+
newHeight = getNewHeight(newWidth, aspectRatio);
|
|
5652
5653
|
}
|
|
5653
5654
|
setResizingStyle({ width: newWidth, height: newHeight });
|
|
5654
5655
|
if (!event2.buttons) {
|
|
@@ -5824,8 +5825,8 @@ function ImageView(props) {
|
|
|
5824
5825
|
"data-drag-handle": editor.isEditable,
|
|
5825
5826
|
className: cn("mly-image-drop-zone", isDraggingOver && "mly-drag-over"),
|
|
5826
5827
|
style: __spreadValues(__spreadProps(__spreadValues({}, hasImageSrc && status === "loaded" ? __spreadValues({
|
|
5827
|
-
width: width ? `${width}px` : void 0,
|
|
5828
|
-
height: height ? `${height}px` : void 0
|
|
5828
|
+
width: width && width !== "auto" ? `${width}px` : void 0,
|
|
5829
|
+
height: height && height !== "auto" ? `${height}px` : void 0
|
|
5829
5830
|
}, resizingStyle) : {}), {
|
|
5830
5831
|
overflow: "hidden",
|
|
5831
5832
|
position: "relative",
|
|
@@ -5877,8 +5878,8 @@ function ImageView(props) {
|
|
|
5877
5878
|
objectFit: "fill",
|
|
5878
5879
|
marginBottom: 0,
|
|
5879
5880
|
borderRadius: borderRadius2,
|
|
5880
|
-
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width ? `${width}px` : "auto",
|
|
5881
|
-
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height ? `${height}px` : "auto"
|
|
5881
|
+
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width && width !== "auto" ? `${width}px` : "auto",
|
|
5882
|
+
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height && height !== "auto" ? `${height}px` : "auto"
|
|
5882
5883
|
}),
|
|
5883
5884
|
draggable: editor.isEditable,
|
|
5884
5885
|
className: cn(
|
|
@@ -7998,10 +7999,13 @@ function ImageBubbleMenu(props) {
|
|
|
7998
7999
|
const width = Math.min(Number(value) || 0, IMAGE_MAX_WIDTH);
|
|
7999
8000
|
const currentHeight = Number(state.height) || 0;
|
|
8000
8001
|
const currentWidth = Number(state.width) || 0;
|
|
8001
|
-
const
|
|
8002
|
+
const hasValidAspectRatio = state.aspectRatio && isFinite(state.aspectRatio) && state.aspectRatio > 0;
|
|
8003
|
+
const currentAspectRatio = hasValidAspectRatio ? state.aspectRatio : currentHeight > 0 ? currentWidth / currentHeight : 1;
|
|
8004
|
+
const isHeightAuto = !state.height || state.height === "auto";
|
|
8005
|
+
const shouldUpdateHeight = (lockAspectRatio || isHeightAuto) && value && (hasValidAspectRatio || currentHeight > 0);
|
|
8002
8006
|
editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
|
|
8003
8007
|
width: String(width)
|
|
8004
|
-
},
|
|
8008
|
+
}, shouldUpdateHeight ? {
|
|
8005
8009
|
height: String(
|
|
8006
8010
|
getNewHeight(width, currentAspectRatio)
|
|
8007
8011
|
)
|
|
@@ -8018,10 +8022,13 @@ function ImageBubbleMenu(props) {
|
|
|
8018
8022
|
const height = Number(value) || 0;
|
|
8019
8023
|
const currentHeight = Number(state.height) || 0;
|
|
8020
8024
|
const currentWidth = Number(state.width) || 0;
|
|
8021
|
-
const
|
|
8025
|
+
const hasValidAspectRatio = state.aspectRatio && isFinite(state.aspectRatio) && state.aspectRatio > 0;
|
|
8026
|
+
const currentAspectRatio = hasValidAspectRatio ? state.aspectRatio : currentHeight > 0 ? currentWidth / currentHeight : 1;
|
|
8027
|
+
const isWidthAuto = !state.width || state.width === "auto";
|
|
8028
|
+
const shouldUpdateWidth = (lockAspectRatio || isWidthAuto) && value && (hasValidAspectRatio || currentWidth > 0);
|
|
8022
8029
|
editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
|
|
8023
8030
|
height: String(height)
|
|
8024
|
-
},
|
|
8031
|
+
}, shouldUpdateWidth ? {
|
|
8025
8032
|
width: String(
|
|
8026
8033
|
getNewWidth(height, currentAspectRatio)
|
|
8027
8034
|
)
|
|
@@ -8147,8 +8154,8 @@ var InlineImageExtension = import_core8.Node.create({
|
|
|
8147
8154
|
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
8148
8155
|
const attrs = (0, import_core8.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes2, {
|
|
8149
8156
|
"data-type": this.name,
|
|
8150
|
-
class: "mly:
|
|
8151
|
-
style:
|
|
8157
|
+
class: "mly:relative",
|
|
8158
|
+
style: `display: inline; --mly-inline-image-height: ${HTMLAttributes2.height}px; --mly-inline-image-width: ${HTMLAttributes2.width}px; margin:0; vertical-align: middle;`,
|
|
8152
8159
|
draggable: "false",
|
|
8153
8160
|
loading: "lazy"
|
|
8154
8161
|
});
|