@flozy/editor 9.8.0 → 9.8.1
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.
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useState } from "react";
|
1
|
+
import React, { useMemo, useState } from "react";
|
2
2
|
import { Transforms, Node, Path } from "slate";
|
3
3
|
import { useSlateStatic } from "slate-react";
|
4
4
|
import { ReactEditor } from "slate-react";
|
@@ -250,6 +250,22 @@ const FreeGridItem = props => {
|
|
250
250
|
}
|
251
251
|
};
|
252
252
|
const itemTypeOptions = (itemOptions[childType] || itemOptions?.default).filter(f => (hideTools || []).indexOf(f) === -1);
|
253
|
+
const variableStyle = useMemo(() => {
|
254
|
+
const {
|
255
|
+
width,
|
256
|
+
height
|
257
|
+
} = element || {};
|
258
|
+
let widthVar = width_xs;
|
259
|
+
let heightVar = height_xs;
|
260
|
+
if (element?.childType === "image") {
|
261
|
+
widthVar = width_xs || width;
|
262
|
+
heightVar = height_xs || height;
|
263
|
+
}
|
264
|
+
return {
|
265
|
+
"--width_xs": widthVar ? `${widthVar}px` : "auto",
|
266
|
+
"--height_xs": heightVar ? `${heightVar}px` : "auto"
|
267
|
+
};
|
268
|
+
}, [element]);
|
253
269
|
return /*#__PURE__*/_jsx(RnD, {
|
254
270
|
id: `freegrid_item_${path.join("|")}_${updated_at}_${breakpoint}`,
|
255
271
|
className: `freegrid-item path-${path.length} breakpoint-${breakpoint}`,
|
@@ -270,9 +286,8 @@ const FreeGridItem = props => {
|
|
270
286
|
"--width": `${width}px`,
|
271
287
|
"--height": `${height}px`,
|
272
288
|
"--zIndex": 100 + arrangeIndex,
|
273
|
-
"--
|
274
|
-
|
275
|
-
"--marginTop_xs": marginTop_xs ? `${marginTop_xs}px` : "0px"
|
289
|
+
"--marginTop_xs": marginTop_xs ? `${marginTop_xs}px` : "0px",
|
290
|
+
...variableStyle
|
276
291
|
// "--gridArea_xs": gridArea_xs ? gridArea_xs : "unset",
|
277
292
|
},
|
278
293
|
|
@@ -345,6 +345,12 @@ export const sortElements = (items, container) => {
|
|
345
345
|
return aRow - bRow; // Sort by start row first
|
346
346
|
}
|
347
347
|
|
348
|
+
// Compare marginTopXs
|
349
|
+
const aMarginTop = parseFloat(a.dataset.marginTopXs) || 0;
|
350
|
+
const bMarginTop = parseFloat(b.dataset.marginTopXs) || 0;
|
351
|
+
if (aMarginTop !== bMarginTop) {
|
352
|
+
return aMarginTop - bMarginTop;
|
353
|
+
}
|
348
354
|
const aLeft = parseFloat(a.dataset.leftXs) || 0;
|
349
355
|
const bLeft = parseFloat(b.dataset.leftXs) || 0;
|
350
356
|
return aLeft - bLeft;
|
@@ -30,6 +30,10 @@ const useVirtualElementStyles = () => ({
|
|
30
30
|
"&.type_text": {
|
31
31
|
height: "auto !important"
|
32
32
|
},
|
33
|
+
"&.type_image": {
|
34
|
+
width: "calc(--width_xs) !important",
|
35
|
+
height: "var(--height_xs) !important"
|
36
|
+
},
|
33
37
|
// "&.type_box": {
|
34
38
|
// // display: "grid !important",
|
35
39
|
// // gridTemplateRows: "repeat(auto-fill, 50px) !important",
|
@@ -19,7 +19,7 @@ import { removeSign } from "./ElementSettings/OtherSettings";
|
|
19
19
|
import useDragging from "../../hooks/useDragging";
|
20
20
|
import { dragOverOn } from "../../helper/RnD/focusNode";
|
21
21
|
import { focusSelection, clearSelection, clearSelectionOnly } from "../../helper";
|
22
|
-
import { reRenderChildNodes } from "./Utils/gridDropItem";
|
22
|
+
// import { reRenderChildNodes } from "./Utils/gridDropItem";
|
23
23
|
import VirtualTextElement from "./VirtualElement/VirtualTextElement";
|
24
24
|
import useAutoScroll from "../../hooks/useAutoScroll";
|
25
25
|
import ForceAutoAlignment from "./VirtualElement/ForceAutoAlignment";
|
@@ -485,12 +485,17 @@ const RnD = props => {
|
|
485
485
|
...updatedSize
|
486
486
|
});
|
487
487
|
handleResizeEvent("stop");
|
488
|
-
|
489
|
-
|
490
|
-
},
|
491
|
-
|
492
|
-
|
488
|
+
|
489
|
+
// const parentPath = getParentSectionPath(
|
490
|
+
// { ref },
|
491
|
+
// ".freegrid-container-parent"
|
492
|
+
// );
|
493
|
+
|
494
|
+
// const formatParentPath = parentPath?.split("|")?.map((m) => parseInt(m));
|
495
|
+
|
496
|
+
// reRenderChildNodes(editor, formatParentPath);
|
493
497
|
};
|
498
|
+
|
494
499
|
const onCloseSettings = () => {
|
495
500
|
setSelectedElement({
|
496
501
|
...selectedElementProps,
|