@flozy/editor 3.8.9 → 3.9.0

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 (111) hide show
  1. package/dist/Editor/ChatEditor.js +55 -45
  2. package/dist/Editor/CommonEditor.js +8 -69
  3. package/dist/Editor/DialogWrapper.js +3 -4
  4. package/dist/Editor/Editor.css +12 -5
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +36 -47
  6. package/dist/Editor/Elements/Accordion/AccordionSummary.js +15 -4
  7. package/dist/Editor/Elements/AppHeader/AppHeader.js +23 -36
  8. package/dist/Editor/Elements/Button/EditorButton.js +16 -23
  9. package/dist/Editor/Elements/Embed/Image.js +14 -15
  10. package/dist/Editor/Elements/Embed/Video.js +8 -12
  11. package/dist/Editor/Elements/Emoji/EmojiButton.js +7 -11
  12. package/dist/Editor/Elements/Emoji/EmojiPicker.js +4 -2
  13. package/dist/Editor/Elements/Form/Form.js +1 -1
  14. package/dist/Editor/Elements/Grid/Grid.js +8 -12
  15. package/dist/Editor/Elements/Grid/GridItem.js +21 -31
  16. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +5 -1
  17. package/dist/Editor/Elements/SimpleText/index.js +8 -9
  18. package/dist/Editor/Elements/SimpleText/style.js +0 -37
  19. package/dist/Editor/Styles/EditorStyles.js +0 -23
  20. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +25 -1
  21. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +0 -1
  22. package/dist/Editor/Toolbar/PopupTool/index.js +0 -8
  23. package/dist/Editor/Toolbar/Toolbar.js +0 -7
  24. package/dist/Editor/Toolbar/toolbarGroups.js +0 -5
  25. package/dist/Editor/common/Icon.js +2 -9
  26. package/dist/Editor/common/MentionsPopup/MentionsListCard.js +6 -1
  27. package/dist/Editor/common/MentionsPopup/index.js +8 -12
  28. package/dist/Editor/common/Section/index.js +12 -21
  29. package/dist/Editor/common/Section/styles.js +1 -6
  30. package/dist/Editor/common/Shorthands/elements.js +0 -12
  31. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +31 -32
  32. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +18 -16
  33. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +14 -3
  34. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +2 -4
  35. package/dist/Editor/common/StyleBuilder/index.js +2 -2
  36. package/dist/Editor/common/StyleBuilder/sectionStyle.js +2 -13
  37. package/dist/Editor/helper/index.js +0 -139
  38. package/dist/Editor/helper/theme.js +2 -50
  39. package/dist/Editor/hooks/useMouseMove.js +8 -36
  40. package/dist/Editor/hooks/withCommon.js +1 -2
  41. package/dist/Editor/utils/SlateUtilityFunctions.js +3 -23
  42. package/dist/Editor/utils/draftToSlate.js +1 -1
  43. package/dist/Editor/utils/events.js +0 -5
  44. package/dist/Editor/utils/helper.js +0 -29
  45. package/package.json +2 -5
  46. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +0 -391
  47. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +0 -193
  48. package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +0 -23
  49. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +0 -184
  50. package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +0 -36
  51. package/dist/Editor/Elements/FreeGrid/Options/More.js +0 -24
  52. package/dist/Editor/Elements/FreeGrid/Options/SectionSettings.js +0 -47
  53. package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +0 -11
  54. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +0 -75
  55. package/dist/Editor/Elements/FreeGrid/styles.js +0 -159
  56. package/dist/Editor/ErrorBoundary.js +0 -30
  57. package/dist/Editor/common/RnD/ContextMenu/CMenus.js +0 -105
  58. package/dist/Editor/common/RnD/ContextMenu/index.js +0 -38
  59. package/dist/Editor/common/RnD/ContextMenu/styles.js +0 -21
  60. package/dist/Editor/common/RnD/DragInfo/index.js +0 -31
  61. package/dist/Editor/common/RnD/DragInfo/styles.js +0 -15
  62. package/dist/Editor/common/RnD/DragOver/index.js +0 -46
  63. package/dist/Editor/common/RnD/DragOver/styles.js +0 -23
  64. package/dist/Editor/common/RnD/ElementOptions/Actions.js +0 -82
  65. package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +0 -26
  66. package/dist/Editor/common/RnD/ElementOptions/index.js +0 -93
  67. package/dist/Editor/common/RnD/ElementOptions/styles.js +0 -41
  68. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Link.js +0 -153
  69. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +0 -58
  70. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +0 -7
  71. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +0 -46
  72. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +0 -46
  73. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +0 -46
  74. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +0 -30
  75. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +0 -46
  76. package/dist/Editor/common/RnD/ElementSettings/Settings/index.js +0 -13
  77. package/dist/Editor/common/RnD/ElementSettings/index.js +0 -17
  78. package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +0 -14
  79. package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -76
  80. package/dist/Editor/common/RnD/GuideLines/BoundaryLine.js +0 -52
  81. package/dist/Editor/common/RnD/GuideLines/index.js +0 -33
  82. package/dist/Editor/common/RnD/GuideLines/styles.js +0 -60
  83. package/dist/Editor/common/RnD/OptionsPopup/index.js +0 -50
  84. package/dist/Editor/common/RnD/OptionsPopup/style.js +0 -36
  85. package/dist/Editor/common/RnD/RnDCopy.js +0 -23
  86. package/dist/Editor/common/RnD/ShadowElement.js +0 -34
  87. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +0 -40
  88. package/dist/Editor/common/RnD/SwitchViewport/styles.js +0 -24
  89. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +0 -63
  90. package/dist/Editor/common/RnD/TransformHandles/CornerHandle.js +0 -19
  91. package/dist/Editor/common/RnD/TransformHandles/Icons/BottomRightIcon.js +0 -13
  92. package/dist/Editor/common/RnD/TransformHandles/SizeHandle.js +0 -18
  93. package/dist/Editor/common/RnD/TransformHandles/index.js +0 -62
  94. package/dist/Editor/common/RnD/Utils/alignmentDetection.js +0 -26
  95. package/dist/Editor/common/RnD/Utils/calculateDropItem.js +0 -98
  96. package/dist/Editor/common/RnD/Utils/collisionDetection.js +0 -52
  97. package/dist/Editor/common/RnD/Utils/gridDropItem.js +0 -148
  98. package/dist/Editor/common/RnD/Utils/index.js +0 -251
  99. package/dist/Editor/common/RnD/VirtualElement/index.js +0 -76
  100. package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -27
  101. package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +0 -28
  102. package/dist/Editor/common/RnD/index.js +0 -503
  103. package/dist/Editor/common/RnD/styles.js +0 -4
  104. package/dist/Editor/common/StyleBuilder/boxStyle.js +0 -30
  105. package/dist/Editor/helper/RnD/focusOnNewItem.js +0 -39
  106. package/dist/Editor/helper/RnD/scrollToNewSection.js +0 -24
  107. package/dist/Editor/helper/breakpoint.js +0 -5
  108. package/dist/Editor/hooks/useBreakpoints.js +0 -34
  109. package/dist/Editor/hooks/withErrorHandling.js +0 -14
  110. package/dist/Editor/utils/RnD/RnDCtrlCmds.js +0 -168
  111. package/dist/Editor/utils/freegrid.js +0 -49
@@ -1,503 +0,0 @@
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;
@@ -1,4 +0,0 @@
1
- const useRnDStyles = () => ({
2
- root: {}
3
- });
4
- export default useRnDStyles;
@@ -1,30 +0,0 @@
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;
@@ -1,39 +0,0 @@
1
- import { Node } from "slate";
2
- import { ReactEditor } from "slate-react";
3
- function safeToDOMNode(editor, node, np, extProps) {
4
- try {
5
- if (Node.has(editor, node)) {
6
- const domNode = ReactEditor.toDOMNode(editor, node);
7
- return domNode;
8
- }
9
- } catch (error) {
10
- console.error("Focusing Again");
11
- focusOnNewItem(editor, np, extProps);
12
- }
13
- return null;
14
- }
15
- function focusOnNewItem(editor, newPath, extProps) {
16
- try {
17
- const sectionNode = Node.get(editor, newPath);
18
- requestAnimationFrame(() => {
19
- const domNode = safeToDOMNode(editor, sectionNode, newPath, extProps);
20
- if (domNode) {
21
- const sectionDom = ReactEditor.toDOMNode(editor, sectionNode);
22
- if (sectionDom) {
23
- sectionDom.scrollIntoView({
24
- behavior: "smooth",
25
- block: "center"
26
- });
27
- extProps?.setSelectedElement({
28
- enable: 1,
29
- path: [...newPath].join("|"),
30
- cursor: "move"
31
- });
32
- }
33
- }
34
- });
35
- } catch (err) {
36
- console.log(err);
37
- }
38
- }
39
- export default focusOnNewItem;
@@ -1,24 +0,0 @@
1
- import { Node } from "slate";
2
- import { ReactEditor } from "slate-react";
3
- function scrollToNewSection(editor, newPath, extProps) {
4
- try {
5
- const sectionNode = Node.get(editor, newPath);
6
- requestAnimationFrame(() => {
7
- const sectionDom = ReactEditor.toDOMNode(editor, sectionNode);
8
- if (sectionDom) {
9
- sectionDom.scrollIntoView({
10
- behavior: "smooth",
11
- block: "center"
12
- });
13
- extProps?.setSelectedElement({
14
- enable: 1,
15
- path: [...newPath, 0].join("|"),
16
- cursor: "move"
17
- });
18
- }
19
- });
20
- } catch (err) {
21
- console.log(err);
22
- }
23
- }
24
- export default scrollToNewSection;
@@ -1,5 +0,0 @@
1
- export function CssVar(device = "lg", key, props) {
2
- const keyTo = `${key}_${device}`;
3
- const value = props[keyTo] === undefined ? props[key] : props[keyTo];
4
- return value;
5
- }
@@ -1,34 +0,0 @@
1
- import { useMediaQuery } from "@mui/material";
2
- export const STIMULATOR_MOCK = {
3
- xs: "@media (min-width: 1200px) and (max-width: 1980px)"
4
- };
5
- export const isStimulator = () => {
6
- try {
7
- const breakpoint = document.getElementsByClassName("et-wrpr")[0];
8
- const etDataset = breakpoint?.dataset;
9
- if (etDataset?.breakpoint) {
10
- return etDataset?.breakpoint;
11
- }
12
- } catch (err) {
13
- console.log(err);
14
- }
15
- };
16
- const useBreakpoints = theme => {
17
- const lg = useMediaQuery(theme.breakpoints.up("md"));
18
- const xs = useMediaQuery(theme.breakpoints.between("xs", "md"));
19
-
20
- // if stimulated environment
21
- const breakpoint = document.getElementsByClassName("et-wrpr")[0];
22
- const etDataset = breakpoint?.dataset;
23
- if (etDataset?.breakpoint) {
24
- return etDataset?.breakpoint;
25
- }
26
- if (lg) {
27
- return "lg";
28
- } else if (xs) {
29
- return "xs";
30
- } else {
31
- return "lg";
32
- }
33
- };
34
- export default useBreakpoints;
@@ -1,14 +0,0 @@
1
- const withErrorHandling = editor => {
2
- const {
3
- apply
4
- } = editor;
5
- editor.apply = operation => {
6
- try {
7
- apply(operation);
8
- } catch (error) {
9
- console.error("Error applying Slate operation:", error);
10
- }
11
- };
12
- return editor;
13
- };
14
- export default withErrorHandling;