@flozy/editor 9.3.6 → 9.3.7

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 (265) hide show
  1. package/dist/Editor/ChatEditor.js +16 -52
  2. package/dist/Editor/CommonEditor.js +23 -133
  3. package/dist/Editor/DialogWrapper.js +25 -31
  4. package/dist/Editor/Editor.css +9 -19
  5. package/dist/Editor/Elements/AI/AIInput.js +3 -5
  6. package/dist/Editor/Elements/AI/CustomSelect.js +5 -9
  7. package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -4
  8. package/dist/Editor/Elements/Accordion/Accordion.js +3 -4
  9. package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +1 -4
  10. package/dist/Editor/Elements/Accordion/AccordionButton.js +2 -6
  11. package/dist/Editor/Elements/Accordion/AccordionTitlePopup.js +1 -4
  12. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  13. package/dist/Editor/Elements/AppHeader/AppHeaderButton.js +2 -6
  14. package/dist/Editor/Elements/AppHeader/AppHeaderPopup.js +1 -4
  15. package/dist/Editor/Elements/Attachments/AttachmentsButton.js +1 -4
  16. package/dist/Editor/Elements/Button/ButtonPopup.js +1 -4
  17. package/dist/Editor/Elements/Button/ButtonToolIcon.js +2 -6
  18. package/dist/Editor/Elements/Button/EditorButton.js +14 -31
  19. package/dist/Editor/Elements/Carousel/Carousel.js +4 -5
  20. package/dist/Editor/Elements/Carousel/CarouselButton.js +2 -6
  21. package/dist/Editor/Elements/Carousel/CarouselItem.js +2 -3
  22. package/dist/Editor/Elements/ChipText/ChipTextPopup.js +1 -4
  23. package/dist/Editor/Elements/CodeToText/CodeToText.js +4 -5
  24. package/dist/Editor/Elements/CodeToText/HtmlContextMenu.js +2 -6
  25. package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -60
  26. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  27. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  28. package/dist/Editor/Elements/Color Picker/Styles.js +3 -3
  29. package/dist/Editor/Elements/Colorbox/ColorboxButton.js +2 -6
  30. package/dist/Editor/Elements/DataView/DataView.js +2 -5
  31. package/dist/Editor/Elements/DataView/DataViewButton.js +2 -6
  32. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +1 -4
  33. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +3 -4
  34. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +5 -23
  35. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +2 -7
  36. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +12 -13
  37. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +4 -7
  38. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +5 -7
  39. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +7 -9
  40. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +3 -8
  41. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +3 -5
  42. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +5 -6
  43. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +3 -5
  44. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +7 -9
  45. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +38 -64
  46. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +2 -3
  47. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +2 -3
  48. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +6 -23
  49. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +1 -4
  50. package/dist/Editor/Elements/DataView/Layouts/TableView.js +4 -6
  51. package/dist/Editor/Elements/DataView/Layouts/index.js +1 -3
  52. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +2 -5
  53. package/dist/Editor/Elements/Divider/Divider.js +3 -5
  54. package/dist/Editor/Elements/Divider/DividerButton.js +2 -6
  55. package/dist/Editor/Elements/Divider/DividerPopup.js +2 -3
  56. package/dist/Editor/Elements/Embed/Embed.js +1 -4
  57. package/dist/Editor/Elements/Embed/EmbedPopup.js +1 -4
  58. package/dist/Editor/Elements/Embed/Image.js +12 -18
  59. package/dist/Editor/Elements/Embed/Video.js +7 -10
  60. package/dist/Editor/Elements/EmbedScript/Code.js +4 -7
  61. package/dist/Editor/Elements/EmbedScript/EmbedScript.js +2 -6
  62. package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +5 -8
  63. package/dist/Editor/Elements/Emoji/EmojiButton.js +2 -6
  64. package/dist/Editor/Elements/Form/FieldPopup.js +1 -4
  65. package/dist/Editor/Elements/Form/Form.js +9 -12
  66. package/dist/Editor/Elements/Form/FormButton.js +2 -6
  67. package/dist/Editor/Elements/Form/FormPopup.js +2 -3
  68. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -18
  69. package/dist/Editor/Elements/Form/Workflow/ListWorkflow.js +8 -13
  70. package/dist/Editor/Elements/Form/Workflow/MoreOptions.js +2 -3
  71. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -4
  72. package/dist/Editor/Elements/Form/Workflow/index.js +9 -15
  73. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +25 -63
  74. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -22
  75. package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +2 -6
  76. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +5 -34
  77. package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +2 -3
  78. package/dist/Editor/Elements/FreeGrid/Options/More.js +4 -10
  79. package/dist/Editor/Elements/FreeGrid/styles.js +0 -3
  80. package/dist/Editor/Elements/Grid/Grid.js +10 -13
  81. package/dist/Editor/Elements/Grid/GridButton.js +5 -9
  82. package/dist/Editor/Elements/Grid/GridItem.js +8 -14
  83. package/dist/Editor/Elements/Grid/GridItemPopup.js +1 -4
  84. package/dist/Editor/Elements/Grid/GridPopup.js +1 -4
  85. package/dist/Editor/Elements/Grid/SectionPopup.js +1 -4
  86. package/dist/Editor/Elements/Link/Link.js +7 -14
  87. package/dist/Editor/Elements/Link/LinkButton.js +1 -4
  88. package/dist/Editor/Elements/List/CheckList.js +9 -14
  89. package/dist/Editor/Elements/NewLine/NewLineButton.js +2 -6
  90. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +5 -16
  91. package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +1 -4
  92. package/dist/Editor/Elements/Search/SearchButton.js +3 -6
  93. package/dist/Editor/Elements/Search/SearchList.js +3 -7
  94. package/dist/Editor/Elements/Signature/SignatureButton.js +2 -6
  95. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -6
  96. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +1 -4
  97. package/dist/Editor/Elements/Signature/SignaturePopup.js +16 -17
  98. package/dist/Editor/Elements/SimpleText/index.js +4 -5
  99. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  100. package/dist/Editor/Elements/Table/DragButton.js +2 -4
  101. package/dist/Editor/Elements/Table/Table.js +25 -48
  102. package/dist/Editor/Elements/Table/TableCell.js +27 -10
  103. package/dist/Editor/Elements/Table/TablePopup.js +1 -4
  104. package/dist/Editor/Elements/Table/TableSelector.js +6 -10
  105. package/dist/Editor/Elements/Table/TableTool.js +4 -8
  106. package/dist/Editor/Elements/Title/title.js +0 -10
  107. package/dist/Editor/Elements/TopBanner/TopBannerButton.js +1 -4
  108. package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
  109. package/dist/Editor/MiniEditor.js +3 -10
  110. package/dist/Editor/Styles/EditorStyles.js +5 -5
  111. package/dist/Editor/Toolbar/Basic/index.js +1 -2
  112. package/dist/Editor/Toolbar/FormatTools/BlockButton.js +2 -6
  113. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
  114. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
  115. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +4 -8
  116. package/dist/Editor/Toolbar/FormatTools/TextSize.js +13 -7
  117. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +15 -20
  118. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +5 -10
  119. package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +4 -10
  120. package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +4 -10
  121. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +2 -6
  122. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +35 -42
  123. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +13 -6
  124. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +51 -58
  125. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectSuperSubscript.js +22 -29
  126. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +87 -226
  127. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +7 -15
  128. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +4 -8
  129. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +9 -16
  130. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +5 -11
  131. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +44 -126
  132. package/dist/Editor/Toolbar/PopupTool/index.js +17 -6
  133. package/dist/Editor/Toolbar/Toolbar.js +10 -20
  134. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  135. package/dist/Editor/assets/svg/CalenderIconTick.js +0 -1
  136. package/dist/Editor/common/ColorPickerButton.js +10 -45
  137. package/dist/Editor/common/CustomDialog/index.js +10 -8
  138. package/dist/Editor/common/CustomDialog/styles.js +1 -1
  139. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  140. package/dist/Editor/common/FontLoader/FontLoader.js +0 -3
  141. package/dist/Editor/common/Icon.js +1 -46
  142. package/dist/Editor/common/ImageSelector/ImageSelector.js +8 -10
  143. package/dist/Editor/common/ImageSelector/Options/AddLink.js +4 -6
  144. package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -1
  145. package/dist/Editor/common/ImageSelector/Styles.js +9 -3
  146. package/dist/Editor/common/ImageSelector/UploadStyles.js +9 -9
  147. package/dist/Editor/common/LinkSettings/NavComponents.js +10 -14
  148. package/dist/Editor/common/LinkSettings/index.js +14 -20
  149. package/dist/Editor/common/LinkSettings/navOptions.js +1 -1
  150. package/dist/Editor/common/MentionsPopup/Styles.js +73 -111
  151. package/dist/Editor/common/MentionsPopup/index.js +4 -8
  152. package/dist/Editor/common/RnD/ContextMenu/CMenus.js +22 -22
  153. package/dist/Editor/common/RnD/ContextMenu/index.js +2 -3
  154. package/dist/Editor/common/RnD/ElementOptions/index.js +2 -7
  155. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +3 -8
  156. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +3 -7
  157. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
  158. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
  159. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
  160. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
  161. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -7
  162. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +2 -3
  163. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
  164. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +2 -6
  165. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
  166. package/dist/Editor/common/RnD/ElementSettings/styles.js +1 -0
  167. package/dist/Editor/common/RnD/OptionsPopup/index.js +3 -4
  168. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +4 -11
  169. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +8 -20
  170. package/dist/Editor/common/RnD/Utils/gridDropItem.js +7 -58
  171. package/dist/Editor/common/RnD/Utils/index.js +0 -48
  172. package/dist/Editor/common/RnD/VirtualElement/index.js +104 -186
  173. package/dist/Editor/common/RnD/VirtualElement/styles.js +8 -95
  174. package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +3 -5
  175. package/dist/Editor/common/RnD/index.js +10 -82
  176. package/dist/Editor/common/Section/index.js +4 -7
  177. package/dist/Editor/common/Shorthands/elements.js +10 -98
  178. package/dist/Editor/common/StyleBuilder/appHeaderStyle.js +4 -4
  179. package/dist/Editor/common/StyleBuilder/boxStyle.js +2 -2
  180. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -6
  181. package/dist/Editor/common/StyleBuilder/dividerStyles.js +2 -2
  182. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +6 -6
  183. package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -2
  184. package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +9 -13
  185. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +3 -11
  186. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +5 -19
  187. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +10 -22
  188. package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +3 -6
  189. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +13 -27
  190. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +14 -41
  191. package/dist/Editor/common/StyleBuilder/fieldTypes/elementSize.js +6 -10
  192. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +6 -19
  193. package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +2 -6
  194. package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +2 -5
  195. package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +6 -9
  196. package/dist/Editor/common/StyleBuilder/fieldTypes/metaDataMapping.js +2 -8
  197. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +11 -12
  198. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +2 -6
  199. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -8
  200. package/dist/Editor/common/StyleBuilder/fieldTypes/textAlign.js +2 -6
  201. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +12 -21
  202. package/dist/Editor/common/StyleBuilder/formStyle.js +7 -7
  203. package/dist/Editor/common/StyleBuilder/gridItemStyle.js +6 -6
  204. package/dist/Editor/common/StyleBuilder/gridStyle.js +5 -5
  205. package/dist/Editor/common/StyleBuilder/index.js +5 -8
  206. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +7 -5
  207. package/dist/Editor/common/Uploader.js +5 -16
  208. package/dist/Editor/commonStyle.js +23 -13
  209. package/dist/Editor/helper/index.js +12 -8
  210. package/dist/Editor/helper/theme.js +2 -200
  211. package/dist/Editor/hooks/useDrag.js +11 -17
  212. package/dist/Editor/hooks/useEditorScroll.js +6 -10
  213. package/dist/Editor/hooks/useMouseMove.js +13 -28
  214. package/dist/Editor/hooks/useTable.js +2 -5
  215. package/dist/Editor/plugins/withEmbeds.js +1 -1
  216. package/dist/Editor/plugins/withHTML.js +15 -19
  217. package/dist/Editor/plugins/withLayout.js +2 -3
  218. package/dist/Editor/plugins/withTable.js +1 -1
  219. package/dist/Editor/theme/ThemeList.js +173 -50
  220. package/dist/Editor/utils/SlateUtilityFunctions.js +47 -171
  221. package/dist/Editor/utils/button.js +2 -7
  222. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +0 -23
  223. package/dist/Editor/utils/dataView.js +2 -5
  224. package/dist/Editor/utils/divider.js +2 -18
  225. package/dist/Editor/utils/draftToSlate.js +2 -3
  226. package/dist/Editor/utils/embed.js +4 -9
  227. package/dist/Editor/utils/font.js +37 -40
  228. package/dist/Editor/utils/freegrid.js +2 -2
  229. package/dist/Editor/utils/helper.js +29 -136
  230. package/dist/Editor/utils/signature.js +2 -5
  231. package/dist/Editor/utils/table.js +37 -53
  232. package/package.json +2 -2
  233. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +0 -422
  234. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -441
  235. package/dist/Editor/assets/svg/ClearAllRounded.js +0 -31
  236. package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
  237. package/dist/Editor/common/CustomColorPicker/index.js +0 -125
  238. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  239. package/dist/Editor/common/CustomDialog2/index.js +0 -94
  240. package/dist/Editor/common/CustomDialog2/style.js +0 -67
  241. package/dist/Editor/common/CustomSelect.js +0 -33
  242. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
  243. package/dist/Editor/common/RnD/VirtualElement/ForceAutoAlignment.js +0 -110
  244. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +0 -112
  245. package/dist/Editor/common/RnD/VirtualElement/helper.js +0 -267
  246. package/dist/Editor/common/SnackBar/index.js +0 -43
  247. package/dist/Editor/helper/textIndeces.js +0 -58
  248. package/dist/Editor/hooks/useAutoScroll.js +0 -38
  249. package/dist/Editor/hooks/useEditorTheme.js +0 -153
  250. package/dist/Editor/theme/index.js +0 -144
  251. package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
  252. package/dist/Editor/themeSettings/buttons/index.js +0 -285
  253. package/dist/Editor/themeSettings/buttons/style.js +0 -23
  254. package/dist/Editor/themeSettings/colorTheme/index.js +0 -297
  255. package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
  256. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
  257. package/dist/Editor/themeSettings/fonts/index.js +0 -222
  258. package/dist/Editor/themeSettings/fonts/style.js +0 -59
  259. package/dist/Editor/themeSettings/icons.js +0 -60
  260. package/dist/Editor/themeSettings/index.js +0 -328
  261. package/dist/Editor/themeSettings/style.js +0 -193
  262. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  263. package/dist/Editor/themeSettingsAI/index.js +0 -355
  264. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -215
  265. package/dist/Editor/themeSettingsAI/style.js +0 -250
@@ -1,232 +1,150 @@
1
- import React, { useEffect, useMemo, useRef, useState } from "react";
1
+ import React, { useEffect, useRef } from "react";
2
2
  import { Box } from "@mui/material";
3
3
  import useVirtualElementStyles from "./styles";
4
4
  import updateAutoProps from "./updateAutoProps";
5
- import { ROW_HEIGHT, calculateGridArea } from "../Utils/gridDropItem";
5
+ import { calculateGridArea } from "../Utils/gridDropItem";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const ROOT_ITEM_CLASS = ".freegrid-item.path-3";
8
- export function getStartRow(el) {
9
- const gridArea = el.dataset.gridAreaXs;
10
- if (gridArea) {
11
- const [startRow] = gridArea.split("/").map(num => parseInt(num));
12
- return startRow;
13
- }
14
- }
15
- function appendGridOccupied(domItem, startRow, fullHeight, lastRow) {
16
- const endRow = startRow + Math.floor(fullHeight / ROW_HEIGHT) + 1;
17
- lastRow = Math.max(endRow, lastRow);
18
- const gridArea = `${startRow}/1/${endRow}/2`;
19
- domItem.style.setProperty("--gridArea_xs", gridArea);
20
- domItem.dataset.gridAreaXs = gridArea;
21
- domItem.classList.add("exclude-virtual");
22
- return {
23
- domItem,
24
- updatedLastRow: lastRow,
25
- gridArea
26
- };
27
- }
28
8
 
29
9
  // Function to group items by path and calculate heights
30
- // function groupByPathAndCalculateHeight(allData) {
31
- // const data = JSON.parse(JSON.stringify([...allData]));
32
- // const root = {};
33
- // const heightData = {};
34
-
35
- // // Step 1: Group items based on their path
36
- // data.forEach((item) => {
37
- // const segments = item.path.split("|");
38
- // let current = root;
39
-
40
- // segments.forEach((segment, index) => {
41
- // if (!current[segment]) {
42
- // current[segment] = { children: {}, props: { height: 0 } };
43
- // }
44
-
45
- // if (index === segments.length - 1) {
46
- // // Assign the properties of the item including height
47
- // current[segment] = { ...item, children: current[segment].children };
48
- // }
49
-
50
- // current = current[segment].children;
51
- // });
52
- // });
53
-
54
- // // Step 2: Recursively calculate the height of each parent based on children
55
- // const calculateHeight = (node) => {
56
- // if (!node.children || Object.keys(node.children).length === 0) {
57
- // // Base case: If there are no children, return the node's height
58
- // return node.props.height;
59
- // }
60
-
61
- // // Calculate the height by summing the heights of all children
62
- // let totalHeight = 0;
63
- // Object.values(node.children).forEach((child) => {
64
- // totalHeight += calculateHeight(child);
65
- // });
10
+ function groupByPathAndCalculateHeight(data) {
11
+ const root = {};
12
+ const heightData = {};
13
+
14
+ // Step 1: Group items based on their path
15
+ data.forEach(item => {
16
+ const segments = item.path.split("|");
17
+ let current = root;
18
+ segments.forEach((segment, index) => {
19
+ if (!current[segment]) {
20
+ current[segment] = {
21
+ children: {},
22
+ props: {
23
+ height: 0
24
+ }
25
+ };
26
+ }
27
+ if (index === segments.length - 1) {
28
+ // Assign the properties of the item including height
29
+ current[segment] = {
30
+ ...item,
31
+ children: current[segment].children
32
+ };
33
+ }
34
+ current = current[segment].children;
35
+ });
36
+ });
66
37
 
67
- // // Update the parent's height to be the total height of its children
68
- // node.props.height = totalHeight;
69
- // if (node?.path) {
70
- // heightData[node.path] = totalHeight;
71
- // }
72
- // return totalHeight;
73
- // };
38
+ // Step 2: Recursively calculate the height of each parent based on children
39
+ const calculateHeight = node => {
40
+ if (!node.children || Object.keys(node.children).length === 0) {
41
+ // Base case: If there are no children, return the node's height
42
+ return node.props.height;
43
+ }
74
44
 
75
- // // Start calculation from the root
76
- // Object.values(root).forEach((node) => calculateHeight(node));
45
+ // Calculate the height by summing the heights of all children
46
+ let totalHeight = 0;
47
+ Object.values(node.children).forEach(child => {
48
+ totalHeight += calculateHeight(child);
49
+ });
77
50
 
78
- // return { root, heightData };
79
- // }
51
+ // Update the parent's height to be the total height of its children
52
+ node.props.height = totalHeight;
53
+ if (node?.path) {
54
+ heightData[node.path] = totalHeight;
55
+ }
56
+ return totalHeight;
57
+ };
80
58
 
81
- const handleGridItem = (dom, lastRow) => {
82
- const startRow = getStartRow(dom);
83
- const {
84
- marginTopXs,
85
- heightXs
86
- } = dom.dataset;
87
- const marginTop = marginTopXs ? Number(marginTopXs) : 0;
88
- const fullHeight = Number(heightXs) + marginTop;
89
- return appendGridOccupied(dom, startRow, fullHeight, lastRow);
90
- };
91
- const handleNonGridItem = (dom, lastRow) => {
92
- const rect = dom.getBoundingClientRect();
93
- dom.style.setProperty("--height_xs", rect.height + "px"); // assign the auto height that taken
94
- const startRow = lastRow || 1;
95
- const DEFAULT_NEW_ELEMENT_MARGIN_TOP = 12;
96
- let fullHeight = rect.height + DEFAULT_NEW_ELEMENT_MARGIN_TOP;
97
- const gridOccupiedData = appendGridOccupied(dom, startRow, fullHeight, lastRow);
59
+ // Start calculation from the root
60
+ Object.values(root).forEach(node => calculateHeight(node));
98
61
  return {
99
- ...gridOccupiedData,
100
- fullHeight
62
+ root,
63
+ heightData
101
64
  };
102
- };
103
- const appendContainerItems = async (sectionCls, virtualRef, dataSets) => {
104
- const cloneNode = document.querySelector(sectionCls)?.cloneNode(true);
105
- const items = cloneNode?.querySelectorAll(ROOT_ITEM_CLASS) || [];
106
- if (!cloneNode || !items?.length || !virtualRef.current) {
107
- return;
108
- }
109
-
110
- // Remove all existing elements inside virtualRef.current
111
- virtualRef.current.innerHTML = "";
112
- virtualRef.current.style.height = `auto`;
113
- virtualRef.current.style.gridTemplateRows = `unset`;
114
-
115
- // temporary append section items to get the dom styles
116
- virtualRef.current.append(...items);
117
- let itemsHTML = "";
118
- let lastRow = 0;
119
- const gridItems = [];
120
- const nonGridItems = [];
121
- items.forEach(item => {
122
- if (getStartRow(item)) {
123
- gridItems.push(item);
124
- } else {
125
- nonGridItems.push(item);
126
- }
127
- });
128
-
129
- // to find the previously occupied rows
130
- gridItems.forEach(item => {
131
- const {
132
- updatedLastRow,
133
- domItem
134
- } = handleGridItem(item, lastRow);
135
- lastRow = updatedLastRow;
136
- itemsHTML += domItem.outerHTML;
137
- });
138
- let containerHeight = lastRow ? (lastRow - 1) * ROW_HEIGHT : 0;
139
-
140
- //place it on the next rows that are available
141
- nonGridItems.forEach(item => {
142
- const {
143
- domItem,
144
- updatedLastRow,
145
- fullHeight
146
- } = handleNonGridItem(item, lastRow);
147
- lastRow = updatedLastRow;
148
- itemsHTML += domItem.outerHTML;
149
- containerHeight += fullHeight;
150
- });
151
- const oldSectionHeight = dataSets["data-height-xs"];
152
- const newHeight = oldSectionHeight && oldSectionHeight > containerHeight ? oldSectionHeight : containerHeight;
153
- virtualRef.current.style.height = `${newHeight}px`;
154
- virtualRef.current.style.gridTemplateRows = `repeat(${lastRow - 1}, ${ROW_HEIGHT}px)`;
155
- virtualRef.current.innerHTML = itemsHTML;
156
- };
65
+ }
157
66
  const VirtualElement = props => {
158
67
  const classes = useVirtualElementStyles();
159
68
  const {
160
69
  editor,
161
70
  path,
162
- updated_at,
163
- sectionCls,
164
- dataSets
71
+ parentEle,
72
+ updated_at
165
73
  } = props;
74
+ const cloneNode = parentEle?.cloneNode(true);
166
75
  const virtualRef = useRef();
167
- const [toggleUpdate, setToggleUpdate] = useState(false);
168
76
  useEffect(() => {
169
77
  if (virtualRef?.current) {
170
- setTimeout(() => {
78
+ const timeoutId = setTimeout(() => {
171
79
  const allData = calculateProps(path, virtualRef?.current, ROOT_ITEM_CLASS, []);
172
- // const groupData = groupByPathAndCalculateHeight(allData);
173
- // console.log("allData", allData);
80
+ const groupData = groupByPathAndCalculateHeight(allData);
174
81
  // it should trigger by auto alignment or on clicking mobile view change
175
- updateAutoProps(editor, allData, "xs");
82
+ updateAutoProps(editor, allData, "xs", groupData);
176
83
  }, 100);
177
- setToggleUpdate(prev => !prev);
84
+ return () => clearTimeout(timeoutId);
178
85
  }
179
86
  }, [updated_at, virtualRef?.current]);
180
87
  const calculateProps = (curPath, dom, domClass, allData) => {
181
88
  const rect = dom?.getBoundingClientRect();
182
-
183
- // const sectionRect = virtualRef?.current?.getBoundingClientRect();
184
-
185
- const bufferHeight = 12; // for spacing
186
-
89
+ const sectionRect = virtualRef?.current?.getBoundingClientRect();
187
90
  const sectionProps = {
188
91
  path: curPath,
189
92
  props: {
190
- height: rect?.height + bufferHeight
93
+ height: rect?.height
191
94
  }
192
95
  };
193
96
  const itemsData = [];
194
- const items = dom ? dom.querySelectorAll(domClass) : [];
97
+ const items = dom.querySelectorAll(domClass);
98
+ const nextItemPathLength = curPath?.split("|").length + 2;
99
+ let sectionHeight = 12;
195
100
  for (let i = 0; i < items.length; i++) {
196
- const item = items[i];
197
- const itemRect = item?.getBoundingClientRect();
198
- const {
199
- path
200
- } = item?.dataset;
201
- const y = Math.abs(rect.top - itemRect?.top);
202
- itemsData.push({
203
- path,
204
- props: {
205
- top: y,
206
- left: 24,
207
- marginTop: 12,
208
- width: itemRect?.width,
209
- height: itemRect?.height,
210
- gridArea: calculateGridArea(y)
211
- }
212
- });
101
+ const itemRect = items[i]?.getBoundingClientRect();
102
+ if (items[i]?.classList.contains("type_box")) {
103
+ allData = calculateProps(items[i]?.dataset.path, items[i], `.freegrid-item.path-${nextItemPathLength}`, allData);
104
+ } else {
105
+ const y = Math.abs(rect.top - itemRect?.top);
106
+ itemsData.push({
107
+ path: items[i]?.dataset.path,
108
+ props: {
109
+ top: y,
110
+ left: 24,
111
+ marginTop: 12,
112
+ width: itemRect?.width,
113
+ height: itemRect?.height,
114
+ gridArea: calculateGridArea(y)
115
+ }
116
+ });
117
+ sectionHeight += itemRect?.height;
118
+ }
119
+ }
120
+ if (dom?.classList.contains("type_box")) {
121
+ const y = Math.abs(sectionRect.top - rect?.top);
122
+ sectionProps.props.gridArea = calculateGridArea(y);
123
+ }
124
+ if (sectionHeight > sectionProps?.props?.height) {
125
+ sectionProps.props.height = sectionHeight;
213
126
  }
214
127
  allData = [sectionProps, [...allData, ...itemsData]]?.flat();
215
128
  return allData;
216
129
  };
217
- useMemo(() => {
218
- return appendContainerItems(sectionCls, virtualRef, dataSets);
219
- }, [toggleUpdate]);
130
+ const getItems = () => {
131
+ const items = cloneNode?.querySelectorAll(ROOT_ITEM_CLASS) || [];
132
+ let itemsHTML = "";
133
+ for (let i = 0; i < items?.length; i++) {
134
+ items[i].classList.add("exclude-virtual");
135
+ itemsHTML += items[i].outerHTML;
136
+ }
137
+ return itemsHTML;
138
+ };
220
139
  return /*#__PURE__*/_jsx(Box, {
221
140
  className: "mobile-virtual-mode",
222
141
  ref: virtualRef,
223
- sx: {
224
- display: "grid",
225
- gridTemplateColumns: "100%",
226
- visibility: "hidden",
227
- // height: `${containerHeight}px !important`,
228
- // gridTemplateRows: `repeat(${lastRow - 1}, ${ROW_HEIGHT}px)`,
229
- ...classes.root
142
+ sx: classes.root,
143
+ dangerouslySetInnerHTML: {
144
+ __html: getItems()
145
+ },
146
+ style: {
147
+ visibility: "hidden"
230
148
  },
231
149
  "aria-hidden": "true"
232
150
  });
@@ -2,108 +2,20 @@ const useVirtualElementStyles = () => ({
2
2
  root: {
3
3
  width: "320px",
4
4
  position: "fixed",
5
- // backgroundColor: "red",
6
- // height: "fit-content",
5
+ backgroundColor: "red",
6
+ height: "auto",
7
7
  overflow: "visible",
8
- // pointerEvents: "none",
9
- opacity: 1,
8
+ pointerEvents: "none",
9
+ opacity: 0,
10
10
  right: 0,
11
11
  top: 0,
12
12
  "& .freegrid-item": {
13
13
  position: "relative !important",
14
- top: "0 !important",
15
- gridArea: "var(--gridArea_xs) !important",
16
- width: "calc(100% - 48px) !important",
17
- height: "var(--height_xs) !important",
18
- left: "24px !important",
19
- marginTop: "var(--marginTop_xs) !important",
20
- outline: "1px solid gray !important",
21
- // "&.type_box": {
22
- // // display: "grid !important",
23
- // // gridTemplateRows: "repeat(auto-fill, 50px) !important",
24
- // // height: "min-content !important",
25
- // },
26
-
27
- "& .debug-info, & .editor-blocker": {
28
- display: "none"
29
- },
30
- "& .embed": {
31
- minHeight: "300px"
32
- }
33
- }
34
- }
35
- });
36
- export default useVirtualElementStyles;
37
- export const useAutoAlignStyles = () => ({
38
- root: {
39
- width: "320px",
40
- position: "fixed",
41
- overflow: "visible",
42
- opacity: 1,
43
- right: 0,
44
- top: 0,
45
- height: "auto !important",
46
- zIndex: 99999999,
47
- "& .freegrid-item": {
48
- position: "relative !important",
49
- top: "0 !important",
50
14
  gridArea: "none !important",
51
15
  width: "calc(100% - 48px) !important",
52
- height: "var(--height_xs) !important",
16
+ height: "auto !important",
53
17
  left: "24px !important",
54
- marginTop: "12px !important",
55
- minHeight: "auto",
56
- "&.type_box": {
57
- height: "auto !important"
58
- },
59
- // start - default signature classes on free-grid
60
- "& .fgi_type_signature": {
61
- height: "100%",
62
- "& .signature-container": {
63
- height: "100%",
64
- LineHeight: 1.43,
65
- "& .signature-btn-container": {
66
- height: "100%",
67
- display: "flex",
68
- flexDirection: "column",
69
- "& .sign-placeholder": {
70
- display: "flex",
71
- // remove hidden sign placeholder
72
- width: "100%",
73
- flexGrow: 1
74
- },
75
- "& button": {
76
- margin: "6px 0px"
77
- }
78
- }
79
- }
80
- },
81
- "& .fgi_type_sign": {
82
- width: "100%",
83
- height: "100%",
84
- "& .signature-signed-wrapper": {
85
- width: "100%",
86
- height: "100%",
87
- "& .signature-signed-span": {
88
- width: "100%",
89
- height: "100%",
90
- "& .signed-btn": {
91
- width: "100%",
92
- height: "100%",
93
- display: "flex",
94
- flexDirection: "column",
95
- "& img": {
96
- width: "100% !important",
97
- maxWidth: "none !important",
98
- height: "70% !important",
99
- flexGrow: 1
100
- }
101
- }
102
- }
103
- }
104
- },
105
- // end - default signature classes on free-grid
106
-
18
+ marginTop: "24px !important",
107
19
  "& .debug-info, & .editor-blocker": {
108
20
  display: "none"
109
21
  },
@@ -112,4 +24,5 @@ export const useAutoAlignStyles = () => ({
112
24
  }
113
25
  }
114
26
  }
115
- });
27
+ });
28
+ export default useVirtualElementStyles;
@@ -1,5 +1,5 @@
1
1
  import { Node, Transforms } from "slate";
2
- const updateAutoProps = (editor, datas = [], breakpoint = "", updateAll) => {
2
+ const updateAutoProps = (editor, datas = [], breakpoint = "", groupData) => {
3
3
  try {
4
4
  // const { heightData } = groupData;
5
5
  for (let i = 0; i < datas.length; i++) {
@@ -14,11 +14,9 @@ const updateAutoProps = (editor, datas = [], breakpoint = "", updateAll) => {
14
14
  return a;
15
15
  }, {});
16
16
  const oldProps = Node.get(editor, int_path);
17
- const updateNode = !oldProps?.xs_updatedOn || updateAll;
18
- if (updateNode) {
17
+ if (!oldProps?.xs_updatedOn) {
19
18
  Transforms.setNodes(editor, {
20
- ...updatedProps,
21
- xs_updatedOn: new Date().getTime()
19
+ ...updatedProps
22
20
  }, {
23
21
  at: int_path
24
22
  });
@@ -6,7 +6,7 @@ import Handles from "./TransformHandles";
6
6
  import { useEditorContext } from "../../hooks/useMouseMove";
7
7
  import ElementOptions from "./ElementOptions";
8
8
  import ElementSettings from "./ElementSettings";
9
- import { getAbsolutePositionX, getAbsolutePositionY, getClosestDraggable, getParentSectionPath } from "./Utils";
9
+ import { getClosestDraggable, getParentSectionPath } from "./Utils";
10
10
  import DragInfo from "./DragInfo";
11
11
  import GuideLines from "./GuideLines";
12
12
  import ShadowElement from "./ShadowElement";
@@ -19,10 +19,6 @@ 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";
23
- import VirtualTextElement from "./VirtualElement/VirtualTextElement";
24
- import useAutoScroll from "../../hooks/useAutoScroll";
25
- import ForceAutoAlignment from "./VirtualElement/ForceAutoAlignment";
26
22
  import { jsx as _jsx } from "react/jsx-runtime";
27
23
  import { jsxs as _jsxs } from "react/jsx-runtime";
28
24
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -68,10 +64,7 @@ const RnD = props => {
68
64
  editor,
69
65
  breakpoint = "",
70
66
  handleContextMenuClick = () => {},
71
- itemData = {},
72
- customProps,
73
- sectionElement,
74
- dataSets
67
+ itemData = {}
75
68
  } = props;
76
69
  const {
77
70
  isSelectedElement,
@@ -79,9 +72,7 @@ const RnD = props => {
79
72
  updateDragging,
80
73
  contextMenu,
81
74
  setContextMenu,
82
- theme,
83
- autoAlign,
84
- setAutoAlign
75
+ theme
85
76
  } = useEditorContext();
86
77
  const str_path = path.join("|");
87
78
  const selectedElementProps = isSelectedElement(str_path, type);
@@ -115,13 +106,6 @@ const RnD = props => {
115
106
  y: 0
116
107
  });
117
108
  const parentSectionPath = str_path?.split("|").slice(0, 2).join("_");
118
- const {
119
- translation
120
- } = customProps;
121
- const {
122
- startAutoScroll,
123
- stopAutoScroll
124
- } = useAutoScroll(10, "slate-wrapper-scroll-container");
125
109
  useEffect(() => {
126
110
  if (ITEM_TYPES.includes(type)) {
127
111
  if (enable === 1) {
@@ -357,16 +341,6 @@ const RnD = props => {
357
341
  };
358
342
  const onDrag = e => {
359
343
  e.preventDefault();
360
- const {
361
- clientY
362
- } = e;
363
- if (clientY < 50) {
364
- startAutoScroll("up");
365
- } else if (window.innerHeight - clientY < 50) {
366
- startAutoScroll("down");
367
- } else {
368
- stopAutoScroll();
369
- }
370
344
  const lines = getClosestDraggable(e.clientX, e.clientY, `.freegrid-section_${parentSectionPath} .freegrid-container .freegrid-item.inactive-drag`.replace(/\|/g, "\\|"), ".freegrid-item.active-drag:not(.exclude-virtual)");
371
345
  setAbsPosition({
372
346
  ...absPosition,
@@ -409,7 +383,6 @@ const RnD = props => {
409
383
  const onDragStop = (e, d) => {
410
384
  e.preventDefault();
411
385
  e.stopPropagation();
412
- stopAutoScroll();
413
386
  if (dragging?.isDragging === 2 && dragging?.position?.strXY && dragging?.dragOver) {
414
387
  d.x = e.x;
415
388
  d.y = e.y;
@@ -452,36 +425,14 @@ const RnD = props => {
452
425
  };
453
426
  const onResizeStop = (e, direction, ref, d, position) => {
454
427
  e.preventDefault();
455
- let updatedPosition = {};
456
- if (type !== "parent") {
457
- // update element position while resizing, (for free grid box and item)
458
- const {
459
- absolutePositionX
460
- } = getAbsolutePositionX(ref);
461
- const {
462
- gridArea,
463
- marginTop
464
- } = getAbsolutePositionY(ref);
465
- updatedPosition = {
466
- left: absolutePositionX,
467
- gridArea: gridArea,
468
- marginTop: marginTop
469
- };
470
- }
471
428
  const updatedSize = {
472
429
  width: delta?.width + d.width,
473
- height: ref.offsetHeight,
474
- ...updatedPosition
430
+ height: delta?.height + d.height
475
431
  };
476
432
  onChange({
477
433
  ...updatedSize
478
434
  });
479
435
  handleResizeEvent("stop");
480
- const parentPath = getParentSectionPath({
481
- ref
482
- }, ".freegrid-container-parent");
483
- const formatParentPath = parentPath?.split("|")?.map(m => parseInt(m));
484
- reRenderChildNodes(editor, formatParentPath);
485
436
  };
486
437
  const onCloseSettings = () => {
487
438
  setSelectedElement({
@@ -549,15 +500,12 @@ const RnD = props => {
549
500
  return /*#__PURE__*/_jsxs(_Fragment, {
550
501
  children: [/*#__PURE__*/_jsxs(Box, {
551
502
  component: Rnd,
552
- placeholder: translation(ItemTypes[childType]) || translation("Item"),
503
+ placeholder: ItemTypes[childType] || "Item",
553
504
  id: eId || "",
554
505
  ref: c => {
555
506
  positionRef.current = c;
556
507
  },
557
- className: `${className || ""} ${dragInfoOpen ? "active-drag" : "inactive-drag"} enable-${enable} type_${childType} section_type_${type || "parent"} ${Object.keys(absPosition)?.length ? "" : "remove-resize-styles"
558
- // Fix rerender issue (remove-resize-styles): After resizing, click close button on a free grid-selected element
559
- // doesn't remove the default `transform` style from react-rnd. Removing it manually.
560
- }`,
508
+ className: `${className || ""} ${dragInfoOpen ? "active-drag" : "inactive-drag"} enable-${enable} type_${childType} section_type_${type || "parent"}`,
561
509
  "data-path": str_path,
562
510
  style: {
563
511
  position: "relative",
@@ -583,7 +531,6 @@ const RnD = props => {
583
531
  ...DISABLE_RESIZING
584
532
  },
585
533
  ...getEventProps(),
586
- ...(dataSets || {}),
587
534
  children: [/*#__PURE__*/_jsx("div", {
588
535
  id: `opt_ref_${str_path}`,
589
536
  style: {
@@ -617,9 +564,7 @@ const RnD = props => {
617
564
  optionsProps: optionsProps,
618
565
  selectedAction: currentAction,
619
566
  path: str_path,
620
- theme: theme,
621
- translation: translation,
622
- customProps: customProps
567
+ theme: theme
623
568
  }) : null, /*#__PURE__*/_jsx(ElementSettings, {
624
569
  open: Boolean(currentAction),
625
570
  currentAction: currentAction,
@@ -653,29 +598,12 @@ const RnD = props => {
653
598
  open: openContextMenu,
654
599
  contextMenu: contextMenu,
655
600
  handleClose: handleClose,
656
- theme: theme,
657
- translation: translation
601
+ theme: theme
658
602
  }), type === "parent" && breakpoint === "lg" && !readOnly ? /*#__PURE__*/_jsx(VirtualElement, {
603
+ parentEle: positionRef?.current?.resizableElement?.current,
659
604
  updated_at: updated_at,
660
605
  path: str_path,
661
- editor: editor,
662
- sectionElement: sectionElement,
663
- sectionCls: `.freegrid-section_${path.join("_")}`,
664
- dataSets: dataSets
665
- }) : null, childType === "text" && breakpoint === "lg" && !readOnly ? /*#__PURE__*/_jsx(VirtualTextElement, {
666
- editor: editor,
667
- dataSets: dataSets,
668
- getCurrentEle: getCurrentEle,
669
- path: path
670
- }) : null, type === "parent" && breakpoint === "xs" && !readOnly && autoAlign ? /*#__PURE__*/_jsx(ForceAutoAlignment, {
671
- updated_at: updated_at,
672
- path: str_path,
673
- editor: editor,
674
- sectionElement: sectionElement,
675
- sectionCls: `.freegrid-section_${path.join("_")}`,
676
- dataSets: dataSets,
677
- autoAlign: autoAlign,
678
- setAutoAlign: setAutoAlign
606
+ editor: editor
679
607
  }) : null]
680
608
  });
681
609
  };