@flozy/editor 3.8.8 → 3.8.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. package/dist/Editor/ChatEditor.js +31 -57
  2. package/dist/Editor/CommonEditor.js +69 -8
  3. package/dist/Editor/DialogWrapper.js +4 -3
  4. package/dist/Editor/Editor.css +5 -12
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +47 -36
  6. package/dist/Editor/Elements/Accordion/Accordion.js +1 -1
  7. package/dist/Editor/Elements/Accordion/AccordionSummary.js +6 -20
  8. package/dist/Editor/Elements/AppHeader/AppHeader.js +36 -23
  9. package/dist/Editor/Elements/Button/EditorButton.js +23 -16
  10. package/dist/Editor/Elements/Embed/Image.js +15 -14
  11. package/dist/Editor/Elements/Embed/Video.js +12 -8
  12. package/dist/Editor/Elements/Emoji/EmojiButton.js +11 -7
  13. package/dist/Editor/Elements/Emoji/EmojiPicker.js +2 -4
  14. package/dist/Editor/Elements/Form/Form.js +1 -1
  15. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +391 -0
  16. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +193 -0
  17. package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +23 -0
  18. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +184 -0
  19. package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +36 -0
  20. package/dist/Editor/Elements/FreeGrid/Options/More.js +24 -0
  21. package/dist/Editor/Elements/FreeGrid/Options/SectionSettings.js +47 -0
  22. package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +11 -0
  23. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +75 -0
  24. package/dist/Editor/Elements/FreeGrid/styles.js +159 -0
  25. package/dist/Editor/Elements/Grid/Grid.js +12 -8
  26. package/dist/Editor/Elements/Grid/GridItem.js +31 -21
  27. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +1 -5
  28. package/dist/Editor/Elements/SimpleText/index.js +9 -8
  29. package/dist/Editor/Elements/SimpleText/style.js +37 -0
  30. package/dist/Editor/ErrorBoundary.js +30 -0
  31. package/dist/Editor/Styles/EditorStyles.js +23 -0
  32. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -25
  33. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +1 -0
  34. package/dist/Editor/Toolbar/PopupTool/index.js +8 -0
  35. package/dist/Editor/Toolbar/Toolbar.js +7 -0
  36. package/dist/Editor/Toolbar/toolbarGroups.js +5 -0
  37. package/dist/Editor/common/Icon.js +9 -2
  38. package/dist/Editor/common/MentionsPopup/MentionsListCard.js +1 -6
  39. package/dist/Editor/common/MentionsPopup/index.js +12 -8
  40. package/dist/Editor/common/RnD/ContextMenu/CMenus.js +105 -0
  41. package/dist/Editor/common/RnD/ContextMenu/index.js +38 -0
  42. package/dist/Editor/common/RnD/ContextMenu/styles.js +21 -0
  43. package/dist/Editor/common/RnD/DragInfo/index.js +31 -0
  44. package/dist/Editor/common/RnD/DragInfo/styles.js +15 -0
  45. package/dist/Editor/common/RnD/DragOver/index.js +46 -0
  46. package/dist/Editor/common/RnD/DragOver/styles.js +23 -0
  47. package/dist/Editor/common/RnD/ElementOptions/Actions.js +82 -0
  48. package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +26 -0
  49. package/dist/Editor/common/RnD/ElementOptions/index.js +93 -0
  50. package/dist/Editor/common/RnD/ElementOptions/styles.js +41 -0
  51. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Link.js +153 -0
  52. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +58 -0
  53. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +7 -0
  54. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +46 -0
  55. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +46 -0
  56. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +46 -0
  57. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +30 -0
  58. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +46 -0
  59. package/dist/Editor/common/RnD/ElementSettings/Settings/index.js +13 -0
  60. package/dist/Editor/common/RnD/ElementSettings/index.js +17 -0
  61. package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +14 -0
  62. package/dist/Editor/common/RnD/ElementSettings/styles.js +76 -0
  63. package/dist/Editor/common/RnD/GuideLines/BoundaryLine.js +52 -0
  64. package/dist/Editor/common/RnD/GuideLines/index.js +33 -0
  65. package/dist/Editor/common/RnD/GuideLines/styles.js +60 -0
  66. package/dist/Editor/common/RnD/OptionsPopup/index.js +50 -0
  67. package/dist/Editor/common/RnD/OptionsPopup/style.js +36 -0
  68. package/dist/Editor/common/RnD/RnDCopy.js +23 -0
  69. package/dist/Editor/common/RnD/ShadowElement.js +34 -0
  70. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +40 -0
  71. package/dist/Editor/common/RnD/SwitchViewport/styles.js +24 -0
  72. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +63 -0
  73. package/dist/Editor/common/RnD/TransformHandles/CornerHandle.js +19 -0
  74. package/dist/Editor/common/RnD/TransformHandles/Icons/BottomRightIcon.js +13 -0
  75. package/dist/Editor/common/RnD/TransformHandles/SizeHandle.js +18 -0
  76. package/dist/Editor/common/RnD/TransformHandles/index.js +62 -0
  77. package/dist/Editor/common/RnD/Utils/alignmentDetection.js +26 -0
  78. package/dist/Editor/common/RnD/Utils/calculateDropItem.js +98 -0
  79. package/dist/Editor/common/RnD/Utils/collisionDetection.js +52 -0
  80. package/dist/Editor/common/RnD/Utils/gridDropItem.js +148 -0
  81. package/dist/Editor/common/RnD/Utils/index.js +251 -0
  82. package/dist/Editor/common/RnD/VirtualElement/index.js +76 -0
  83. package/dist/Editor/common/RnD/VirtualElement/styles.js +27 -0
  84. package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +28 -0
  85. package/dist/Editor/common/RnD/index.js +503 -0
  86. package/dist/Editor/common/RnD/styles.js +4 -0
  87. package/dist/Editor/common/Section/index.js +21 -12
  88. package/dist/Editor/common/Section/styles.js +6 -1
  89. package/dist/Editor/common/Shorthands/elements.js +12 -0
  90. package/dist/Editor/common/StyleBuilder/boxStyle.js +30 -0
  91. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +32 -31
  92. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +16 -18
  93. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +3 -14
  94. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -2
  95. package/dist/Editor/common/StyleBuilder/index.js +2 -2
  96. package/dist/Editor/common/StyleBuilder/sectionStyle.js +13 -2
  97. package/dist/Editor/helper/RnD/focusOnNewItem.js +39 -0
  98. package/dist/Editor/helper/RnD/scrollToNewSection.js +24 -0
  99. package/dist/Editor/helper/breakpoint.js +5 -0
  100. package/dist/Editor/helper/index.js +139 -22
  101. package/dist/Editor/helper/theme.js +50 -2
  102. package/dist/Editor/hooks/useBreakpoints.js +34 -0
  103. package/dist/Editor/hooks/useMouseMove.js +36 -8
  104. package/dist/Editor/hooks/withCommon.js +2 -1
  105. package/dist/Editor/hooks/withErrorHandling.js +14 -0
  106. package/dist/Editor/utils/RnD/RnDCtrlCmds.js +168 -0
  107. package/dist/Editor/utils/SlateUtilityFunctions.js +31 -5
  108. package/dist/Editor/utils/draftToSlate.js +1 -1
  109. package/dist/Editor/utils/events.js +5 -0
  110. package/dist/Editor/utils/freegrid.js +49 -0
  111. package/dist/Editor/utils/helper.js +29 -0
  112. package/package.json +5 -2
@@ -0,0 +1,503 @@
1
+ import React, { useEffect, useRef, useState } from "react";
2
+ import { Box } from "@mui/material";
3
+ import { Rnd } from "react-rnd";
4
+ import Handles from "./TransformHandles";
5
+ import { useEditorContext } from "../../hooks/useMouseMove";
6
+ import ElementOptions from "./ElementOptions";
7
+ import ElementSettings from "./ElementSettings";
8
+ import { getClosestDraggable, getParentSectionPath, isDragOver } from "./Utils";
9
+ import DragInfo from "./DragInfo";
10
+ import GuideLines from "./GuideLines";
11
+ import ShadowElement from "./ShadowElement";
12
+ import BoundaryLine from "./GuideLines/BoundaryLine";
13
+ import DragOver from "./DragOver";
14
+ import ContextMenu from "./ContextMenu";
15
+ import VirtualElement from "./VirtualElement";
16
+ import { ItemTypes } from "./ElementSettings/settingsConstants";
17
+ import { focusSelection, clearSelection } from "../../helper";
18
+ import { selectText } from "../../utils/helper";
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
+ import { jsxs as _jsxs } from "react/jsx-runtime";
21
+ import { Fragment as _Fragment } from "react/jsx-runtime";
22
+ const RnD = props => {
23
+ const rndRef = useRef(null);
24
+ const {
25
+ id: eId,
26
+ className,
27
+ path,
28
+ children,
29
+ style,
30
+ defaultStyle,
31
+ disableDragging,
32
+ enableResizing,
33
+ actions,
34
+ actionsMap = {},
35
+ type = "child",
36
+ optionsProps = {},
37
+ settingsProps = {},
38
+ onChange = () => {},
39
+ delta = {
40
+ width: 0,
41
+ height: 0
42
+ },
43
+ handleDragEvent = () => {},
44
+ handleResizeEvent = () => {},
45
+ handleActionClick = () => {},
46
+ readOnly,
47
+ childType = "",
48
+ updated_at = null,
49
+ editor,
50
+ breakpoint = "",
51
+ handleContextMenuClick = () => {}
52
+ } = props;
53
+ const {
54
+ isSelectedElement,
55
+ setSelectedElement,
56
+ dragging,
57
+ setDragging,
58
+ contextMenu,
59
+ setContextMenu
60
+ } = useEditorContext();
61
+ const str_path = path.join("|");
62
+ const selectedElementProps = isSelectedElement(str_path, type);
63
+ const {
64
+ enable,
65
+ cursor,
66
+ path: sp,
67
+ selectedAction
68
+ } = selectedElementProps;
69
+ const open = Boolean(enable);
70
+ const currentAction = str_path === sp ? selectedAction : null;
71
+ const positionRef = useRef();
72
+ const {
73
+ active,
74
+ id,
75
+ lines,
76
+ position,
77
+ dragOver,
78
+ parentPath
79
+ } = dragging;
80
+ const dragInfoOpen = id === str_path;
81
+ const dragOverStatus = dragOver === str_path && parentPath !== str_path;
82
+ const [absPosition, setAbsPosition] = useState({});
83
+ const openContextMenu = contextMenu?.path === str_path;
84
+ useEffect(() => {
85
+ if (type === "child") {
86
+ if (enable === 1) {
87
+ updatePosition();
88
+ } else {
89
+ rndRef.current.posUpdated = false;
90
+ setAbsPosition({});
91
+ }
92
+ }
93
+ }, [enable]);
94
+ useEffect(() => {
95
+ if (position?.x !== undefined && position?.y !== undefined && active && type === "parent") {
96
+ const dragOver = isDragOver(rndRef?.current?.getBoundingClientRect(), {
97
+ x: position.x,
98
+ y: position.y
99
+ });
100
+ if (dragOver) {
101
+ setDragging({
102
+ ...dragging,
103
+ dragOver: str_path
104
+ });
105
+ }
106
+ }
107
+ }, [active, position?.x, position?.y]);
108
+ const getCurrentEle = () => {
109
+ return positionRef.current?.resizableElement?.current;
110
+ };
111
+ const updatePosition = () => {
112
+ if (rndRef?.current && !rndRef.current.posUpdated) {
113
+ const currentEle = getCurrentEle();
114
+ const parentDom = currentEle?.closest(".freegrid-container");
115
+ const parentRect = parentDom?.getBoundingClientRect();
116
+ const {
117
+ left,
118
+ top,
119
+ width,
120
+ height
121
+ } = currentEle.getBoundingClientRect();
122
+ positionRef.current.updatePosition({
123
+ x: 0,
124
+ y: 0
125
+ });
126
+ positionRef.current.updateSize({
127
+ width: width,
128
+ height: height
129
+ });
130
+ rndRef.current.posUpdated = true;
131
+ setAbsPosition({
132
+ position: "absolute",
133
+ left: left - 16,
134
+ top: Math.abs(parentRect?.top - top),
135
+ marginTop: 0,
136
+ marginLeft: 0
137
+ });
138
+ }
139
+ };
140
+ const onClick = e => {
141
+ if (readOnly) {
142
+ return;
143
+ }
144
+
145
+ // for context menu
146
+ setContextMenu({
147
+ path: null
148
+ });
149
+ if (e?.preventDefault && e?.stopPropagation && !enable) {
150
+ e.preventDefault();
151
+ e.stopPropagation();
152
+ }
153
+ switch (e.detail) {
154
+ case 1:
155
+ if (!enable) {
156
+ setSelectedElement({
157
+ path: str_path,
158
+ enable: 1,
159
+ cursor: "move",
160
+ anchorEl: rndRef?.current
161
+ });
162
+ }
163
+ break;
164
+ case 2:
165
+ focusSelection(editor, {
166
+ path
167
+ });
168
+ setSelectedElement({
169
+ path: str_path,
170
+ enable: 2,
171
+ cursor: "auto",
172
+ anchorEl: rndRef?.current
173
+ });
174
+ // for default selection
175
+ if (childType === "text" && type === "child") {
176
+ setTimeout(() => {
177
+ selectText(editor, {
178
+ path: [...path, 0],
179
+ cursorOnly: false
180
+ });
181
+ }, 10);
182
+ }
183
+ break;
184
+ default:
185
+ return;
186
+ }
187
+ };
188
+ const handleAction = type => {
189
+ switch (type) {
190
+ case 1:
191
+ setSelectedElement({
192
+ path: str_path,
193
+ enable: 1,
194
+ cursor: disableDragging ? "auto" : "move"
195
+ });
196
+ break;
197
+ case 2:
198
+ onClick({
199
+ detail: type
200
+ });
201
+ break;
202
+ case 3:
203
+ clearSelection(editor);
204
+ setSelectedElement({});
205
+ break;
206
+ case "settings":
207
+ setSelectedElement({
208
+ ...selectedElementProps,
209
+ selectedAction: type,
210
+ selectedActionPath: path
211
+ });
212
+ break;
213
+ case "link":
214
+ setSelectedElement({
215
+ ...selectedElementProps,
216
+ selectedAction: type,
217
+ selectedActionPath: path
218
+ });
219
+ break;
220
+ default:
221
+ handleActionClick(type);
222
+ return;
223
+ }
224
+ };
225
+ const onAfterDrop = updated_data => {
226
+ const {
227
+ updated_at
228
+ } = updated_data || {};
229
+ setSelectedElement({});
230
+ // to maitain absolute
231
+ rndRef.current.posUpdated = false;
232
+ // need to retain drag option if section changes
233
+ setAbsPosition({});
234
+ updatePosition();
235
+ if (updated_at) {
236
+ // disable dragging
237
+ setDragging({
238
+ active: false,
239
+ id: null,
240
+ isDragging: false
241
+ });
242
+ }
243
+ };
244
+ const onDragStart = e => {
245
+ e.preventDefault();
246
+ const {
247
+ left,
248
+ top,
249
+ width,
250
+ height
251
+ } = e?.target?.getBoundingClientRect();
252
+ const ref = positionRef.current?.resizableElement?.current;
253
+ setDragging({
254
+ active: true,
255
+ id: str_path,
256
+ position: {
257
+ x: e.clientX,
258
+ y: e.clientY,
259
+ strXY: `${e.clientX},${e.clientY}`,
260
+ diffX: parseInt(Math.abs(Math.floor(left - e.clientX))),
261
+ diffY: parseInt(Math.abs(Math.floor(top - e.clientY)))
262
+ },
263
+ dimension: {
264
+ width,
265
+ height
266
+ },
267
+ isDragging: true,
268
+ parentPath: getParentSectionPath({
269
+ ref
270
+ }, ".freegrid-container")
271
+ });
272
+ };
273
+ const onDrag = (e, d) => {
274
+ e.preventDefault();
275
+ const lines = getClosestDraggable(e.clientX, e.clientY, ".freegrid-item.inactive-drag:not(.exclude-virtual)", ".freegrid-item.active-drag:not(.exclude-virtual)");
276
+ setAbsPosition({
277
+ ...absPosition,
278
+ "--zIndex": 2000
279
+ });
280
+ setDragging({
281
+ isDragging: true,
282
+ ...dragging,
283
+ position: {
284
+ ...dragging.position,
285
+ x: e.clientX,
286
+ y: e.clientY
287
+ },
288
+ lines: lines
289
+ });
290
+ };
291
+ const onDragStop = (e, d) => {
292
+ e.preventDefault();
293
+ e.stopPropagation();
294
+ d.x = e.x;
295
+ d.y = e.y;
296
+ d.offsetX = e.offsetX;
297
+ d.offsetY = e.offsetY;
298
+ d.dragOver = dragOver;
299
+ d.parentPath = parentPath;
300
+ d.diffX = position?.diffX;
301
+ d.diffY = position?.diffY;
302
+ // avoid x, y value replace issue
303
+ const [x, y] = position.strXY.split(",");
304
+ d.startPosition = {
305
+ ...position,
306
+ x: parseInt(x),
307
+ y: parseInt(y)
308
+ };
309
+ d.endPosition = {
310
+ x: e.x,
311
+ y: e.y
312
+ };
313
+ handleDragEvent("stop", d, onAfterDrop);
314
+ // reset zIndex var on drag stop
315
+ const ud = {
316
+ ...absPosition
317
+ };
318
+ delete ud["--zIndex"];
319
+ setAbsPosition({
320
+ ...ud
321
+ });
322
+ };
323
+ const onResizeStop = (e, direction, ref, d, position) => {
324
+ e.preventDefault();
325
+ // calculate the text height
326
+ const nodeList = positionRef?.current?.resizableElement?.current?.childNodes || [];
327
+ const textElement = Array.from(nodeList).filter(node => node.classList.contains("fgi_type_text"));
328
+ const updatedSize = {
329
+ width: delta?.width + d.width,
330
+ height: delta?.height + d.height
331
+ };
332
+ if (textElement[0] && type === "child") {
333
+ const textRect = textElement[0]?.getBoundingClientRect();
334
+ updatedSize.height = textRect.height;
335
+ positionRef.current.updateSize({
336
+ ...updatedSize
337
+ });
338
+ }
339
+ onChange({
340
+ ...updatedSize
341
+ });
342
+ handleResizeEvent("stop");
343
+ };
344
+ const onCloseSettings = () => {
345
+ setSelectedElement({
346
+ ...selectedElementProps,
347
+ selectedAction: null,
348
+ selectedActionPath: null
349
+ });
350
+ };
351
+ const handleContextMenu = e => {
352
+ if (readOnly) {
353
+ return;
354
+ }
355
+ e.preventDefault();
356
+ e.stopPropagation();
357
+ onClick({
358
+ detail: 1
359
+ });
360
+ setContextMenu({
361
+ x: e.clientX + 2,
362
+ y: e.clientY - 6,
363
+ path: path.join("|")
364
+ });
365
+ };
366
+ const handleClose = d => () => {
367
+ if (d) {
368
+ handleContextMenuClick(d);
369
+ }
370
+ if (d?.autoClose !== false) {
371
+ setContextMenu({
372
+ path: null
373
+ });
374
+ }
375
+ };
376
+ const getEventProps = () => {
377
+ if (!readOnly) {
378
+ return {
379
+ onResizeStart: e => {
380
+ e.preventDefault();
381
+ },
382
+ onDragStart: onDragStart,
383
+ onDrag: onDrag,
384
+ onDragStop: onDragStop,
385
+ onResizeStop: onResizeStop,
386
+ onClick: onClick,
387
+ onContextMenu: handleContextMenu
388
+ };
389
+ } else {
390
+ return {};
391
+ }
392
+ };
393
+ return /*#__PURE__*/_jsxs(_Fragment, {
394
+ children: [/*#__PURE__*/_jsxs(Box, {
395
+ component: Rnd,
396
+ placeholder: ItemTypes[childType] || "Item",
397
+ id: eId || "",
398
+ ref: c => {
399
+ positionRef.current = c;
400
+ },
401
+ className: `${className || ""} ${dragInfoOpen ? "active-drag" : "inactive-drag"} enable-${enable} type_${childType} section_type_${type || "parent"}`,
402
+ "data-path": str_path,
403
+ style: {
404
+ position: "relative",
405
+ outline: enable && type === "child" ? "#2563EB solid 2px" : 0,
406
+ cursor: cursor,
407
+ caretColor: enable === 2 ? "auto" : "transparent",
408
+ userSelect: enable === 2 || readOnly ? "auto" : "none",
409
+ ...style,
410
+ zIndex: enable === 1 ? 1 : "inherit",
411
+ left: "var(--left)",
412
+ ...absPosition
413
+ },
414
+ default: {
415
+ ...(defaultStyle || {})
416
+ },
417
+ dragGrid: [2, 2],
418
+ resizeHandleComponent: enable ? Handles : {},
419
+ disableDragging: readOnly || disableDragging || enable !== 1,
420
+ suppressContentEditableWarning: true,
421
+ enableResizing: readOnly ? false : enable && !active ? enableResizing : {},
422
+ ...getEventProps(),
423
+ children: [/*#__PURE__*/_jsx("span", {
424
+ id: `opt_ref_${sp}`,
425
+ style: {
426
+ position: "absolute",
427
+ left: "-8px",
428
+ top: "-30px",
429
+ width: "calc(100% + 24px)",
430
+ height: "calc(100% + 42px)",
431
+ pointerEvents: "none"
432
+ },
433
+ ref: rndRef,
434
+ className: "options-wrapper",
435
+ contentEditable: false
436
+ }), children, enable !== 2 && type !== "parent" && !readOnly ? /*#__PURE__*/_jsx("button", {
437
+ className: "editor-blocker",
438
+ contentEditable: false
439
+ }) : null, /*#__PURE__*/_jsx(DragOver, {
440
+ status: dragOverStatus
441
+ })]
442
+ }, eId), !active ? /*#__PURE__*/_jsx(ElementOptions, {
443
+ open: open,
444
+ anchorEl: rndRef?.current,
445
+ enable: enable,
446
+ handleAction: handleAction,
447
+ actions: actions,
448
+ actionsMap: actionsMap,
449
+ optionsProps: optionsProps,
450
+ selectedAction: currentAction
451
+ }) : null, /*#__PURE__*/_jsx(ElementSettings, {
452
+ open: Boolean(currentAction),
453
+ currentAction: currentAction,
454
+ anchorEl: rndRef?.current,
455
+ placement: "right-start",
456
+ onClose: onCloseSettings,
457
+ childType: childType,
458
+ editor: editor,
459
+ path: sp,
460
+ ...settingsProps
461
+ }), /*#__PURE__*/_jsx(DragInfo, {
462
+ anchorEl: rndRef?.current,
463
+ open: dragInfoOpen,
464
+ dragging: dragging
465
+ }), /*#__PURE__*/_jsx(GuideLines, {
466
+ lines: lines
467
+ }), !readOnly ? /*#__PURE__*/_jsx(BoundaryLine, {}) : null, /*#__PURE__*/_jsx(ShadowElement, {
468
+ type: type,
469
+ enable: enable,
470
+ style: {
471
+ ...style,
472
+ ...defaultStyle,
473
+ left: "var(--left)",
474
+ marginTop: "var(--marginTop)",
475
+ gridArea: "var(--gridArea)"
476
+ }
477
+ }), /*#__PURE__*/_jsx(ContextMenu, {
478
+ type: type,
479
+ open: openContextMenu,
480
+ contextMenu: contextMenu,
481
+ handleClose: handleClose
482
+ }), type === "parent" && breakpoint === "lg" ? /*#__PURE__*/_jsx(VirtualElement, {
483
+ parentEle: positionRef?.current?.resizableElement?.current,
484
+ updated_at: updated_at,
485
+ path: str_path,
486
+ editor: editor
487
+ }) : null]
488
+ });
489
+ };
490
+ RnD.defaultProps = {
491
+ disableDragging: false,
492
+ enableResizing: {
493
+ bottom: true,
494
+ bottomLeft: true,
495
+ bottomRight: true,
496
+ left: true,
497
+ right: true,
498
+ top: true,
499
+ topLeft: true,
500
+ topRight: true
501
+ }
502
+ };
503
+ export default RnD;
@@ -0,0 +1,4 @@
1
+ const useRnDStyles = () => ({
2
+ root: {}
3
+ });
4
+ export default useRnDStyles;
@@ -1,10 +1,11 @@
1
1
  import React, { useState } from "react";
2
+ import { useTheme } from "@mui/material";
2
3
  import { Transforms } from "slate";
3
4
  import { ReactEditor, useSlateStatic } from "slate-react";
4
5
  import { Box, IconButton, Tooltip } from "@mui/material";
5
6
  import TuneIcon from "@mui/icons-material/Tune";
6
7
  import SectionPopup from "../../Elements/Grid/SectionPopup";
7
- import { getBreakPointsValue, getTRBLBreakPoints } from "../../helper/theme";
8
+ import { getBreakPointsValue, getTRBLBreakPoints, groupByBreakpoint } from "../../helper/theme";
8
9
  import DragHandle from "../DnD/DragHandleButton";
9
10
  import { useEditorSelection } from "../../hooks/useMouseMove";
10
11
  import SectionStyle from "./styles";
@@ -12,7 +13,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
12
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
14
  const list_types = ["orderedList", "unorderedList"];
14
15
  const Section = props => {
15
- const classes = SectionStyle();
16
+ const theme = useTheme();
17
+ const classes = SectionStyle(theme);
16
18
  const {
17
19
  children,
18
20
  element,
@@ -78,23 +80,32 @@ const Section = props => {
78
80
  at: path
79
81
  });
80
82
  };
83
+ const isFreeGrid = element?.children?.find(f => f.type === "freegrid");
81
84
  const needHover = element?.children?.find(f => f.type === "grid" && !list_types.includes(element.type)) ? "needHover" : "";
82
85
  const sectionBgImage = sectionBackgroundImage && sectionBackgroundImage !== "none" ? {
83
86
  backgroundImage: `url(${sectionBackgroundImage})`
84
87
  } : {};
85
- return path.length === 1 ? /*#__PURE__*/_jsxs(Box, {
88
+ const edSectionSp = groupByBreakpoint({
89
+ padding: {
90
+ ...getTRBLBreakPoints(sectionBannerSpacing)
91
+ },
92
+ borderRadius: {
93
+ ...getBreakPointsValue(sectionBorderRadius || {}, null, "overrideBorderRadius", true)
94
+ }
95
+ }, theme);
96
+ const edInnerSp = groupByBreakpoint({
97
+ width: {
98
+ ...getBreakPointsValue(sectionGridSize || 8, null, "overrideGridSize", true)
99
+ }
100
+ }, theme);
101
+ return path.length === 1 && !isFreeGrid ? /*#__PURE__*/_jsxs(Box, {
86
102
  component: "div",
87
103
  className: `ed-section-wrapper ${readOnly ? "" : "hselect"} ${needHover}`,
88
104
  sx: {
89
105
  ...classes.root,
90
106
  background: sectionBgColor,
91
107
  ...sectionBgImage,
92
- padding: {
93
- ...getTRBLBreakPoints(sectionBannerSpacing)
94
- },
95
- borderRadius: {
96
- ...getBreakPointsValue(sectionBorderRadius || {}, null, "overrideBorderRadius", true)
97
- },
108
+ ...edSectionSp,
98
109
  flexDirection: flexDirection || "column",
99
110
  alignItems: horizantal,
100
111
  justifyContent: vertical
@@ -103,9 +114,7 @@ const Section = props => {
103
114
  className: "ed-section-inner",
104
115
  sx: {
105
116
  position: "relative",
106
- width: {
107
- ...getBreakPointsValue(sectionGridSize || 8, null, "overrideGridSize", true)
108
- }
117
+ ...edInnerSp
109
118
  },
110
119
  children: [!readOnly && !showTool ? /*#__PURE__*/_jsx(DragHandle, {
111
120
  ...props
@@ -1,4 +1,4 @@
1
- const SectionStyle = () => ({
1
+ const SectionStyle = theme => ({
2
2
  root: {
3
3
  "&:hover": {
4
4
  "& .dh-para": {
@@ -38,6 +38,11 @@ const SectionStyle = () => ({
38
38
  "&.active": {
39
39
  opacity: 1
40
40
  }
41
+ },
42
+ "& .ed-section-inner": {
43
+ [theme.breakpoints.between("xs", "md")]: {
44
+ maxWidth: `320px !important`
45
+ }
41
46
  }
42
47
  }
43
48
  });
@@ -10,6 +10,7 @@ import { TableUtil } from "../../utils/table";
10
10
  import Icon from "../Icon";
11
11
  import EmojiButton from "../../Elements/Emoji/EmojiButton";
12
12
  import { insertDivider } from "../../utils/divider";
13
+ import { insertFreeGrid } from "../../utils/freegrid";
13
14
  import { Transforms } from "slate";
14
15
  import { insertInfinityAI } from "../../utils/infinityAI";
15
16
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -168,6 +169,17 @@ const ELEMENTS_LIST = [{
168
169
  onInsert: editor => {
169
170
  insertGrid(editor);
170
171
  }
172
+ }, {
173
+ name: "Free Grid",
174
+ group: "Elements",
175
+ desc: "",
176
+ type: "freegrid",
177
+ icon: /*#__PURE__*/_jsx(Icon, {
178
+ icon: "freegrid"
179
+ }),
180
+ onInsert: editor => {
181
+ insertFreeGrid(editor);
182
+ }
171
183
  }, {
172
184
  name: "Accordion",
173
185
  group: "Elements",
@@ -0,0 +1,30 @@
1
+ const boxStyle = [{
2
+ tab: "Colors",
3
+ value: "sectionColors",
4
+ fields: [{
5
+ label: "Background Color",
6
+ key: "sectionBgColor",
7
+ type: "color"
8
+ }]
9
+ }, {
10
+ tab: "Background",
11
+ value: "sectionBackgroundImage",
12
+ fields: [{
13
+ label: "Background Image URL",
14
+ key: "sectionBackgroundImage",
15
+ type: "text"
16
+ }, {
17
+ label: "Background Image",
18
+ key: "sectionBackgroundImage",
19
+ type: "backgroundImage"
20
+ }]
21
+ }, {
22
+ tab: "Border",
23
+ value: "sectionBorderRadius",
24
+ fields: [{
25
+ label: "Border",
26
+ key: "sectionBorderRadius",
27
+ type: "borderRadius"
28
+ }]
29
+ }];
30
+ export default boxStyle;