@flozy/editor 9.8.1 → 9.8.3

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 (255) hide show
  1. package/dist/Editor/ChatEditor.js +19 -26
  2. package/dist/Editor/CommonEditor.js +25 -139
  3. package/dist/Editor/DialogWrapper.js +25 -31
  4. package/dist/Editor/Editor.css +7 -11
  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 +5 -15
  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 +30 -43
  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 +7 -10
  28. package/dist/Editor/Elements/Color Picker/Styles.js +13 -15
  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 +2 -4
  33. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +6 -21
  34. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +12 -13
  35. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +4 -7
  36. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +5 -7
  37. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +7 -9
  38. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +3 -8
  39. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +3 -5
  40. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +5 -6
  41. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +3 -5
  42. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +7 -9
  43. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +12 -15
  44. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +2 -3
  45. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +2 -3
  46. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +6 -23
  47. package/dist/Editor/Elements/DataView/Layouts/TableView.js +4 -6
  48. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +4 -8
  49. package/dist/Editor/Elements/DataView/Layouts/index.js +1 -3
  50. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +2 -5
  51. package/dist/Editor/Elements/Divider/Divider.js +3 -5
  52. package/dist/Editor/Elements/Divider/DividerButton.js +2 -6
  53. package/dist/Editor/Elements/Divider/DividerPopup.js +2 -3
  54. package/dist/Editor/Elements/Embed/Embed.js +1 -4
  55. package/dist/Editor/Elements/Embed/EmbedPopup.js +1 -4
  56. package/dist/Editor/Elements/Embed/Image.js +11 -16
  57. package/dist/Editor/Elements/Embed/Video.js +6 -9
  58. package/dist/Editor/Elements/EmbedScript/Code.js +4 -7
  59. package/dist/Editor/Elements/EmbedScript/EmbedScript.js +2 -6
  60. package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +5 -8
  61. package/dist/Editor/Elements/Emoji/EmojiButton.js +2 -6
  62. package/dist/Editor/Elements/Form/FieldPopup.js +1 -4
  63. package/dist/Editor/Elements/Form/Form.js +9 -12
  64. package/dist/Editor/Elements/Form/FormButton.js +2 -6
  65. package/dist/Editor/Elements/Form/FormPopup.js +2 -3
  66. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -18
  67. package/dist/Editor/Elements/Form/Workflow/ListWorkflow.js +8 -13
  68. package/dist/Editor/Elements/Form/Workflow/MoreOptions.js +2 -3
  69. package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -24
  70. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -4
  71. package/dist/Editor/Elements/Form/Workflow/index.js +9 -15
  72. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +23 -67
  73. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +6 -31
  74. package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +2 -6
  75. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +6 -54
  76. package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +2 -3
  77. package/dist/Editor/Elements/FreeGrid/Options/More.js +4 -10
  78. package/dist/Editor/Elements/FreeGrid/styles.js +0 -3
  79. package/dist/Editor/Elements/Grid/Grid.js +10 -13
  80. package/dist/Editor/Elements/Grid/GridButton.js +5 -9
  81. package/dist/Editor/Elements/Grid/GridItem.js +8 -14
  82. package/dist/Editor/Elements/Grid/GridItemPopup.js +1 -4
  83. package/dist/Editor/Elements/Grid/GridPopup.js +1 -4
  84. package/dist/Editor/Elements/Grid/SectionPopup.js +1 -4
  85. package/dist/Editor/Elements/Link/Link.js +5 -8
  86. package/dist/Editor/Elements/Link/LinkButton.js +1 -4
  87. package/dist/Editor/Elements/List/CheckList.js +9 -14
  88. package/dist/Editor/Elements/NewLine/NewLineButton.js +2 -6
  89. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +1 -4
  90. package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +1 -4
  91. package/dist/Editor/Elements/Search/SearchButton.js +4 -7
  92. package/dist/Editor/Elements/Search/SearchList.js +5 -10
  93. package/dist/Editor/Elements/Signature/SignatureButton.js +2 -6
  94. package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +8 -2
  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 +12 -24
  102. package/dist/Editor/Elements/Table/TablePopup.js +1 -4
  103. package/dist/Editor/Elements/Table/TableSelector.js +6 -10
  104. package/dist/Editor/Elements/Table/TableTool.js +4 -8
  105. package/dist/Editor/Elements/Title/title.js +8 -9
  106. package/dist/Editor/Elements/TopBanner/TopBannerButton.js +1 -4
  107. package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
  108. package/dist/Editor/MiniEditor.js +3 -10
  109. package/dist/Editor/Styles/EditorStyles.js +5 -5
  110. package/dist/Editor/Toolbar/Basic/index.js +1 -2
  111. package/dist/Editor/Toolbar/FormatTools/BlockButton.js +2 -6
  112. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
  113. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
  114. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +4 -8
  115. package/dist/Editor/Toolbar/FormatTools/TextSize.js +13 -10
  116. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +5 -17
  117. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +5 -10
  118. package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +4 -10
  119. package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +4 -10
  120. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +3 -9
  121. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +35 -42
  122. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +13 -6
  123. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +51 -58
  124. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectSuperSubscript.js +22 -29
  125. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +87 -226
  126. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +10 -20
  127. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +5 -10
  128. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +11 -71
  129. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +5 -11
  130. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +42 -122
  131. package/dist/Editor/Toolbar/PopupTool/index.js +2 -18
  132. package/dist/Editor/Toolbar/Toolbar.js +10 -20
  133. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  134. package/dist/Editor/common/ColorPickerButton.js +14 -39
  135. package/dist/Editor/common/CustomDialog/index.js +10 -8
  136. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  137. package/dist/Editor/common/FontLoader/FontLoader.js +0 -3
  138. package/dist/Editor/common/Icon.js +1 -31
  139. package/dist/Editor/common/ImageSelector/ImageSelector.js +8 -10
  140. package/dist/Editor/common/ImageSelector/Options/AddLink.js +4 -6
  141. package/dist/Editor/common/ImageSelector/Styles.js +9 -3
  142. package/dist/Editor/common/LinkSettings/NavComponents.js +10 -14
  143. package/dist/Editor/common/LinkSettings/index.js +14 -20
  144. package/dist/Editor/common/LinkSettings/navOptions.js +1 -1
  145. package/dist/Editor/common/MUIIcon/index.js +3 -0
  146. package/dist/Editor/common/MentionsPopup/index.js +2 -6
  147. package/dist/Editor/common/RnD/ContextMenu/CMenus.js +22 -46
  148. package/dist/Editor/common/RnD/ContextMenu/index.js +2 -3
  149. package/dist/Editor/common/RnD/ElementOptions/index.js +2 -7
  150. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +3 -8
  151. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +3 -7
  152. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
  153. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
  154. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
  155. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
  156. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -7
  157. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +2 -3
  158. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
  159. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +2 -6
  160. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
  161. package/dist/Editor/common/RnD/OptionsPopup/index.js +3 -4
  162. package/dist/Editor/common/RnD/ShadowElement.js +1 -2
  163. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +4 -11
  164. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
  165. package/dist/Editor/common/RnD/Utils/gridDropItem.js +8 -55
  166. package/dist/Editor/common/RnD/Utils/index.js +0 -3
  167. package/dist/Editor/common/RnD/VirtualElement/index.js +103 -187
  168. package/dist/Editor/common/RnD/VirtualElement/styles.js +7 -155
  169. package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +3 -5
  170. package/dist/Editor/common/RnD/index.js +13 -69
  171. package/dist/Editor/common/Section/index.js +4 -7
  172. package/dist/Editor/common/Shorthands/elements.js +3 -74
  173. package/dist/Editor/common/StyleBuilder/appHeaderStyle.js +4 -4
  174. package/dist/Editor/common/StyleBuilder/boxStyle.js +2 -2
  175. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -6
  176. package/dist/Editor/common/StyleBuilder/dividerStyles.js +2 -2
  177. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +6 -6
  178. package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -2
  179. package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +9 -13
  180. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +3 -11
  181. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +5 -19
  182. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +10 -22
  183. package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +3 -6
  184. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +13 -27
  185. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +14 -43
  186. package/dist/Editor/common/StyleBuilder/fieldTypes/elementSize.js +6 -10
  187. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +6 -19
  188. package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +2 -6
  189. package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +2 -5
  190. package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +6 -9
  191. package/dist/Editor/common/StyleBuilder/fieldTypes/metaDataMapping.js +2 -8
  192. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +11 -12
  193. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +2 -6
  194. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -8
  195. package/dist/Editor/common/StyleBuilder/fieldTypes/textAlign.js +2 -6
  196. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +12 -21
  197. package/dist/Editor/common/StyleBuilder/formStyle.js +7 -7
  198. package/dist/Editor/common/StyleBuilder/gridItemStyle.js +6 -6
  199. package/dist/Editor/common/StyleBuilder/gridStyle.js +5 -5
  200. package/dist/Editor/common/StyleBuilder/index.js +5 -8
  201. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +7 -5
  202. package/dist/Editor/common/SwipeableDrawer/index.js +1 -1
  203. package/dist/Editor/common/Uploader.js +5 -16
  204. package/dist/Editor/commonStyle.js +57 -68
  205. package/dist/Editor/helper/index.js +3 -27
  206. package/dist/Editor/helper/theme.js +2 -202
  207. package/dist/Editor/hooks/useMouseMove.js +3 -9
  208. package/dist/Editor/plugins/withEmbeds.js +1 -1
  209. package/dist/Editor/plugins/withHTML.js +9 -11
  210. package/dist/Editor/plugins/withLayout.js +2 -3
  211. package/dist/Editor/plugins/withLinks.js +0 -10
  212. package/dist/Editor/plugins/withTable.js +1 -1
  213. package/dist/Editor/theme/ThemeList.js +173 -50
  214. package/dist/Editor/utils/SlateUtilityFunctions.js +50 -178
  215. package/dist/Editor/utils/draftToSlate.js +2 -3
  216. package/dist/Editor/utils/font.js +37 -40
  217. package/dist/Editor/utils/freegrid.js +3 -3
  218. package/dist/Editor/utils/helper.js +21 -92
  219. package/package.json +4 -4
  220. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +0 -444
  221. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -436
  222. package/dist/Editor/assets/svg/ClearAllRounded.js +0 -31
  223. package/dist/Editor/assets/svg/ResetIconNew.js +0 -23
  224. package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
  225. package/dist/Editor/common/CustomColorPicker/index.js +0 -131
  226. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  227. package/dist/Editor/common/CustomDialog2/index.js +0 -94
  228. package/dist/Editor/common/CustomDialog2/style.js +0 -67
  229. package/dist/Editor/common/CustomSelect.js +0 -43
  230. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
  231. package/dist/Editor/common/RnD/VirtualElement/BoxHeaderAutoAlignment.js +0 -43
  232. package/dist/Editor/common/RnD/VirtualElement/ForceAutoAlignment.js +0 -44
  233. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +0 -134
  234. package/dist/Editor/common/RnD/VirtualElement/helper.js +0 -381
  235. package/dist/Editor/common/SnackBar/index.js +0 -43
  236. package/dist/Editor/helper/textIndeces.js +0 -58
  237. package/dist/Editor/hooks/useAutoScroll.js +0 -38
  238. package/dist/Editor/hooks/useEditorTheme.js +0 -153
  239. package/dist/Editor/hooks/useThemeValues.js +0 -63
  240. package/dist/Editor/theme/index.js +0 -149
  241. package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
  242. package/dist/Editor/themeSettings/buttons/index.js +0 -290
  243. package/dist/Editor/themeSettings/buttons/style.js +0 -23
  244. package/dist/Editor/themeSettings/colorTheme/index.js +0 -310
  245. package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
  246. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
  247. package/dist/Editor/themeSettings/fonts/index.js +0 -240
  248. package/dist/Editor/themeSettings/fonts/style.js +0 -61
  249. package/dist/Editor/themeSettings/icons.js +0 -60
  250. package/dist/Editor/themeSettings/index.js +0 -351
  251. package/dist/Editor/themeSettings/style.js +0 -220
  252. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  253. package/dist/Editor/themeSettingsAI/index.js +0 -355
  254. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -205
  255. package/dist/Editor/themeSettingsAI/style.js +0 -259
@@ -1,43 +0,0 @@
1
- import { MenuItem, Select } from "@mui/material";
2
- import { fontFamilyMap } from "../utils/font";
3
- import KeyboardArrowDownRoundedIcon from "@mui/icons-material/KeyboardArrowDownRounded";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- function CustomSelect(props) {
6
- const {
7
- classes,
8
- onChange,
9
- options = [],
10
- value
11
- } = props;
12
- return /*#__PURE__*/_jsx(Select, {
13
- fullWidth: true,
14
- value: value,
15
- onChange: onChange,
16
- className: "editor-dd",
17
- style: {
18
- fontFamily: fontFamilyMap[value],
19
- width: "100%",
20
- height: "36px",
21
- borderRadius: "10px",
22
- fontSize: "14px"
23
- },
24
- MenuProps: {
25
- PaperProps: {
26
- sx: classes?.textOptions
27
- }
28
- },
29
- sx: classes.textFormatSelect,
30
- IconComponent: KeyboardArrowDownRoundedIcon,
31
- children: options.map((option, i) => {
32
- return /*#__PURE__*/_jsx(MenuItem, {
33
- value: option.value,
34
- style: {
35
- fontFamily: option.text || "inherit"
36
- },
37
- sx: classes.textFormatSelectOptions,
38
- children: option?.label || option?.text
39
- }, i);
40
- })
41
- });
42
- }
43
- export default CustomSelect;
@@ -1,17 +0,0 @@
1
- import { Experimental_CssVarsProvider as CssVarsProvider, experimental_extendTheme as extendTheme } from "@mui/material/styles";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- function MainThemeProvider({
4
- children,
5
- userSelectedTheme,
6
- theme = {}
7
- }) {
8
- const themeVars = extendTheme(userSelectedTheme?.theme?.cssVars || {});
9
- return /*#__PURE__*/_jsx(CssVarsProvider, {
10
- theme: {
11
- ...themeVars,
12
- ...theme
13
- },
14
- children: children
15
- });
16
- }
17
- export default MainThemeProvider;
@@ -1,43 +0,0 @@
1
- import { Box } from "@mui/material";
2
- import { useAutoAlignStyles } from "./styles";
3
- import { useEffect, useRef } from "react";
4
- import updateAutoProps from "./updateAutoProps";
5
- import { reRenderChildNodes } from "../Utils/gridDropItem";
6
- import { calculateProps, sortElements } from "./helper";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- const appendItems = (boxCls, virtualRef, ROOT_ITEM_CLASS) => {
9
- const cloneNode = document.querySelector(boxCls)?.cloneNode(true);
10
- const items = cloneNode.querySelectorAll(ROOT_ITEM_CLASS);
11
- if (!cloneNode || !items?.length) {
12
- return;
13
- }
14
- virtualRef.current.innerHTML = "";
15
- const container = virtualRef?.current;
16
- sortElements(items, container);
17
- };
18
- function BoxHeaderAutoAlignment(props) {
19
- const {
20
- editor,
21
- boxCls,
22
- path
23
- } = props;
24
- const classes = useAutoAlignStyles();
25
- const virtualRef = useRef();
26
- useEffect(() => {
27
- const childPathLength = path?.split("|").length + 1;
28
- const ROOT_ITEM_CLASS = `.freegrid-item.path-${childPathLength}`;
29
- appendItems(boxCls, virtualRef, ROOT_ITEM_CLASS);
30
- const allData = calculateProps(path, virtualRef?.current, ROOT_ITEM_CLASS, [], null, true);
31
- updateAutoProps(editor, allData, "xs", true);
32
- const currentSectionPath = path.split("|").map(m => parseInt(m));
33
- reRenderChildNodes(editor, currentSectionPath);
34
- }, []);
35
- return /*#__PURE__*/_jsx(Box, {
36
- className: "header-box-mobile-virtual-mode",
37
- ref: virtualRef,
38
- sx: classes.root,
39
- "aria-hidden": "true",
40
- contentEditable: false
41
- });
42
- }
43
- export default BoxHeaderAutoAlignment;
@@ -1,44 +0,0 @@
1
- import { Box } from "@mui/material";
2
- import { useAutoAlignStyles } from "./styles";
3
- import { useEffect, useRef } from "react";
4
- import { reRenderChildNodes } from "../Utils/gridDropItem";
5
- import updateAutoProps from "./updateAutoProps";
6
- import { calculateProps, sortElements } from "./helper";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- const ROOT_ITEM_CLASS = ".freegrid-item.path-3";
9
- const appendItems = (sectionCls, virtualRef) => {
10
- const cloneNode = document.querySelector(sectionCls)?.cloneNode(true);
11
- const items = cloneNode?.querySelectorAll(ROOT_ITEM_CLASS) || [];
12
- if (!cloneNode || !items?.length) {
13
- return;
14
- }
15
- virtualRef.current.innerHTML = "";
16
- const container = virtualRef?.current;
17
- sortElements(items, container);
18
- };
19
- function ForceAutoAlignment(props) {
20
- const {
21
- editor,
22
- sectionCls,
23
- path,
24
- setAutoAlign
25
- } = props;
26
- const classes = useAutoAlignStyles();
27
- const virtualRef = useRef();
28
- useEffect(() => {
29
- appendItems(sectionCls, virtualRef);
30
- const allData = calculateProps(path, virtualRef?.current, ROOT_ITEM_CLASS, []);
31
- updateAutoProps(editor, allData, "xs", true);
32
- const currentSectionPath = path.split("|").map(m => parseInt(m));
33
- reRenderChildNodes(editor, currentSectionPath);
34
- setAutoAlign(false);
35
- }, []);
36
- return /*#__PURE__*/_jsx(Box, {
37
- className: "force-mobile-virtual-mode",
38
- ref: virtualRef,
39
- sx: classes.root,
40
- "aria-hidden": "true",
41
- contentEditable: false
42
- });
43
- }
44
- export default ForceAutoAlignment;
@@ -1,134 +0,0 @@
1
- import { useEffect, useRef } from "react";
2
- import { Path, Transforms } from "slate";
3
- import { getNode } from "../../../utils/helper";
4
- import { ROW_HEIGHT } from "../Utils/gridDropItem";
5
- import { findFirstRowOverlap, getGridArea, handleContainers, moveOverlappedItems } from "./helper";
6
- import { Box } from "@mui/material";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- const updateTextHeight = (editor, path, height) => {
9
- if (!height) {
10
- return;
11
- }
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) {
17
- return;
18
- }
19
- const textItemIndex = path[parentPath.length];
20
- const textItem = gridItems.find((_, index) => textItemIndex === index);
21
- const {
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
- });
67
- }
68
- };
69
- function VirtualTextElement(props) {
70
- const {
71
- dataSets,
72
- getCurrentEle,
73
- path,
74
- editor
75
- } = props;
76
- const currElement = getCurrentEle();
77
- const textRef = useRef(null);
78
- const prevTextRef = useRef(currElement?.innerText);
79
- useEffect(() => {
80
- const observer = new ResizeObserver(([entry]) => {
81
- if (entry) {
82
- const {
83
- height
84
- } = entry.contentRect;
85
- const currentText = currElement?.innerText;
86
- const prevText = prevTextRef.current;
87
- if (currentText && currentText !== prevText) {
88
- updateTextHeight(editor, path, height);
89
- }
90
- prevTextRef.current = currentText;
91
- }
92
- });
93
- const elementRef = textRef?.current;
94
- if (elementRef) {
95
- observer.observe(elementRef);
96
- }
97
- return () => {
98
- const elementRef = textRef?.current;
99
- if (elementRef) {
100
- observer.unobserve(elementRef);
101
- }
102
- observer.disconnect();
103
- };
104
- }, [currElement?.innerText]);
105
- return /*#__PURE__*/_jsx(Box, {
106
- style: {
107
- position: "fixed",
108
- width: dataSets["data-width-xs"],
109
- minHeight: "fit-content",
110
- visibility: "hidden",
111
- pointerEvents: "none",
112
- right: 100,
113
- top: 100
114
- },
115
- ref: textRef,
116
- sx: {
117
- "& .leaf-item": {
118
- fontSize: "var(--fontSize_xs) !important",
119
- "& span": {
120
- fontSize: "var(--fontSize_xs) !important"
121
- }
122
- },
123
- "& .editor-blocker": {
124
- display: "none"
125
- }
126
- },
127
- dangerouslySetInnerHTML: {
128
- __html: currElement?.innerHTML
129
- },
130
- contentEditable: false,
131
- id: "virtual-text-element"
132
- });
133
- }
134
- export default VirtualTextElement;
@@ -1,381 +0,0 @@
1
- import { ROW_HEIGHT, calculateGridArea } from "../Utils/gridDropItem";
2
- import { Transforms, Editor } from "slate";
3
- const isBulletOrTickIcon = (width, itemStartRow, startRow) => {
4
- return width <= 40 && itemStartRow === startRow;
5
- };
6
- export const findFirstRowOverlap = (gridItems, startRow, endRow, textItemIndex) => {
7
- let firstOverlapRow;
8
- gridItems.forEach((gridItem, index) => {
9
- const {
10
- gridArea_xs: gridArea,
11
- width_xs
12
- } = gridItem;
13
- if (!gridArea) {
14
- return;
15
- }
16
- const [itemStartRow] = getGridArea(gridArea);
17
- const isItemOverlap = itemStartRow >= startRow && itemStartRow <= endRow;
18
- if (isBulletOrTickIcon(width_xs, itemStartRow, startRow)) {
19
- return;
20
- }
21
- const isCurrentEle = textItemIndex === index;
22
- if (isItemOverlap && !isCurrentEle && gridArea) {
23
- firstOverlapRow = firstOverlapRow ? Math.min(firstOverlapRow, itemStartRow) : itemStartRow;
24
- }
25
- });
26
- return firstOverlapRow;
27
- };
28
- export const getHeight = (oldHeight, newHeight) => {
29
- const changeHeight = oldHeight && oldHeight < newHeight;
30
- const height = changeHeight ? newHeight : oldHeight;
31
- return {
32
- height,
33
- changeHeight
34
- };
35
- };
36
- export const getGridArea = gridArea => {
37
- return gridArea.split("/").map(num => parseInt(num));
38
- };
39
- const getBoxToAutoAlign = (editor, sectionPath) => {
40
- const [boxData] = Editor.nodes(editor, {
41
- at: sectionPath,
42
- match: node => node.type === "freegridBox" && node.autoAlign
43
- });
44
- return boxData || [];
45
- };
46
- const handleGridItems = (gridItems, lastRow) => {
47
- // to find the previously occupied rows
48
- gridItems.forEach(item => {
49
- const {
50
- gridArea_xs: gridArea,
51
- marginTop_xs,
52
- height_xs,
53
- type
54
- } = item;
55
- if (type === "paragraph") {
56
- // non-freegridItem,
57
- // some "paragraph" node is defaulty coming inside in box's children
58
- return;
59
- }
60
- const [startRow] = getGridArea(gridArea);
61
- const marginTop = marginTop_xs ? Number(marginTop_xs) : 0;
62
- const fullHeight = Number(height_xs) + marginTop;
63
- const endRow = startRow + Math.floor(fullHeight / ROW_HEIGHT) + 1;
64
- lastRow = Math.max(endRow, lastRow);
65
- });
66
- return {
67
- lastRow
68
- };
69
- };
70
- const handleNonGridItems = (nonGridItems, lastRow, editor, boxPath) => {
71
- let containerHeight = (lastRow - 1) * ROW_HEIGHT;
72
- let newlyAddedHeight = 0;
73
-
74
- //place it on the next rows that are available
75
- nonGridItems.forEach((item, index) => {
76
- const {
77
- height_xs,
78
- type,
79
- itemIndex
80
- } = item;
81
- if (type === "paragraph") {
82
- // non-freegridItem
83
- return;
84
- }
85
- const startRow = lastRow || 1;
86
- const DEFAULT_NEW_ELEMENT_MARGIN_TOP = 12;
87
- let fullHeight = height_xs + DEFAULT_NEW_ELEMENT_MARGIN_TOP;
88
- const endRow = startRow + Math.floor(fullHeight / ROW_HEIGHT) + 1;
89
- const newGridArea = `${startRow} / 1 / ${startRow + 1} / 2`;
90
- const currentElementPath = [...boxPath, itemIndex];
91
- Transforms.setNodes(editor, {
92
- gridArea_xs: newGridArea,
93
- marginTop_xs: 12,
94
- left_xs: 12,
95
- xs_updatedOn: new Date().getTime()
96
- }, {
97
- at: currentElementPath
98
- });
99
- lastRow = Math.max(endRow, lastRow);
100
- containerHeight += fullHeight;
101
- newlyAddedHeight += fullHeight;
102
- });
103
- return {
104
- lastRow,
105
- containerHeight,
106
- newlyAddedHeight
107
- };
108
- };
109
- const alignNewElementInContainer = (editor, boxPath, containerItems) => {
110
- let lastRow = 1;
111
- const gridItems = [];
112
- const nonGridItems = [];
113
- containerItems.forEach((item, index) => {
114
- if (item?.gridArea_xs) {
115
- gridItems.push({
116
- ...item,
117
- itemIndex: index
118
- });
119
- } else {
120
- nonGridItems.push({
121
- ...item,
122
- itemIndex: index
123
- });
124
- }
125
- });
126
- const {
127
- lastRow: lastRowOccupied
128
- } = handleGridItems(gridItems, lastRow);
129
- lastRow = lastRowOccupied;
130
- const {
131
- lastRow: lastRowTaken,
132
- containerHeight,
133
- newlyAddedHeight
134
- } = handleNonGridItems(nonGridItems, lastRow, editor, boxPath);
135
- lastRow = lastRowTaken;
136
- return {
137
- lastRow,
138
- containerHeight,
139
- newlyAddedHeight
140
- };
141
- };
142
- const getAncestorFreeGridContainers = (editor, path) => {
143
- const containers = [...Editor.nodes(editor, {
144
- at: path,
145
- // Start from the current path
146
- match: (node, nodePath) => {
147
- const container = ["freegridBox", "freegrid"].includes(node.type);
148
- return container;
149
- },
150
- reverse: true // Go upwards in the document tree
151
- })].filter(([node, nodePath]) => nodePath.length <= path.length);
152
- return containers;
153
- };
154
- export const handleContainers = (editor, boxPath, extraHeight) => {
155
- const containers = getAncestorFreeGridContainers(editor, boxPath);
156
- let lastChildStartRow;
157
- let lastChildEndRow;
158
- let lastChildPath;
159
- const containerData = [];
160
- for (let i = containers.length - 1; i >= 0; i--) {
161
- const container = containers[i];
162
- const childContainer = containers[i + 1];
163
- const [containerNode, containerPath] = container;
164
- const {
165
- gridArea_xs,
166
- height_xs,
167
- marginTop_xs
168
- } = containerNode;
169
- const [startRow] = gridArea_xs ? getGridArea(gridArea_xs) : [0]; // there is no grid area for section nodes
170
-
171
- let newHeight = Number(height_xs) + extraHeight;
172
- let fullHeight = newHeight + Number(marginTop_xs); // to find end row
173
-
174
- if (!childContainer) {
175
- const endRow = startRow + Math.floor(fullHeight / ROW_HEIGHT) + 1;
176
- containerData.push({
177
- moveRows: 0,
178
- extraHeight,
179
- containerPath,
180
- newHeight,
181
- containerNode,
182
- lastChildStartRow
183
- });
184
- lastChildStartRow = startRow;
185
- lastChildEndRow = endRow;
186
- } else {
187
- const lastChildIndex = lastChildPath[containerPath.length];
188
- const firstOverlappedRow = findFirstRowOverlap(containerNode?.children, lastChildStartRow, lastChildEndRow, lastChildIndex);
189
- const moveRows = firstOverlappedRow ? lastChildEndRow - firstOverlappedRow : 0;
190
- newHeight = newHeight + moveRows * ROW_HEIGHT;
191
- fullHeight = newHeight + Number(marginTop_xs);
192
- const newEndRow = startRow + Math.floor(fullHeight / ROW_HEIGHT) + 1;
193
- containerData.push({
194
- moveRows,
195
- extraHeight,
196
- childIndex: lastChildIndex,
197
- newHeight,
198
- containerPath,
199
- containerNode,
200
- lastChildStartRow
201
- });
202
- lastChildStartRow = startRow;
203
- lastChildEndRow = newEndRow;
204
- }
205
- lastChildPath = containerPath;
206
- }
207
- return containerData;
208
- };
209
- export const moveOverlappedItems = (editor, moveRows, containerItems, containerPath, childIndex, lastChildStartRow) => {
210
- containerItems?.forEach((gridItem, index) => {
211
- const isChildEle = childIndex === index;
212
- if (isChildEle) {
213
- return;
214
- }
215
- if (gridItem.type === "paragraph") {
216
- return;
217
- }
218
- const {
219
- gridArea_xs: gridArea,
220
- width_xs
221
- } = gridItem;
222
- const [itemStartRow] = getGridArea(gridArea);
223
- if (isBulletOrTickIcon(width_xs, itemStartRow, lastChildStartRow)) {
224
- return;
225
- }
226
- if (itemStartRow >= lastChildStartRow) {
227
- const row = itemStartRow + moveRows;
228
- const newGridArea = `${row} / 1 / ${row + 1} / 2`;
229
- const currentElementPath = [...containerPath, index];
230
- Transforms.setNodes(editor, {
231
- gridArea_xs: newGridArea
232
- }, {
233
- at: currentElementPath
234
- });
235
- }
236
- });
237
- };
238
- export const handleBoxAlignment = (editor, sectionNode, sectionPath) => {
239
- const [boxNode, boxPath] = getBoxToAutoAlign(editor, sectionPath);
240
- Transforms.setNodes(editor, {
241
- autoAlign: false
242
- }, {
243
- at: boxPath
244
- });
245
- if (!boxNode) {
246
- return;
247
- }
248
- const containerItems = boxNode?.children || [];
249
- const {
250
- containerHeight
251
- } = alignNewElementInContainer(editor, boxPath, containerItems);
252
- const bufferHeight = 12;
253
- const newHeight = containerHeight + bufferHeight;
254
- const {
255
- height_xs
256
- } = boxNode;
257
- const oldHeight = Number(height_xs);
258
- const extraHeight = newHeight - oldHeight;
259
- if (extraHeight > 0) {
260
- const containerData = handleContainers(editor, boxPath, extraHeight);
261
- containerData.forEach(container => {
262
- const {
263
- moveRows,
264
- containerNode,
265
- containerPath,
266
- newHeight,
267
- childIndex,
268
- lastChildStartRow
269
- } = container;
270
- if (moveRows) {
271
- moveOverlappedItems(editor, moveRows, containerNode?.children, containerPath, childIndex, lastChildStartRow);
272
- }
273
- Transforms.setNodes(editor, {
274
- height_xs: newHeight,
275
- xs_updatedOn: new Date().getTime()
276
- }, {
277
- at: containerPath
278
- });
279
- });
280
- }
281
- };
282
- export const getMarginTop = y => {
283
- const calcMargin = y % ROW_HEIGHT;
284
- return calcMargin <= 0 ? 0 : calcMargin;
285
- };
286
- export const calculateProps = (curPath, dom, domClass, allData, parentDom, isBoxHeader) => {
287
- const rect = dom?.getBoundingClientRect();
288
- const bufferHeight = parentDom ? 0 : 12;
289
- const sectionProps = {
290
- path: curPath,
291
- props: {
292
- height: rect?.height + bufferHeight
293
- }
294
- };
295
- const itemsData = [];
296
- const items = dom.querySelectorAll(domClass);
297
- const nextItemPathLength = curPath?.split("|").length + 2;
298
- let sectionHeight = 12;
299
- for (let i = 0; i < items.length; i++) {
300
- const itemRect = items[i]?.getBoundingClientRect();
301
- if (items[i]?.classList.contains("type_box")) {
302
- allData = calculateProps(items[i]?.dataset.path, items[i], `.freegrid-item.path-${nextItemPathLength}`, allData, dom);
303
- } else {
304
- const y = Math.abs(rect.top - itemRect?.top);
305
- const left = Math.abs(rect.left - itemRect?.left);
306
- const isAppHeader = isBoxHeader || dom?.classList?.contains("appHeaderBox");
307
- itemsData.push({
308
- path: items[i]?.dataset.path,
309
- props: {
310
- top: y,
311
- left: isAppHeader ? left : 24,
312
- marginTop: getMarginTop(y),
313
- width: itemRect?.width,
314
- height: itemRect?.height,
315
- gridArea: calculateGridArea(y)
316
- }
317
- });
318
- sectionHeight += itemRect?.height;
319
- }
320
- }
321
- if (dom?.classList.contains("type_box") && parentDom) {
322
- const parentDomRect = parentDom?.getBoundingClientRect();
323
- const isAppHeader = isBoxHeader || dom?.classList.contains("appHeaderBox");
324
- const y = Math.abs(parentDomRect.top - rect?.top);
325
- sectionProps.props.gridArea = calculateGridArea(y);
326
- sectionProps.props.left = isAppHeader ? 6 : 24;
327
- sectionProps.props.marginTop = getMarginTop(y);
328
- sectionProps.props.width = rect?.width;
329
- }
330
- allData = [sectionProps, [...allData, ...itemsData]]?.flat();
331
- return allData;
332
- };
333
- export const sortElements = (items, container) => {
334
- const elementsArray = Array.from(items);
335
- elementsArray.sort((a, b) => {
336
- const aGridArea = a.dataset.gridAreaXs;
337
- const bGridArea = b.dataset.gridAreaXs;
338
-
339
- // If either element has no gridArea, push it to the end
340
- if (!aGridArea) return 1;
341
- if (!bGridArea) return -1;
342
- const [aRow] = aGridArea.split("/").map(Number);
343
- const [bRow] = bGridArea.split("/").map(Number);
344
- if (aRow !== bRow) {
345
- return aRow - bRow; // Sort by start row first
346
- }
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
- }
354
- const aLeft = parseFloat(a.dataset.leftXs) || 0;
355
- const bLeft = parseFloat(b.dataset.leftXs) || 0;
356
- return aLeft - bLeft;
357
- });
358
-
359
- // Append sorted elements to container
360
- elementsArray.forEach(item => {
361
- container.appendChild(item);
362
-
363
- // If item is a box, recursively sort its children
364
- if (item.classList.contains("type_box")) {
365
- const nestedContainer = item.querySelector(":scope > .fgi_type_box");
366
- const isAppHeader = item.querySelector(".type_appHeader");
367
- if (isAppHeader) {
368
- item.classList.add("appHeaderBox");
369
- }
370
- if (nestedContainer) {
371
- const childToRemove = nestedContainer.querySelector(":scope > .simple-text");
372
- if (childToRemove) {
373
- nestedContainer.removeChild(childToRemove);
374
- }
375
- const children = nestedContainer.children;
376
- sortElements(children, nestedContainer);
377
- item.appendChild(nestedContainer);
378
- }
379
- }
380
- });
381
- };
@@ -1,43 +0,0 @@
1
- import Snackbar from "@mui/material/Snackbar";
2
- import Alert from "@mui/material/Alert";
3
- import { useState } from "react";
4
- import { useEditorContext } from "../../hooks/useMouseMove";
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- const SnackbarAlert = ({
7
- message,
8
- setShowSnackBar,
9
- severity = "info"
10
- }) => {
11
- const [open, setOpen] = useState(!!message);
12
- const {
13
- theme
14
- } = useEditorContext();
15
- return /*#__PURE__*/_jsx(Snackbar, {
16
- open: open,
17
- autoHideDuration: 3000,
18
- onClose: () => {
19
- setOpen(false);
20
- setShowSnackBar(false);
21
- },
22
- anchorOrigin: {
23
- vertical: "top",
24
- horizontal: "right"
25
- },
26
- children: /*#__PURE__*/_jsx(Alert, {
27
- severity: severity,
28
- onClose: () => {
29
- setOpen(false);
30
- setShowSnackBar(false);
31
- },
32
- sx: {
33
- background: theme?.palette?.primary?.gradientBtn,
34
- color: "#FFFFFF",
35
- "& .MuiAlert-icon": {
36
- color: "#FFFFFF"
37
- }
38
- },
39
- children: message
40
- })
41
- });
42
- };
43
- export default SnackbarAlert;