@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,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,110 +0,0 @@
1
- import { Box } from "@mui/material";
2
- import { useAutoAlignStyles } from "./styles";
3
- import { useEffect, useRef } from "react";
4
- import { ROW_HEIGHT, calculateGridArea, reRenderChildNodes } from "../Utils/gridDropItem";
5
- import updateAutoProps from "./updateAutoProps";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- const ROOT_ITEM_CLASS = ".freegrid-item.path-3";
8
- const getMarginTop = y => {
9
- const calcMargin = y % ROW_HEIGHT;
10
- return calcMargin <= 0 ? 0 : calcMargin;
11
- };
12
- function ForceAutoAlignment(props) {
13
- const {
14
- editor,
15
- sectionCls,
16
- path,
17
- autoAlign,
18
- setAutoAlign
19
- } = props;
20
- const classes = useAutoAlignStyles();
21
- const virtualRef = useRef();
22
- useEffect(() => {
23
- let timeoutId;
24
- if (virtualRef?.current && autoAlign) {
25
- timeoutId = setTimeout(() => {
26
- const allData = calculateProps(path, virtualRef?.current, ROOT_ITEM_CLASS, []);
27
- updateAutoProps(editor, allData, "xs", true);
28
- const currentSectionPath = path.split("|").map(m => parseInt(m));
29
- reRenderChildNodes(editor, currentSectionPath);
30
- setAutoAlign(false);
31
- }, 100);
32
- }
33
- return () => {
34
- if (timeoutId) {
35
- clearTimeout(timeoutId);
36
- }
37
- };
38
- }, [autoAlign, virtualRef?.current]);
39
- const calculateProps = (curPath, dom, domClass, allData, parentDom) => {
40
- const rect = dom?.getBoundingClientRect();
41
- const bufferHeight = parentDom ? 0 : 12;
42
- const sectionProps = {
43
- path: curPath,
44
- props: {
45
- height: rect?.height + bufferHeight
46
- }
47
- };
48
- const itemsData = [];
49
- const items = dom.querySelectorAll(domClass);
50
- const nextItemPathLength = curPath?.split("|").length + 2;
51
- // let sectionHeight = 12;
52
- for (let i = 0; i < items.length; i++) {
53
- const itemRect = items[i]?.getBoundingClientRect();
54
- if (items[i]?.classList.contains("type_box")) {
55
- allData = calculateProps(items[i]?.dataset.path, items[i], `.freegrid-item.path-${nextItemPathLength}`, allData, dom);
56
- } else {
57
- const y = Math.abs(rect.top - itemRect?.top);
58
- itemsData.push({
59
- path: items[i]?.dataset.path,
60
- props: {
61
- top: y,
62
- left: 24,
63
- marginTop: getMarginTop(y),
64
- width: itemRect?.width,
65
- height: itemRect?.height,
66
- gridArea: calculateGridArea(y)
67
- }
68
- });
69
- // sectionHeight += itemRect?.height;
70
- }
71
- }
72
-
73
- if (dom?.classList.contains("type_box") && parentDom) {
74
- const parentDomRect = parentDom?.getBoundingClientRect();
75
- const y = Math.abs(parentDomRect.top - rect?.top);
76
- sectionProps.props.gridArea = calculateGridArea(y);
77
- sectionProps.props.left = 24;
78
- sectionProps.props.marginTop = getMarginTop(y);
79
- sectionProps.props.width = rect?.width;
80
- }
81
- allData = [sectionProps, [...allData, ...itemsData]]?.flat();
82
- return allData;
83
- };
84
- const getItems = () => {
85
- const cloneNode = document.querySelector(sectionCls)?.cloneNode(true);
86
- const items = cloneNode?.querySelectorAll(ROOT_ITEM_CLASS) || [];
87
- if (!cloneNode || !items?.length) {
88
- return;
89
- }
90
- let itemsHTML = "";
91
- for (let i = 0; i < items?.length; i++) {
92
- items[i].classList.add("exclude-virtual");
93
- itemsHTML += items[i].outerHTML;
94
- }
95
- return itemsHTML;
96
- };
97
- return /*#__PURE__*/_jsx(Box, {
98
- className: "force-mobile-virtual-mode",
99
- ref: virtualRef,
100
- sx: {
101
- visibility: "hidden",
102
- ...classes.root
103
- },
104
- "aria-hidden": "true",
105
- dangerouslySetInnerHTML: {
106
- __html: getItems()
107
- }
108
- });
109
- }
110
- export default ForceAutoAlignment;
@@ -1,112 +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 { jsx as _jsx } from "react/jsx-runtime";
7
- const updateTextHeight = (editor, path, height) => {
8
- if (!height) {
9
- return;
10
- }
11
- const parentPath = Path.parent(path);
12
- const currentNode = getNode(editor, parentPath);
13
- const gridItems = currentNode?.children || [];
14
- const isNewlyAddedElement = gridItems.some(gridItem => !gridItem.gridArea_xs && gridItem.type !== "paragraph");
15
- if (isNewlyAddedElement) {
16
- return;
17
- }
18
- const textItemIndex = path[parentPath.length];
19
- const textItem = gridItems.find((_, index) => textItemIndex === index);
20
- const {
21
- marginTop_xs: marginTop,
22
- gridArea_xs: gridArea,
23
- height_xs
24
- } = textItem;
25
- const oldHeight = height_xs + marginTop;
26
- const newHeight = height + marginTop;
27
- const extraHeight = newHeight - oldHeight;
28
- let containerExtraHeight = extraHeight;
29
- if (extraHeight > 0) {
30
- const [startRow] = getGridArea(gridArea);
31
- const newRows = Math.floor(newHeight / ROW_HEIGHT) + 1;
32
- const endRow = startRow + newRows;
33
- const firstOverlappedRow = findFirstRowOverlap(gridItems, startRow, endRow, textItemIndex);
34
- if (firstOverlappedRow) {
35
- const moveRows = endRow - firstOverlappedRow;
36
- moveOverlappedItems(editor, moveRows, gridItems, parentPath, textItemIndex, startRow);
37
- containerExtraHeight += moveRows * ROW_HEIGHT;
38
- }
39
-
40
- // handle containers (box and section)
41
- const containerData = handleContainers(editor, parentPath, containerExtraHeight);
42
- containerData.forEach(container => {
43
- const {
44
- moveRows,
45
- containerNode,
46
- containerPath,
47
- newHeight,
48
- childIndex,
49
- lastChildStartRow
50
- } = container;
51
- if (moveRows) {
52
- moveOverlappedItems(editor, moveRows, containerNode?.children, containerPath, childIndex, lastChildStartRow);
53
- }
54
- Transforms.setNodes(editor, {
55
- height_xs: newHeight,
56
- xs_updatedOn: new Date().getTime()
57
- }, {
58
- at: containerPath
59
- });
60
- });
61
- Transforms.setNodes(editor, {
62
- height_xs: height
63
- }, {
64
- at: path
65
- });
66
- }
67
- };
68
- function VirtualTextElement(props) {
69
- const {
70
- dataSets,
71
- getCurrentEle,
72
- path,
73
- editor
74
- } = props;
75
- const textRef = useRef(null);
76
- const currElement = getCurrentEle();
77
- useEffect(() => {
78
- const observer = new ResizeObserver(([entry]) => {
79
- if (entry) {
80
- const {
81
- height
82
- } = entry.contentRect;
83
- updateTextHeight(editor, path, height);
84
- }
85
- });
86
- const elementRef = textRef?.current;
87
- if (elementRef) {
88
- observer.observe(elementRef);
89
- }
90
- return () => {
91
- const elementRef = textRef?.current;
92
- if (elementRef) {
93
- observer.unobserve(elementRef);
94
- }
95
- observer.disconnect();
96
- };
97
- }, []);
98
- return /*#__PURE__*/_jsx("div", {
99
- style: {
100
- position: "fixed",
101
- width: dataSets["data-width-xs"],
102
- minHeight: "fit-content",
103
- visibility: "hidden",
104
- pointerEvents: "none",
105
- right: 0,
106
- top: 0
107
- },
108
- ref: textRef,
109
- children: currElement?.innerText
110
- });
111
- }
112
- export default VirtualTextElement;
@@ -1,267 +0,0 @@
1
- import { ROW_HEIGHT } from "../Utils/gridDropItem";
2
- import { Transforms, Editor } from "slate";
3
- export const findFirstRowOverlap = (gridItems, startRow, endRow, textItemIndex) => {
4
- let firstOverlapRow;
5
- gridItems.forEach((gridItem, index) => {
6
- const {
7
- gridArea_xs: gridArea
8
- } = gridItem;
9
- if (!gridArea) {
10
- return;
11
- }
12
- const [itemStartRow] = getGridArea(gridArea);
13
- const isItemOverlap = itemStartRow >= startRow && itemStartRow <= endRow;
14
- const isCurrentEle = textItemIndex === index;
15
- if (isItemOverlap && !isCurrentEle && gridArea) {
16
- firstOverlapRow = firstOverlapRow ? Math.min(firstOverlapRow, itemStartRow) : itemStartRow;
17
- }
18
- });
19
- return firstOverlapRow;
20
- };
21
- export const getHeight = (oldHeight, newHeight) => {
22
- const changeHeight = oldHeight && oldHeight < newHeight;
23
- const height = changeHeight ? newHeight : oldHeight;
24
- return {
25
- height,
26
- changeHeight
27
- };
28
- };
29
- export const getGridArea = gridArea => {
30
- return gridArea.split("/").map(num => parseInt(num));
31
- };
32
- const getBoxToAutoAlign = (editor, sectionPath) => {
33
- const [boxData] = Editor.nodes(editor, {
34
- at: sectionPath,
35
- match: node => node.type === "freegridBox" && node.autoAlign
36
- });
37
- return boxData;
38
- };
39
- const handleGridItems = (gridItems, lastRow) => {
40
- // to find the previously occupied rows
41
- gridItems.forEach(item => {
42
- const {
43
- gridArea_xs: gridArea,
44
- marginTop_xs,
45
- height_xs,
46
- type
47
- } = item;
48
- if (type === "paragraph") {
49
- // non-freegridItem,
50
- // some "paragraph" node is defaulty coming inside in box's children
51
- return;
52
- }
53
- const [startRow] = getGridArea(gridArea);
54
- const marginTop = marginTop_xs ? Number(marginTop_xs) : 0;
55
- const fullHeight = Number(height_xs) + marginTop;
56
- const endRow = startRow + Math.floor(fullHeight / ROW_HEIGHT) + 1;
57
- lastRow = Math.max(endRow, lastRow);
58
- });
59
- return {
60
- lastRow
61
- };
62
- };
63
- const handleNonGridItems = (nonGridItems, lastRow, editor, boxPath) => {
64
- let containerHeight = (lastRow - 1) * ROW_HEIGHT;
65
- let newlyAddedHeight = 0;
66
-
67
- //place it on the next rows that are available
68
- nonGridItems.forEach((item, index) => {
69
- const {
70
- height_xs,
71
- type,
72
- itemIndex
73
- } = item;
74
- if (type === "paragraph") {
75
- // non-freegridItem
76
- return;
77
- }
78
- const startRow = lastRow || 1;
79
- const DEFAULT_NEW_ELEMENT_MARGIN_TOP = 12;
80
- let fullHeight = height_xs + DEFAULT_NEW_ELEMENT_MARGIN_TOP;
81
- const endRow = startRow + Math.floor(fullHeight / ROW_HEIGHT) + 1;
82
- const newGridArea = `${startRow} / 1 / ${startRow + 1} / 2`;
83
- const currentElementPath = [...boxPath, itemIndex];
84
- Transforms.setNodes(editor, {
85
- gridArea_xs: newGridArea,
86
- marginTop_xs: 12,
87
- left_xs: 12,
88
- xs_updatedOn: new Date().getTime()
89
- }, {
90
- at: currentElementPath
91
- });
92
- lastRow = Math.max(endRow, lastRow);
93
- containerHeight += fullHeight;
94
- newlyAddedHeight += fullHeight;
95
- });
96
- return {
97
- lastRow,
98
- containerHeight,
99
- newlyAddedHeight
100
- };
101
- };
102
- const alignNewElementInContainer = (editor, boxPath, containerItems) => {
103
- let lastRow = 1;
104
- const gridItems = [];
105
- const nonGridItems = [];
106
- containerItems.forEach((item, index) => {
107
- if (item?.gridArea_xs) {
108
- gridItems.push({
109
- ...item,
110
- itemIndex: index
111
- });
112
- } else {
113
- nonGridItems.push({
114
- ...item,
115
- itemIndex: index
116
- });
117
- }
118
- });
119
- const {
120
- lastRow: lastRowOccupied
121
- } = handleGridItems(gridItems, lastRow);
122
- lastRow = lastRowOccupied;
123
- const {
124
- lastRow: lastRowTaken,
125
- containerHeight,
126
- newlyAddedHeight
127
- } = handleNonGridItems(nonGridItems, lastRow, editor, boxPath);
128
- lastRow = lastRowTaken;
129
- return {
130
- lastRow,
131
- containerHeight,
132
- newlyAddedHeight
133
- };
134
- };
135
- const getAncestorFreeGridContainers = (editor, path) => {
136
- const containers = [...Editor.nodes(editor, {
137
- at: path,
138
- // Start from the current path
139
- match: (node, nodePath) => {
140
- const container = ["freegridBox", "freegrid"].includes(node.type);
141
- return container;
142
- },
143
- reverse: true // Go upwards in the document tree
144
- })].filter(([node, nodePath]) => nodePath.length <= path.length);
145
- return containers;
146
- };
147
- export const handleContainers = (editor, boxPath, extraHeight) => {
148
- const containers = getAncestorFreeGridContainers(editor, boxPath);
149
- let lastChildStartRow;
150
- let lastChildEndRow;
151
- let lastChildPath;
152
- const containerData = [];
153
- for (let i = containers.length - 1; i >= 0; i--) {
154
- const container = containers[i];
155
- const childContainer = containers[i + 1];
156
- const [containerNode, containerPath] = container;
157
- const {
158
- gridArea_xs,
159
- height_xs,
160
- marginTop_xs
161
- } = containerNode;
162
- const [startRow] = gridArea_xs ? getGridArea(gridArea_xs) : [0]; // there is no grid area for section nodes
163
-
164
- let newHeight = Number(height_xs) + extraHeight;
165
- let fullHeight = newHeight + Number(marginTop_xs); // to find end row
166
-
167
- if (!childContainer) {
168
- const endRow = startRow + Math.floor(fullHeight / ROW_HEIGHT) + 1;
169
- containerData.push({
170
- moveRows: 0,
171
- extraHeight,
172
- containerPath,
173
- newHeight,
174
- containerNode,
175
- lastChildStartRow
176
- });
177
- lastChildStartRow = startRow;
178
- lastChildEndRow = endRow;
179
- } else {
180
- const lastChildIndex = lastChildPath[containerPath.length];
181
- const firstOverlappedRow = findFirstRowOverlap(containerNode?.children, lastChildStartRow, lastChildEndRow, lastChildIndex);
182
- const moveRows = firstOverlappedRow ? lastChildEndRow - firstOverlappedRow : 0;
183
- newHeight = newHeight + moveRows * ROW_HEIGHT;
184
- fullHeight = newHeight + Number(marginTop_xs);
185
- const newEndRow = startRow + Math.floor(fullHeight / ROW_HEIGHT) + 1;
186
- containerData.push({
187
- moveRows,
188
- extraHeight,
189
- childIndex: lastChildIndex,
190
- newHeight,
191
- containerPath,
192
- containerNode,
193
- lastChildStartRow
194
- });
195
- lastChildStartRow = startRow;
196
- lastChildEndRow = newEndRow;
197
- }
198
- lastChildPath = containerPath;
199
- }
200
- return containerData;
201
- };
202
- export const moveOverlappedItems = (editor, moveRows, containerItems, containerPath, childIndex, lastChildStartRow) => {
203
- containerItems?.forEach((gridItem, index) => {
204
- const isChildEle = childIndex === index;
205
- if (isChildEle) {
206
- return;
207
- }
208
- if (gridItem.type === "paragraph") {
209
- return;
210
- }
211
- const {
212
- gridArea_xs: gridArea
213
- } = gridItem;
214
- const [itemStartRow] = getGridArea(gridArea);
215
- if (itemStartRow >= lastChildStartRow) {
216
- const row = itemStartRow + moveRows;
217
- const newGridArea = `${row} / 1 / ${row + 1} / 2`;
218
- const currentElementPath = [...containerPath, index];
219
- Transforms.setNodes(editor, {
220
- gridArea_xs: newGridArea
221
- }, {
222
- at: currentElementPath
223
- });
224
- }
225
- });
226
- };
227
- export const handleBoxAlignment = (editor, sectionNode, sectionPath) => {
228
- const [boxNode, boxPath] = getBoxToAutoAlign(editor, sectionPath);
229
- Transforms.setNodes(editor, {
230
- autoAlign: false
231
- }, {
232
- at: boxPath
233
- });
234
- const containerItems = boxNode?.children || [];
235
- const {
236
- containerHeight
237
- } = alignNewElementInContainer(editor, boxPath, containerItems);
238
- const bufferHeight = 12;
239
- const newHeight = containerHeight + bufferHeight;
240
- const {
241
- height_xs
242
- } = boxNode;
243
- const oldHeight = Number(height_xs);
244
- const extraHeight = newHeight - oldHeight;
245
- if (extraHeight > 0) {
246
- const containerData = handleContainers(editor, boxPath, extraHeight);
247
- containerData.forEach(container => {
248
- const {
249
- moveRows,
250
- containerNode,
251
- containerPath,
252
- newHeight,
253
- childIndex,
254
- lastChildStartRow
255
- } = container;
256
- if (moveRows) {
257
- moveOverlappedItems(editor, moveRows, containerNode?.children, containerPath, childIndex, lastChildStartRow);
258
- }
259
- Transforms.setNodes(editor, {
260
- height_xs: newHeight,
261
- xs_updatedOn: new Date().getTime()
262
- }, {
263
- at: containerPath
264
- });
265
- });
266
- }
267
- };
@@ -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;
@@ -1,58 +0,0 @@
1
- export function extractTextWithPath(data, path = []) {
2
- let result = [];
3
- data.forEach((item, index) => {
4
- const currentPath = [...path, index];
5
- if (item.text) {
6
- result.push({
7
- path_id: currentPath.join(","),
8
- text: item.text
9
- });
10
- }
11
- if (item.children) {
12
- result = result.concat(extractTextWithPath(item.children, currentPath));
13
- }
14
- });
15
- return result;
16
- }
17
- export function replaceTextPath(nestedJson, pathIdJson) {
18
- // Create a map from path_id JSON for quick lookup
19
- const pathIdMap = new Map(pathIdJson.map(item => [item.path_id, item.text]));
20
- console.log(pathIdMap);
21
- function extractTextWithPath(data, path = []) {
22
- data.forEach((item, index) => {
23
- const currentPath = [...path, index];
24
- if (item.text) {
25
- if (pathIdMap.has(currentPath?.join(","))) {
26
- item.text = pathIdMap.get(currentPath?.join(","));
27
- }
28
- }
29
- if (item.children) {
30
- extractTextWithPath(item.children, currentPath);
31
- }
32
- });
33
- }
34
- extractTextWithPath(nestedJson, []);
35
- return nestedJson;
36
- }
37
-
38
- // export function replaceTextPath(nestedJson, pathIdJson) {
39
- // // Create a map from path_id JSON for quick lookup
40
- // const pathIdMap = new Map(
41
- // pathIdJson.map((item) => [item.path_id, item.text])
42
- // );
43
-
44
- // function traverseAndReplace(node) {
45
- // if (Array.isArray(node)) {
46
- // node.forEach(traverseAndReplace);
47
- // } else if (typeof node === "object" && node !== null) {
48
- // console.log(node);
49
- // if (node.text && pathIdMap.has(node.text)) {
50
- // node.text = pathIdMap.get(node.path_id);
51
- // }
52
- // Object.values(node).forEach(traverseAndReplace);
53
- // }
54
- // }
55
-
56
- // traverseAndReplace(nestedJson);
57
- // return nestedJson;
58
- // }
@@ -1,38 +0,0 @@
1
- import { useEffect, useRef } from "react";
2
- function useAutoScroll(speed = 10, scrollElementId = "slate-wrapper-scroll-container") {
3
- const scrollInterval = useRef(null);
4
- function getScrollElement() {
5
- return document.getElementById(scrollElementId) || window;
6
- }
7
- function startAutoScroll(direction) {
8
- if (scrollInterval.current) return; // Prevent multiple intervals
9
-
10
- const scrollContainer = getScrollElement();
11
- scrollInterval.current = setInterval(() => {
12
- scrollContainer.style.scrollBehavior = "auto";
13
- if (direction === "up") {
14
- scrollContainer.scrollBy(0, -speed);
15
- } else if (direction === "down") {
16
- scrollContainer.scrollBy(0, speed);
17
- scrollContainer.style.scrollBehavior = "smooth";
18
- }
19
- }, 16); // Approx 60fps
20
- }
21
-
22
- function stopAutoScroll() {
23
- if (scrollInterval.current) {
24
- clearInterval(scrollInterval.current);
25
- scrollInterval.current = null;
26
- const scrollContainer = getScrollElement();
27
- scrollContainer.style.scrollBehavior = "smooth";
28
- }
29
- }
30
- useEffect(() => {
31
- return () => stopAutoScroll(); // Cleanup on unmount
32
- }, []);
33
- return {
34
- startAutoScroll,
35
- stopAutoScroll
36
- };
37
- }
38
- export default useAutoScroll;