@flozy/editor 10.3.3 → 10.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.
@@ -159,7 +159,8 @@ const Form = props => {
159
159
  [pair[0]]: pair[1],
160
160
  placeholder: placeholder,
161
161
  form_name: formName,
162
- tagName: tagName
162
+ tagName: tagName,
163
+ uid: fieldData?.uid
163
164
  });
164
165
  }
165
166
  let params = {
@@ -414,6 +415,7 @@ const Form = props => {
414
415
  lineHeight: 1.43,
415
416
  ...formSX
416
417
  },
418
+ ref: formEle,
417
419
  children: [/*#__PURE__*/_jsx(Grid, {
418
420
  className: "form-grid",
419
421
  item: true,
@@ -320,6 +320,7 @@ const FreeGridItem = props => {
320
320
  breakpoint: breakpoint,
321
321
  customProps: customProps,
322
322
  translation: translation,
323
+ xsHidden: xsHidden,
323
324
  children: /*#__PURE__*/_jsxs(Box, {
324
325
  component: "div",
325
326
  ...attributes,
@@ -1,5 +1,6 @@
1
1
  import { ROW_HEIGHT } from "../../common/RnD/Utils/gridDropItem";
2
2
  import { getElementOffset } from "../../common/RnD/VirtualElement/VirtualTextElement";
3
+ import { RND_ITEMS } from "../../helper";
3
4
  export const ELEMENT_CASE = {
4
5
  ADD_TEXT: "addText",
5
6
  ADD_BUTTON: "addButton",
@@ -69,7 +70,8 @@ const elementXsValues = {
69
70
  export const findMaxYValue = (sectionItems, breakpoint) => {
70
71
  let maxY = 0;
71
72
  sectionItems.forEach(item => {
72
- if (item?.type && item?.type !== "paragraph") {
73
+ const isHidden = breakpoint === "xs" && item.children.some(c => c.xsHidden);
74
+ if (item?.type && RND_ITEMS.includes(item.type) && !isHidden) {
73
75
  const {
74
76
  bottom
75
77
  } = getElementOffset(item, breakpoint === "lg" ? "lg" : "xs");
@@ -3,6 +3,7 @@ import { Transforms, Editor } from "slate";
3
3
  import { getElementOffset } from "./VirtualTextElement";
4
4
  import { getNode } from "../../../utils/helper";
5
5
  import { findMaxYValue } from "../../../Elements/FreeGrid/helper";
6
+ import { RND_ITEMS } from "../../../helper";
6
7
  const isBulletOrTickIcon = (width, itemStartRow, startRow) => {
7
8
  return width <= 40 && itemStartRow === startRow;
8
9
  };
@@ -223,8 +224,7 @@ export const moveOverlappedItems = (editor, moveRows, containerItems, containerP
223
224
  if (isChildEle) {
224
225
  return;
225
226
  }
226
- if (gridItem.type === "paragraph") {
227
- // some empty paragraph node is inserted default'ly inside box, to avoid that
227
+ if (!RND_ITEMS.includes(gridItem.type)) {
228
228
  return;
229
229
  }
230
230
  const {
@@ -251,7 +251,7 @@ export const causeOverlap = (container, currElementPath, updateBreakpoint, newTo
251
251
  const [containerNode, containerPath] = container;
252
252
  let isOverlapped = false;
253
253
  containerNode.children.forEach((item, index) => {
254
- if (item.type === "paragraph") {
254
+ if (!RND_ITEMS.includes(item.type)) {
255
255
  return;
256
256
  }
257
257
  const currPath = [...containerPath, index];
@@ -286,7 +286,7 @@ export const alignElementsInsideContainer = (container, currentElement, heightDi
286
286
 
287
287
  // find the elements present after the current element
288
288
  containerNode.children.forEach((item, index) => {
289
- if (item.type === "paragraph") {
289
+ if (!RND_ITEMS.includes(item.type)) {
290
290
  return;
291
291
  }
292
292
  const currPath = [...containerPath, index];
@@ -378,6 +378,7 @@ export const updateContainer = (editor, alignElements, container, updateBreakpoi
378
378
  }, {
379
379
  at: containerPath
380
380
  });
381
+ currHeightDiff += 12;
381
382
  }
382
383
  return currHeightDiff;
383
384
  };
@@ -396,7 +397,7 @@ export const handleContainersAlignment = (editor, containers, heightDiff, buffer
396
397
  if (currPath.toString() === childContainerPath.toString()) {
397
398
  return;
398
399
  }
399
- if (item.type === "paragraph") {
400
+ if (!RND_ITEMS.includes(item.type)) {
400
401
  return;
401
402
  }
402
403
  const {
@@ -77,7 +77,8 @@ const RnD = props => {
77
77
  autoAlign,
78
78
  setAutoAlign,
79
79
  isBoxHeader,
80
- customProps
80
+ customProps,
81
+ xsHidden
81
82
  } = props;
82
83
  const {
83
84
  isSelectedElement,
@@ -141,7 +142,8 @@ const RnD = props => {
141
142
  setAbsPosition({});
142
143
  }
143
144
  }
144
- const textElement = getCurrentEle()?.querySelector(".fgi_type_text > .simple-text");
145
+ const currElement = getCurrentEle();
146
+ const textElement = currElement?.querySelector(".fgi_type_text > .simple-text, .fgi_type_text");
145
147
  if (breakpoint && textElement && childType === "text" && !enable) {
146
148
  timerId.current = setTimeout(() => {
147
149
  const {
@@ -653,32 +655,34 @@ const RnD = props => {
653
655
  "data-dragoverid": str_path,
654
656
  "data-dragovertype": type
655
657
  }) : null]
656
- }, eId), !active && rndRef?.current && open && !isInteracting ? /*#__PURE__*/_jsx(ElementOptions, {
657
- id: `opt_ref_${str_path}`,
658
- open: open,
659
- anchorEl: rndRef?.current,
660
- enable: enable,
661
- handleAction: handleAction,
662
- actions: actions,
663
- actionsMap: actionsMap,
664
- optionsProps: optionsProps,
665
- selectedAction: currentAction,
666
- path: str_path,
667
- theme: theme,
668
- translation: translation,
669
- customProps: customProps
670
- }) : null, /*#__PURE__*/_jsx(ElementSettings, {
671
- open: Boolean(currentAction),
672
- currentAction: currentAction,
673
- anchorEl: rndRef?.current,
674
- placement: "right-start",
675
- onClose: onCloseSettings,
676
- childType: childType,
677
- editor: editor,
678
- path: sp,
679
- ...settingsProps,
680
- elementProps: elementProps,
681
- theme: theme
658
+ }, eId), xsHidden && breakpoint === "xs" ? null : /*#__PURE__*/_jsxs(_Fragment, {
659
+ children: [/*#__PURE__*/_jsx(ElementSettings, {
660
+ open: Boolean(currentAction),
661
+ currentAction: currentAction,
662
+ anchorEl: rndRef?.current,
663
+ placement: "right-start",
664
+ onClose: onCloseSettings,
665
+ childType: childType,
666
+ editor: editor,
667
+ path: sp,
668
+ ...settingsProps,
669
+ elementProps: elementProps,
670
+ theme: theme
671
+ }), !active && rndRef?.current && open && !isInteracting ? /*#__PURE__*/_jsx(ElementOptions, {
672
+ id: `opt_ref_${str_path}`,
673
+ open: open,
674
+ anchorEl: rndRef?.current,
675
+ enable: enable,
676
+ handleAction: handleAction,
677
+ actions: actions,
678
+ actionsMap: actionsMap,
679
+ optionsProps: optionsProps,
680
+ selectedAction: currentAction,
681
+ path: str_path,
682
+ theme: theme,
683
+ translation: translation,
684
+ customProps: customProps
685
+ }) : null]
682
686
  }), dragInfoOpen ? /*#__PURE__*/_jsx(DragInfo, {
683
687
  anchorEl: rndRef?.current,
684
688
  open: dragInfoOpen,
@@ -7,7 +7,7 @@ import { Node } from "slate";
7
7
  const HIDE_PLACHOLDERS = ["grid", "grid-item", "table"];
8
8
  const TEXT_NODES = ["paragraph", "headingOne", "headingTwo", "headingThree"];
9
9
  const PREVIEW_IMAGE_HIDE_CLASS = ["grid-container-toolbar", "grid-item-toolbar", "element-toolbar", "mini-tool-wrpr-ei", "element-selector", "element-selector-ctrl"];
10
- const RND_ITEMS = ["freegridItem", "freegridBox"];
10
+ export const RND_ITEMS = ["freegridItem", "freegridBox"];
11
11
  export const getThumbnailImage = async (dom, options = {}) => {
12
12
  try {
13
13
  const canvas = await html2canvas(dom, {
@@ -7,6 +7,7 @@ export const formField = data => {
7
7
  name: `field_${new Date().getTime()}`,
8
8
  key: `field_${new Date().getTime()}`,
9
9
  label: `field_${new Date().getTime()}`,
10
+ uid: `field_${new Date().getTime()}`,
10
11
  placeholder: "Placeholder...",
11
12
  children: [{
12
13
  text: ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "10.3.3",
3
+ "version": "10.3.5",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"