@flozy/editor 11.2.1 → 11.2.2

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.
Files changed (141) hide show
  1. package/dist/Editor/ChatEditor.js +7 -7
  2. package/dist/Editor/CommonEditor.js +24 -86
  3. package/dist/Editor/DialogWrapper.js +25 -31
  4. package/dist/Editor/Editor.css +4 -37
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +3 -11
  6. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  7. package/dist/Editor/Elements/Attachments/Attachments.js +11 -154
  8. package/dist/Editor/Elements/Attachments/AttachmentsButton.js +3 -8
  9. package/dist/Editor/Elements/Button/EditorButton.js +7 -22
  10. package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -61
  11. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  12. package/dist/Editor/Elements/Color Picker/ColorPicker.js +7 -10
  13. package/dist/Editor/Elements/Color Picker/Styles.js +13 -15
  14. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +55 -134
  15. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SelectV1.js +8 -7
  16. package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +3 -8
  17. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +1 -1
  18. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +1 -1
  19. package/dist/Editor/Elements/Embed/Embed.js +43 -37
  20. package/dist/Editor/Elements/Embed/Image.js +22 -242
  21. package/dist/Editor/Elements/Embed/Video.js +32 -277
  22. package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +6 -9
  23. package/dist/Editor/Elements/EmbedScript/styles.js +1 -17
  24. package/dist/Editor/Elements/Form/FormField.js +1 -1
  25. package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -25
  26. package/dist/Editor/Elements/Form/Workflow/constant.js +1 -25
  27. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +76 -37
  28. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +5 -9
  29. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -3
  30. package/dist/Editor/Elements/FreeGrid/styles.js +0 -15
  31. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  32. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +1 -2
  33. package/dist/Editor/Elements/Table/Table.js +1 -2
  34. package/dist/Editor/Elements/Table/TableCell.js +3 -10
  35. package/dist/Editor/Elements/Title/title.js +5 -4
  36. package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -4
  37. package/dist/Editor/Elements/TopBanner/TopBannerButton.js +3 -5
  38. package/dist/Editor/Styles/EditorStyles.js +5 -19
  39. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
  40. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
  41. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  42. package/dist/Editor/Toolbar/FormatTools/TextSize.js +29 -33
  43. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -2
  44. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +1 -3
  45. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +23 -25
  46. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +42 -167
  47. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +5 -15
  48. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +1 -2
  49. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +7 -65
  50. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +12 -66
  51. package/dist/Editor/Toolbar/PopupTool/index.js +4 -6
  52. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  53. package/dist/Editor/common/ColorPickerButton.js +19 -38
  54. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  55. package/dist/Editor/common/FontLoader/FontLoader.js +0 -1
  56. package/dist/Editor/common/Icon.js +0 -28
  57. package/dist/Editor/common/ImageSelector/ImageSelector.js +7 -45
  58. package/dist/Editor/common/ImageSelector/Options/Upload.js +11 -26
  59. package/dist/Editor/common/ImageSelector/Styles.js +9 -3
  60. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -2
  61. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
  62. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
  63. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
  64. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
  65. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +2 -3
  66. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +7 -20
  67. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
  68. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +0 -2
  69. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +7 -20
  70. package/dist/Editor/common/RnD/GuideLines/styles.js +1 -1
  71. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
  72. package/dist/Editor/common/RnD/Utils/gridDropItem.js +11 -28
  73. package/dist/Editor/common/RnD/Utils/index.js +1 -3
  74. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +63 -52
  75. package/dist/Editor/common/RnD/VirtualElement/helper.js +68 -248
  76. package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -22
  77. package/dist/Editor/common/RnD/index.js +14 -61
  78. package/dist/Editor/common/Shorthands/elements.js +3 -55
  79. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  80. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +0 -4
  81. package/dist/Editor/common/StyleBuilder/fieldStyle.js +0 -1
  82. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +3 -13
  83. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +2 -12
  84. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
  85. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +10 -36
  86. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
  87. package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +0 -2
  88. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -16
  89. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -15
  90. package/dist/Editor/common/StyleBuilder/formStyle.js +13 -19
  91. package/dist/Editor/common/StyleBuilder/index.js +4 -8
  92. package/dist/Editor/common/Uploader.js +17 -118
  93. package/dist/Editor/common/iconslist.js +0 -21
  94. package/dist/Editor/commonStyle.js +53 -111
  95. package/dist/Editor/helper/index.js +1 -4
  96. package/dist/Editor/helper/theme.js +2 -203
  97. package/dist/Editor/hooks/useMouseMove.js +3 -12
  98. package/dist/Editor/hooks/useTable.js +1 -62
  99. package/dist/Editor/plugins/withEmbeds.js +1 -1
  100. package/dist/Editor/plugins/withHTML.js +3 -56
  101. package/dist/Editor/plugins/withTable.js +1 -1
  102. package/dist/Editor/service/fileupload.js +0 -70
  103. package/dist/Editor/theme/ThemeList.js +173 -50
  104. package/dist/Editor/utils/SlateUtilityFunctions.js +40 -165
  105. package/dist/Editor/utils/accordion.js +1 -1
  106. package/dist/Editor/utils/button.js +17 -1
  107. package/dist/Editor/utils/font.js +37 -40
  108. package/dist/Editor/utils/formfield.js +2 -2
  109. package/dist/Editor/utils/helper.js +3 -101
  110. package/dist/Editor/utils/insertAppHeader.js +4 -8
  111. package/package.json +1 -1
  112. package/dist/Editor/Elements/Attachments/AttachmentStyles.js +0 -16
  113. package/dist/Editor/Elements/FreeGrid/helper.js +0 -194
  114. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -439
  115. package/dist/Editor/assets/svg/BackIcon.js +0 -18
  116. package/dist/Editor/assets/svg/ThemeIcons.js +0 -293
  117. package/dist/Editor/common/CustomColorPicker/index.js +0 -130
  118. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  119. package/dist/Editor/common/CustomDialog2/index.js +0 -94
  120. package/dist/Editor/common/CustomDialog2/style.js +0 -67
  121. package/dist/Editor/common/CustomSelect.js +0 -43
  122. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
  123. package/dist/Editor/common/UploaderWithProgress.js +0 -183
  124. package/dist/Editor/hooks/useEditorTheme.js +0 -153
  125. package/dist/Editor/hooks/useThemeValues.js +0 -63
  126. package/dist/Editor/theme/index.js +0 -149
  127. package/dist/Editor/themeSettings/ActiveTheme.js +0 -82
  128. package/dist/Editor/themeSettings/buttons/index.js +0 -300
  129. package/dist/Editor/themeSettings/buttons/style.js +0 -23
  130. package/dist/Editor/themeSettings/colorTheme/index.js +0 -310
  131. package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
  132. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
  133. package/dist/Editor/themeSettings/fonts/index.js +0 -240
  134. package/dist/Editor/themeSettings/fonts/style.js +0 -62
  135. package/dist/Editor/themeSettings/icons.js +0 -60
  136. package/dist/Editor/themeSettings/index.js +0 -380
  137. package/dist/Editor/themeSettings/style.js +0 -299
  138. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  139. package/dist/Editor/themeSettingsAI/index.js +0 -355
  140. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -202
  141. package/dist/Editor/themeSettingsAI/style.js +0 -332
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import { Grid } from "@mui/material";
3
- import UploaderWithProgress from "../../UploaderWithProgress";
4
3
  import Uploader from "../../Uploader";
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
5
  const Upload = props => {
@@ -10,31 +9,11 @@ const Upload = props => {
10
9
  onUploaded,
11
10
  customProps,
12
11
  disableUpload = false,
13
- title,
14
- setS3UploadProp,
15
- s3UploadProp,
16
- disableProgress,
17
- setUniqueId,
18
- uniqueId
12
+ title
19
13
  } = props;
20
14
  const onDone = img => {
21
15
  onUploaded(img);
22
16
  };
23
- const commonProps = {
24
- classes,
25
- value,
26
- data: {
27
- key: "url"
28
- },
29
- customProps,
30
- onUploaded: onDone,
31
- disableUpload,
32
- title,
33
- setS3UploadProp,
34
- s3UploadProp,
35
- setUniqueId,
36
- uniqueId
37
- };
38
17
  return /*#__PURE__*/_jsx(Grid, {
39
18
  item: true,
40
19
  xs: 12,
@@ -43,10 +22,16 @@ const Upload = props => {
43
22
  height: '100%'
44
23
  },
45
24
  className: "ims-right",
46
- children: disableProgress ? /*#__PURE__*/_jsx(Uploader, {
47
- ...commonProps
48
- }) : /*#__PURE__*/_jsx(UploaderWithProgress, {
49
- ...commonProps
25
+ children: /*#__PURE__*/_jsx(Uploader, {
26
+ classes: classes,
27
+ value: value,
28
+ data: {
29
+ key: "url"
30
+ },
31
+ customProps: customProps,
32
+ onUploaded: onDone,
33
+ disableUpload: disableUpload,
34
+ title: title
50
35
  })
51
36
  });
52
37
  };
@@ -76,7 +76,7 @@ const ImageSelectorStyles = theme => ({
76
76
  background: theme?.palette?.editor?.deviderBgColor,
77
77
  "@media only screen and (min-width: 899px)": {
78
78
  margin: "0px 24px",
79
- width: "calc(100% - 48px)"
79
+ width: 'calc(100% - 48px)'
80
80
  }
81
81
  },
82
82
  "& .primaryBtn": {
@@ -104,6 +104,12 @@ const ImageSelectorStyles = theme => ({
104
104
  marginRight: "8px !important"
105
105
  },
106
106
  "& .MuiGrid-root": {
107
+ "&::-webkit-scrollbar-thumb": {
108
+ background: `none !important`
109
+ },
110
+ "&::-webkit-scrollbar-track": {
111
+ visibility: "hidden"
112
+ },
107
113
  "&::-webkit-scrollbar-thumb": {
108
114
  background: `${theme?.palette?.editor?.brainPopupScroll} !important`
109
115
  },
@@ -112,10 +118,10 @@ const ImageSelectorStyles = theme => ({
112
118
  }
113
119
  },
114
120
  "& .MuiImageList-root": {
115
- margin: "0px"
121
+ margin: '0px'
116
122
  },
117
123
  "& .MuiDialogContent-root": {
118
- padding: "20px 24px 5px 24px"
124
+ padding: '20px 24px 5px 24px'
119
125
  }
120
126
  },
121
127
  titleTypo: {
@@ -68,8 +68,7 @@ const Settings = props => {
68
68
  editor: editor,
69
69
  path: path,
70
70
  customProps: customProps,
71
- theme: theme,
72
- onClose: onClose
71
+ theme: theme
73
72
  }) : null
74
73
  })]
75
74
  })
@@ -8,8 +8,7 @@ const AppHeaderSettings = props => {
8
8
  const {
9
9
  editor,
10
10
  path,
11
- customProps,
12
- onClose
11
+ customProps
13
12
  } = props;
14
13
  const item_path = path?.split("|").map(m => parseInt(m));
15
14
  const element_path = [...item_path, 0];
@@ -28,7 +27,7 @@ const AppHeaderSettings = props => {
28
27
  });
29
28
  };
30
29
  const handleClose = () => {
31
- onClose();
30
+ console.log("close");
32
31
  };
33
32
  return /*#__PURE__*/_jsx(Box, {
34
33
  component: "div",
@@ -8,8 +8,7 @@ const BoxSettings = props => {
8
8
  const {
9
9
  editor,
10
10
  path,
11
- customProps,
12
- onClose
11
+ customProps
13
12
  } = props;
14
13
  const item_path = path?.split("|").map(m => parseInt(m));
15
14
  const element_path = [...item_path];
@@ -28,7 +27,7 @@ const BoxSettings = props => {
28
27
  });
29
28
  };
30
29
  const handleClose = () => {
31
- onClose();
30
+ console.log("close");
32
31
  };
33
32
  return /*#__PURE__*/_jsx(Box, {
34
33
  component: "div",
@@ -8,8 +8,7 @@ const ButtonSettings = props => {
8
8
  const {
9
9
  editor,
10
10
  path,
11
- customProps,
12
- onClose
11
+ customProps
13
12
  } = props;
14
13
  const item_path = path?.split("|").map(m => parseInt(m));
15
14
  const element_path = [...item_path, 0];
@@ -29,7 +28,7 @@ const ButtonSettings = props => {
29
28
  });
30
29
  };
31
30
  const handleClose = () => {
32
- onClose();
31
+ console.log("close");
33
32
  };
34
33
  return /*#__PURE__*/_jsx(Box, {
35
34
  component: "div",
@@ -8,8 +8,7 @@ const CodeSettings = props => {
8
8
  const {
9
9
  editor,
10
10
  path,
11
- customProps,
12
- onClose
11
+ customProps
13
12
  } = props;
14
13
  const item_path = path?.split("|").map(m => parseInt(m));
15
14
  const element_path = [...item_path, 0];
@@ -28,7 +27,7 @@ const CodeSettings = props => {
28
27
  });
29
28
  };
30
29
  const handleClose = () => {
31
- onClose();
30
+ console.log("close");
32
31
  };
33
32
  return /*#__PURE__*/_jsx(Box, {
34
33
  component: "div",
@@ -12,8 +12,7 @@ const FormSettings = props => {
12
12
  const {
13
13
  editor,
14
14
  path,
15
- customProps,
16
- onClose
15
+ customProps
17
16
  } = props;
18
17
  const item_path = path?.split("|").map(m => parseInt(m));
19
18
  const element_path = [...item_path];
@@ -57,7 +56,7 @@ const FormSettings = props => {
57
56
  }
58
57
  };
59
58
  const handleClose = () => {
60
- onClose();
59
+ console.log("close");
61
60
  };
62
61
  const muiTheme = createTheme({
63
62
  components: {
@@ -8,30 +8,17 @@ const ImageSettings = props => {
8
8
  const {
9
9
  editor,
10
10
  path,
11
- customProps,
12
- onClose
11
+ customProps
13
12
  } = props;
14
13
  const item_path = path?.split("|").map(m => parseInt(m));
15
14
  const element_path = [...item_path, 0];
16
15
  const element = Node.get(editor, element_path);
17
16
  const onChange = data => {
18
- let updated_props = {};
19
- if (data?.url?.embedURL) {
20
- updated_props = {
21
- url: data?.url?.embedURL
22
- };
23
- } else if (data?.url?.file) {
24
- updated_props = {
25
- fromFreeGrid: true,
26
- isUpload: true,
27
- file: data?.url?.file,
28
- url: ""
29
- };
30
- } else {
31
- updated_props = {
32
- ...data
33
- };
34
- }
17
+ const updated_props = {
18
+ ...element,
19
+ ...data,
20
+ field_type: data?.element
21
+ };
35
22
  delete updated_props.children;
36
23
  Transforms.setNodes(editor, {
37
24
  ...updated_props
@@ -40,7 +27,7 @@ const ImageSettings = props => {
40
27
  });
41
28
  };
42
29
  const handleClose = () => {
43
- onClose();
30
+ console.log("close");
44
31
  };
45
32
  return /*#__PURE__*/_jsx(Box, {
46
33
  component: "div",
@@ -9,8 +9,7 @@ const TableSettings = props => {
9
9
  const {
10
10
  editor,
11
11
  path,
12
- customProps,
13
- onClose
12
+ customProps
14
13
  } = props;
15
14
  const item_path = path?.split("|").map(m => parseInt(m));
16
15
  const element_path = [...item_path, 0];
@@ -58,7 +57,7 @@ const TableSettings = props => {
58
57
  }
59
58
  };
60
59
  const handleClose = () => {
61
- onClose();
60
+ console.log("close");
62
61
  };
63
62
  return /*#__PURE__*/_jsx(Box, {
64
63
  component: "div",
@@ -9,7 +9,6 @@ const TextSettings = props => {
9
9
  editor,
10
10
  path,
11
11
  theme,
12
- onClose,
13
12
  customProps
14
13
  } = props;
15
14
  const item_path = path.split("|").map(m => parseInt(m));
@@ -28,7 +27,6 @@ const TextSettings = props => {
28
27
  return /*#__PURE__*/_jsx(TextFormat, {
29
28
  classes: classes,
30
29
  editor: editor,
31
- closeMainPopup: onClose,
32
30
  customProps: customProps
33
31
  });
34
32
  };
@@ -8,31 +8,18 @@ const VideoSettings = props => {
8
8
  const {
9
9
  editor,
10
10
  path,
11
- customProps,
12
- onClose
11
+ customProps
13
12
  } = props;
14
13
  const item_path = path?.split("|").map(m => parseInt(m));
15
14
  const element_path = [...item_path, 0];
16
15
  const element = Node.get(editor, element_path);
17
16
  const styleMaps = embedVideoStyle?.filter(f => !f?.hideOnFGS);
18
17
  const onChange = data => {
19
- let updated_props = {};
20
- if (data?.url?.embedURL) {
21
- updated_props = {
22
- url: data?.url?.embedURL
23
- };
24
- } else if (data?.url?.file) {
25
- updated_props = {
26
- isUpload: true,
27
- fromFreeGrid: true,
28
- file: data?.url?.file,
29
- url: ""
30
- };
31
- } else {
32
- updated_props = {
33
- ...data
34
- };
35
- }
18
+ const updated_props = {
19
+ ...element,
20
+ ...data,
21
+ field_type: data?.element
22
+ };
36
23
  delete updated_props.children;
37
24
  Transforms.setNodes(editor, {
38
25
  ...updated_props
@@ -41,7 +28,7 @@ const VideoSettings = props => {
41
28
  });
42
29
  };
43
30
  const handleClose = () => {
44
- onClose();
31
+ console.log("close");
45
32
  };
46
33
  return /*#__PURE__*/_jsx(Box, {
47
34
  component: "div",
@@ -45,7 +45,7 @@ const useGuideLineStyle = ({
45
45
  position: "absolute",
46
46
  width: "calc(50% - 162px)",
47
47
  height: "calc(100% - 2px)",
48
- backgroundColor: "rgba(255,255,255,0)",
48
+ backgroundColor: "rgba(255,255,255,1)",
49
49
  pointerEvents: "none",
50
50
  top: 2,
51
51
  "&.w_left": {
@@ -1,7 +1,6 @@
1
1
  import React from "react";
2
- import { useTheme, createTheme, useMediaQuery } from "@mui/material";
2
+ import { useTheme, ThemeProvider, createTheme, useMediaQuery } from "@mui/material";
3
3
  import { isStimulator, STIMULATOR_MOCK } from "../../../hooks/useBreakpoints";
4
- import MainThemeProvider from "./MainThemeProvider";
5
4
 
6
5
  // Custom breakpoints functions
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -60,15 +59,13 @@ const extendedTheme = (prevTheme, isPrintMode) => createTheme({
60
59
  } : getBreakPoints(prevTheme)
61
60
  });
62
61
  const ViewportStimulator = ({
63
- children,
64
- selectedTheme
62
+ children
65
63
  }) => {
66
64
  const theme = useTheme();
67
65
  const isPrintMode = useMediaQuery("print");
68
66
  const viewportTheme = extendedTheme(theme, isPrintMode);
69
- return /*#__PURE__*/_jsx(MainThemeProvider, {
67
+ return /*#__PURE__*/_jsx(ThemeProvider, {
70
68
  theme: viewportTheme,
71
- userSelectedTheme: selectedTheme,
72
69
  children: children
73
70
  });
74
71
  };
@@ -2,7 +2,6 @@ import { Transforms, Node, Path, Editor } from "slate";
2
2
  import { ReactEditor } from "slate-react";
3
3
  import { getNode, handleNegativeInteger } from "../../../utils/helper";
4
4
  import { handleBoxAlignment } from "../VirtualElement/helper";
5
- import { convertToGridArea, findMaxYValue } from "../../../Elements/FreeGrid/helper";
6
5
  export const ROW_HEIGHT = 50;
7
6
 
8
7
  // const MARGIN_OF = {
@@ -23,27 +22,18 @@ export function updateRows() {}
23
22
  export function updateCols() {}
24
23
  const handleMoveNode = (editor, path, newPath, {
25
24
  isEmpty
26
- }, autoAlign, moveToNode) => {
25
+ }, autoAlign) => {
27
26
  try {
28
27
  let replaceNode = Node.get(editor, path);
29
- let heightDiff = 0;
30
28
  if (autoAlign) {
31
- const y = findMaxYValue(moveToNode?.children);
32
- const {
33
- gridArea,
34
- marginTop
35
- } = convertToGridArea(y);
29
+ // reset node for auto alignment in mobile
36
30
  replaceNode = {
37
31
  ...replaceNode,
38
- gridArea_xs: gridArea,
39
- marginTop_xs: marginTop + 12,
40
- xs_updatedOn: new Date().getTime()
32
+ gridArea_xs: null,
33
+ xs_updatedOn: null,
34
+ marginTop_xs: null
41
35
  };
42
- const newHeight = y + replaceNode?.height_xs + 12;
43
- const diffH = newHeight - moveToNode?.height_xs;
44
- heightDiff = diffH >= 0 ? diffH : 0;
45
36
  }
46
- let rPath;
47
37
  if (isEmpty) {
48
38
  const toPath = [...newPath, 0];
49
39
  Transforms.insertNodes(editor, [{
@@ -54,7 +44,7 @@ const handleMoveNode = (editor, path, newPath, {
54
44
  Transforms.removeNodes(editor, {
55
45
  at: path
56
46
  });
57
- rPath = toPath;
47
+ return toPath;
58
48
  } else {
59
49
  Transforms.insertNodes(editor, [{
60
50
  ...replaceNode
@@ -64,12 +54,8 @@ const handleMoveNode = (editor, path, newPath, {
64
54
  Transforms.removeNodes(editor, {
65
55
  at: path
66
56
  });
67
- rPath = newPath;
57
+ return newPath;
68
58
  }
69
- return {
70
- rPath,
71
- heightDiff
72
- };
73
59
  } catch (err) {
74
60
  console.log(err);
75
61
  console.log("Drop Node error");
@@ -224,7 +210,7 @@ export function onDropItem(props, parentClass) {
224
210
  at: moveTo,
225
211
  match: n => n.type === "freegrid"
226
212
  });
227
- const [, sectionPath] = sectionData || [];
213
+ const [sectionNode, sectionPath] = sectionData || [];
228
214
  if (needMove && isInsidePath(from, moveTo)) {
229
215
  reRenderSectionPath = sectionPath;
230
216
  } else {
@@ -258,15 +244,12 @@ export function onDropItem(props, parentClass) {
258
244
  at: moveTo
259
245
  });
260
246
  }
261
- const {
262
- rPath,
263
- heightDiff
264
- } = handleMoveNode(editor, path, newPath, {
247
+ const rPath = handleMoveNode(editor, path, newPath, {
265
248
  isEmpty
266
- }, autoAlign, toSectionNode) || {};
249
+ }, autoAlign);
267
250
  reRenderChildNodes(editor, reRenderSectionPath || moveTo);
268
251
  if (autoAlign && !isBoxHeader) {
269
- handleBoxAlignment(editor, sectionPath, heightDiff);
252
+ handleBoxAlignment(editor, sectionNode, sectionPath);
270
253
  }
271
254
  return {
272
255
  updated_at: rPath
@@ -87,9 +87,7 @@ export function updatePositions(props, closestClass) {
87
87
  newPath = [...newPath, toSectionNode?.children?.length];
88
88
  }
89
89
  newPath = newPath.map(m => parseInt(m));
90
- const {
91
- rPath
92
- } = handleMoveNode(editor, path, newPath, {
90
+ const rPath = handleMoveNode(editor, path, newPath, {
93
91
  isEmpty
94
92
  });
95
93
  // to update path index need to re-render items in parent sections
@@ -1,45 +1,69 @@
1
1
  import { useEffect, useRef } from "react";
2
+ import { Path, Transforms } from "slate";
2
3
  import { getNode } from "../../../utils/helper";
3
4
  import { ROW_HEIGHT } from "../Utils/gridDropItem";
4
- import { getGridArea, getNodeValues, handleTextAlignment } from "./helper";
5
+ import { findFirstRowOverlap, getGridArea, handleContainers, moveOverlappedItems } from "./helper";
5
6
  import { Box } from "@mui/material";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
- export const getElementOffset = (element, breakpoint) => {
8
- const {
9
- height,
10
- gridArea,
11
- marginTop
12
- } = getNodeValues(element, breakpoint);
13
- const [startRow] = getGridArea(gridArea);
14
- const top = (startRow - 1) * ROW_HEIGHT + marginTop;
15
- const bottom = top + height;
16
- return {
17
- top,
18
- bottom
19
- };
20
- };
21
- export const updateTextHeight = (editor, path, currHeight, updateBreakpoint) => {
22
- if (!currHeight) {
8
+ const updateTextHeight = (editor, path, height) => {
9
+ if (!height) {
23
10
  return;
24
11
  }
25
- const textItem = getNode(editor, path);
26
- if (!textItem) {
12
+ const parentPath = Path.parent(path);
13
+ const currentNode = getNode(editor, parentPath);
14
+ const gridItems = currentNode?.children || [];
15
+ const isNewlyAddedElement = gridItems.some(gridItem => !gridItem.gridArea_xs && gridItem.type !== "paragraph");
16
+ if (isNewlyAddedElement) {
27
17
  return;
28
18
  }
19
+ const textItemIndex = path[parentPath.length];
20
+ const textItem = gridItems.find((_, index) => textItemIndex === index);
29
21
  const {
30
- height,
31
- gridArea,
32
- type
33
- } = getNodeValues(textItem, updateBreakpoint);
34
- if (!gridArea && type !== "paragraph") {
35
- return;
36
- }
37
- const oldHeight = height;
38
- const newHeight = currHeight;
39
- const heightDiff = newHeight - oldHeight;
40
- if (heightDiff !== 0) {
41
- const textNode = [textItem, path];
42
- handleTextAlignment(editor, textNode, heightDiff, updateBreakpoint);
22
+ marginTop_xs: marginTop,
23
+ gridArea_xs: gridArea,
24
+ height_xs
25
+ } = textItem;
26
+ const oldHeight = height_xs + marginTop;
27
+ const newHeight = height + marginTop;
28
+ const extraHeight = newHeight - oldHeight;
29
+ let containerExtraHeight = extraHeight;
30
+ if (extraHeight > 0) {
31
+ const [startRow] = getGridArea(gridArea);
32
+ const newRows = Math.floor(newHeight / ROW_HEIGHT) + 1;
33
+ const endRow = startRow + newRows;
34
+ const firstOverlappedRow = findFirstRowOverlap(gridItems, startRow, endRow, textItemIndex);
35
+ if (firstOverlappedRow) {
36
+ const moveRows = endRow - firstOverlappedRow;
37
+ moveOverlappedItems(editor, moveRows, gridItems, parentPath, textItemIndex, startRow);
38
+ containerExtraHeight += moveRows * ROW_HEIGHT;
39
+ }
40
+
41
+ // handle containers (box and section)
42
+ const containerData = handleContainers(editor, parentPath, containerExtraHeight);
43
+ containerData.forEach(container => {
44
+ const {
45
+ moveRows,
46
+ containerNode,
47
+ containerPath,
48
+ newHeight,
49
+ childIndex,
50
+ lastChildStartRow
51
+ } = container;
52
+ if (moveRows) {
53
+ moveOverlappedItems(editor, moveRows, containerNode?.children, containerPath, childIndex, lastChildStartRow);
54
+ }
55
+ Transforms.setNodes(editor, {
56
+ height_xs: newHeight,
57
+ xs_updatedOn: new Date().getTime()
58
+ }, {
59
+ at: containerPath
60
+ });
61
+ });
62
+ Transforms.setNodes(editor, {
63
+ height_xs: height
64
+ }, {
65
+ at: path
66
+ });
43
67
  }
44
68
  };
45
69
  function VirtualTextElement(props) {
@@ -47,8 +71,7 @@ function VirtualTextElement(props) {
47
71
  dataSets,
48
72
  getCurrentEle,
49
73
  path,
50
- editor,
51
- breakpoint
74
+ editor
52
75
  } = props;
53
76
  const currElement = getCurrentEle();
54
77
  const textRef = useRef(null);
@@ -60,9 +83,9 @@ function VirtualTextElement(props) {
60
83
  height
61
84
  } = entry.contentRect;
62
85
  const currentText = currElement?.innerText;
63
- const prevText = prevTextRef?.current;
86
+ const prevText = prevTextRef.current;
64
87
  if (currentText && currentText !== prevText) {
65
- updateTextHeight(editor, path, height, breakpoint);
88
+ updateTextHeight(editor, path, height);
66
89
  }
67
90
  prevTextRef.current = currentText;
68
91
  }
@@ -78,12 +101,11 @@ function VirtualTextElement(props) {
78
101
  }
79
102
  observer.disconnect();
80
103
  };
81
- }, [currElement?.innerText, breakpoint]);
82
- const fontSize = `var(--fontSize_${breakpoint}) !important`;
104
+ }, [currElement?.innerText]);
83
105
  return /*#__PURE__*/_jsx(Box, {
84
106
  style: {
85
107
  position: "fixed",
86
- width: dataSets[`data-width-${breakpoint}`],
108
+ width: dataSets["data-width-xs"],
87
109
  minHeight: "fit-content",
88
110
  visibility: "hidden",
89
111
  pointerEvents: "none",
@@ -93,24 +115,13 @@ function VirtualTextElement(props) {
93
115
  ref: textRef,
94
116
  sx: {
95
117
  "& .leaf-item": {
96
- fontSize: fontSize,
118
+ fontSize: "var(--fontSize_xs) !important",
97
119
  "& span": {
98
- fontSize: fontSize
120
+ fontSize: "var(--fontSize_xs) !important"
99
121
  }
100
122
  },
101
123
  "& .editor-blocker": {
102
124
  display: "none"
103
- },
104
- "& .fgi_type_text": {
105
- "& .edt-headings": {
106
- margin: "0px"
107
- },
108
- "& .edt-paragraphs": {
109
- margin: "0px"
110
- },
111
- "& blockquote": {
112
- margin: "0px !important"
113
- }
114
125
  }
115
126
  },
116
127
  dangerouslySetInnerHTML: {