@flozy/editor 10.0.6 → 10.0.8

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.
@@ -21,6 +21,7 @@ import { FORM_NODE } from "../../utils/form";
21
21
  import { DEFAULT_TABLE_NODE } from "../../utils/table";
22
22
  import itemOptions from "./Options/sectionItemOptions";
23
23
  import { getBreakPointsValue, groupByBreakpoint } from "../../helper/theme";
24
+ import { useDebouncedCallback } from "use-debounce";
24
25
  import { jsx as _jsx } from "react/jsx-runtime";
25
26
  import { jsxs as _jsxs } from "react/jsx-runtime";
26
27
  const MAX_DEVICE_WIDTH = {
@@ -75,6 +76,9 @@ const FreeGrid = props => {
75
76
  const count = useRef(2);
76
77
  const childrenCountRef = useRef(element?.children?.length);
77
78
  const [isInteracting, setIsInteracting] = useState(false);
79
+ const debouncedStopInteraction = useDebouncedCallback(() => {
80
+ setIsInteracting(false);
81
+ }, 500);
78
82
  const onChange = data => {
79
83
  const append = breakpoint === "lg" ? "" : `_${breakpoint}`;
80
84
  const updateData = {
@@ -490,7 +494,11 @@ const FreeGrid = props => {
490
494
  return /*#__PURE__*/_jsx(FreeGridContext.Provider, {
491
495
  value: {
492
496
  isInteracting,
493
- setIsInteracting
497
+ handleStart: () => {
498
+ setIsInteracting(true);
499
+ debouncedStopInteraction.cancel();
500
+ },
501
+ handleStop: debouncedStopInteraction
494
502
  },
495
503
  children: /*#__PURE__*/_jsx(RnD, {
496
504
  id: `freegrid_container_${path.join("|")}_${updated_at}_${breakpoint}`,
@@ -61,7 +61,7 @@ const FreeGridItem = props => {
61
61
  const onChangeSettings = () => {};
62
62
  // const refInput = useRef();
63
63
  // const [virtualHeight, setVirtualHeight] = useState(height || 0);
64
-
64
+ const xsHidden = element?.children?.some(c => c.xsHidden);
65
65
  const onChange = data => {
66
66
  let updateData = {
67
67
  ...data
@@ -268,7 +268,7 @@ const FreeGridItem = props => {
268
268
  }, [element]);
269
269
  return /*#__PURE__*/_jsx(RnD, {
270
270
  id: `freegrid_item_${path.join("|")}_${updated_at}_${breakpoint}`,
271
- className: `freegrid-item path-${path.length} breakpoint-${breakpoint}`,
271
+ className: `freegrid-item path-${path.length} breakpoint-${breakpoint} ${xsHidden ? "xs-hidden" : ""}`,
272
272
  editor: editor,
273
273
  path: path,
274
274
  actions: itemTypeOptions,
@@ -47,9 +47,6 @@ const useFreeGridStyles = ({
47
47
  "&.type_text": {
48
48
  // minHeight: "fit-content !important",
49
49
  // wordBreak: "break-all",
50
- "& .placeholder-simple-text": {
51
- display: "none"
52
- }
53
50
  },
54
51
  "&.enable-1, &.enable-2": {
55
52
  "&.type_text": {
@@ -327,6 +324,12 @@ const useFreeGridStyles = ({
327
324
  },
328
325
  [theme?.breakpoints?.between("xs", "md")]: {
329
326
  marginLeft: `calc((100% - 320px) * 0.5)`
327
+ },
328
+ "&.xs-hidden": {
329
+ display: {
330
+ xs: "none !important",
331
+ lg: "inline-block !important"
332
+ }
330
333
  }
331
334
  },
332
335
  "&.rnd-dragOver": {
@@ -45,6 +45,12 @@ const useVirtualElementStyles = () => ({
45
45
  },
46
46
  "& .embed": {
47
47
  minHeight: "300px"
48
+ },
49
+ "&.xs-hidden": {
50
+ display: {
51
+ xs: "none !important",
52
+ lg: "inline-block !important"
53
+ }
48
54
  }
49
55
  }
50
56
  }
@@ -144,6 +150,12 @@ export const useAutoAlignStyles = () => ({
144
150
  },
145
151
  "& .embed": {
146
152
  minHeight: "300px"
153
+ },
154
+ "&.xs-hidden": {
155
+ display: {
156
+ xs: "none !important",
157
+ lg: "inline-block !important"
158
+ }
147
159
  }
148
160
  },
149
161
  "& .appHeaderBox, &.header-box-mobile-virtual-mode": {
@@ -125,7 +125,8 @@ const RnD = props => {
125
125
  } = useAutoScroll(10, "slate-wrapper-scroll-container");
126
126
  const {
127
127
  isInteracting,
128
- setIsInteracting
128
+ handleStart,
129
+ handleStop
129
130
  } = useFreeGrid();
130
131
  const {
131
132
  translation
@@ -323,7 +324,7 @@ const RnD = props => {
323
324
  };
324
325
  const onDragStart = e => {
325
326
  e.preventDefault();
326
- setIsInteracting(true);
327
+ handleStart();
327
328
  if (e?.target?.dataset?.path?.split(",").join("|") === sp) {
328
329
  const {
329
330
  left,
@@ -425,7 +426,7 @@ const RnD = props => {
425
426
  e.preventDefault();
426
427
  e.stopPropagation();
427
428
  stopAutoScroll();
428
- setIsInteracting(false);
429
+ handleStop();
429
430
  if (dragging?.isDragging === 2 && dragging?.position?.strXY && dragging?.dragOver) {
430
431
  d.x = e.x;
431
432
  d.y = e.y;
@@ -468,7 +469,7 @@ const RnD = props => {
468
469
  };
469
470
  const onResizeStop = (e, direction, ref, d, position) => {
470
471
  e.preventDefault();
471
- setIsInteracting(false);
472
+ handleStop();
472
473
  let updatedPosition = {};
473
474
  if (type !== "parent") {
474
475
  // update element position while resizing, (for free grid box and item)
@@ -557,7 +558,7 @@ const RnD = props => {
557
558
  return {
558
559
  onResizeStart: e => {
559
560
  e.preventDefault();
560
- setIsInteracting(true);
561
+ handleStart();
561
562
  },
562
563
  onDragStart: onDragStart,
563
564
  onDrag: onDrag,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "10.0.6",
3
+ "version": "10.0.8",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"