@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,193 @@
1
+ import React from "react";
2
+ import { Transforms, Node, Path } from "slate";
3
+ import { useSlateStatic } from "slate-react";
4
+ import { ReactEditor } from "slate-react";
5
+ import { Box, useTheme } from "@mui/material";
6
+ import RnD from "../../common/RnD";
7
+ import { onDropItem } from "../../common/RnD/Utils/gridDropItem";
8
+ import useBreakpoints from "../../hooks/useBreakpoints";
9
+ import { breakpointValues, formatBreakpointValues } from "./breakpointConstants";
10
+ import { useEditorContext } from "../../hooks/useMouseMove";
11
+ import { getBreakPointsValue } from "../../helper/theme";
12
+ import focusOnNewItem from "../../helper/RnD/focusOnNewItem";
13
+ import { bringItemToFB } from "../../helper";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ const FreeGridBox = props => {
16
+ const theme = useTheme();
17
+ const breakpoint = useBreakpoints(theme);
18
+ const {
19
+ element,
20
+ attributes,
21
+ children,
22
+ customProps
23
+ } = props;
24
+ const editor = useSlateStatic();
25
+ const path = ReactEditor.findPath(editor, element);
26
+ const {
27
+ readOnly
28
+ } = customProps;
29
+ const {
30
+ updated_at,
31
+ zIndex,
32
+ sectionBgColor,
33
+ sectionBackgroundImage,
34
+ sectionBorderRadius
35
+ } = element;
36
+ // get values based on breakpoint size
37
+ const {
38
+ gridArea,
39
+ width,
40
+ height,
41
+ left,
42
+ top,
43
+ marginTop
44
+ } = breakpointValues(element.type, breakpoint, element);
45
+ const {
46
+ setSelectedElement
47
+ } = useEditorContext();
48
+ const arrangeIndex = zIndex === undefined ? path[path.length - 1] : zIndex;
49
+ const onChangeSettings = () => {};
50
+ const onChange = data => {
51
+ let updateData = {
52
+ ...data
53
+ };
54
+ delete updateData.children;
55
+ updateData = formatBreakpointValues(element.type, breakpoint, updateData);
56
+ Transforms.setNodes(editor, {
57
+ ...updateData
58
+ }, {
59
+ at: path
60
+ });
61
+ };
62
+ const handleDragEvent = (type, data, cb) => {
63
+ const toPosition = {
64
+ left: left + data.lastX,
65
+ top: top + data.lastY
66
+ };
67
+ const {
68
+ node,
69
+ ...rest
70
+ } = data;
71
+ switch (type) {
72
+ case "stop":
73
+ const updated_data = onDropItem({
74
+ editor,
75
+ fromPosition: {
76
+ left,
77
+ top
78
+ },
79
+ toPosition,
80
+ path,
81
+ ref: node,
82
+ breakpoint,
83
+ ...rest
84
+ }, ".freegrid-container");
85
+ if (cb) {
86
+ cb(updated_data);
87
+ }
88
+ break;
89
+ default:
90
+ }
91
+ };
92
+ const handleResizeEvent = (type, data, cb) => {
93
+ switch (type) {
94
+ case "stop":
95
+ return;
96
+ default:
97
+ }
98
+ };
99
+ const onDelete = () => {
100
+ try {
101
+ Transforms.removeNodes(editor, {
102
+ at: path
103
+ });
104
+ } catch (err) {
105
+ console.log(err);
106
+ }
107
+ };
108
+ const handleContextMenuClick = d => {
109
+ switch (d?.name) {
110
+ case "bringForward":
111
+ bringItemToFB(editor, {
112
+ path,
113
+ moveFront: true
114
+ });
115
+ Transforms.setNodes(editor, {
116
+ zIndex: Math.min(arrangeIndex + 1, editor.children.length)
117
+ }, {
118
+ at: path
119
+ });
120
+ break;
121
+ case "bringBackward":
122
+ bringItemToFB(editor, {
123
+ path,
124
+ moveFront: false
125
+ });
126
+ break;
127
+ case "cut":
128
+ window.copiedNode = JSON.stringify(Node.get(editor, path));
129
+ onDelete();
130
+ focusOnNewItem(editor, Path.parent(path), {
131
+ setSelectedElement
132
+ });
133
+ break;
134
+ case "copy":
135
+ window.copiedNode = JSON.stringify(Node.get(editor, path));
136
+ break;
137
+ case "delete":
138
+ onDelete();
139
+ setSelectedElement({});
140
+ break;
141
+ default:
142
+ return;
143
+ }
144
+ };
145
+ return /*#__PURE__*/_jsx(RnD, {
146
+ id: `freegrid_box_item_${path.join("|")}_${updated_at}_${breakpoint}`,
147
+ className: `freegrid-item breakpoint-${breakpoint}`,
148
+ editor: editor,
149
+ path: path,
150
+ actions: ["ai", "drag", "settings", "close"],
151
+ settingsProps: {
152
+ settings: "freegridBoxItem",
153
+ onChange: onChangeSettings
154
+ },
155
+ style: {
156
+ "--left": `${left || 0}px`,
157
+ "--marginTop": `${marginTop || 0}px`,
158
+ "--gridArea": `${gridArea}`,
159
+ "--width": `${width}px`,
160
+ "--height": `${height}px`,
161
+ "--zIndex": 100 + arrangeIndex
162
+ },
163
+ defaultStyle: {
164
+ height: `${height}px`,
165
+ width: `${width}px`
166
+ },
167
+ gridArea: gridArea,
168
+ onChange: onChange,
169
+ delta: {
170
+ width,
171
+ height
172
+ },
173
+ handleDragEvent: handleDragEvent,
174
+ handleResizeEvent: handleResizeEvent,
175
+ readOnly: readOnly,
176
+ childType: "box",
177
+ handleContextMenuClick: handleContextMenuClick,
178
+ children: /*#__PURE__*/_jsx(Box, {
179
+ component: "div",
180
+ ...attributes,
181
+ className: `fgi_type_box`,
182
+ sx: {
183
+ borderRadius: {
184
+ ...getBreakPointsValue(sectionBorderRadius || {}, null, "overrideBorderRadius", true)
185
+ },
186
+ background: sectionBgColor,
187
+ backgroundImage: `url(${sectionBackgroundImage})`
188
+ },
189
+ children: children
190
+ })
191
+ });
192
+ };
193
+ export default FreeGridBox;
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import ToolbarIcon from "../../common/ToolbarIcon";
3
+ import Icon from "../../common/Icon";
4
+ import { insertFreeGrid } from "../../utils/freegrid";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const FreeGridButton = props => {
7
+ const {
8
+ editor,
9
+ icoBtnType
10
+ } = props;
11
+ const onButtonClick = () => {
12
+ insertFreeGrid(editor);
13
+ };
14
+ return /*#__PURE__*/_jsx(ToolbarIcon, {
15
+ title: "Free Grid",
16
+ onClick: onButtonClick,
17
+ icon: /*#__PURE__*/_jsx(Icon, {
18
+ icon: "freegrid"
19
+ }),
20
+ icoBtnType: icoBtnType
21
+ });
22
+ };
23
+ export default FreeGridButton;
@@ -0,0 +1,184 @@
1
+ import React from "react";
2
+ import { Transforms, Node, Path } from "slate";
3
+ import { useSlateStatic } from "slate-react";
4
+ import { ReactEditor } from "slate-react";
5
+ import { Box, useTheme } from "@mui/material";
6
+ import RnD from "../../common/RnD";
7
+ import { onDropItem } from "../../common/RnD/Utils/gridDropItem";
8
+ import useBreakpoints from "../../hooks/useBreakpoints";
9
+ import { breakpointValues, formatBreakpointValues } from "./breakpointConstants";
10
+ import { useEditorContext } from "../../hooks/useMouseMove";
11
+ import focusOnNewItem from "../../helper/RnD/focusOnNewItem";
12
+ import { bringItemToFB } from "../../helper";
13
+ import itemOptions from "./Options/sectionItemOptions";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ const FreeGridItem = props => {
16
+ const theme = useTheme();
17
+ const breakpoint = useBreakpoints(theme);
18
+ const {
19
+ element,
20
+ attributes,
21
+ children,
22
+ customProps
23
+ } = props;
24
+ const editor = useSlateStatic();
25
+ const path = ReactEditor.findPath(editor, element);
26
+ const {
27
+ readOnly
28
+ } = customProps;
29
+ const {
30
+ updated_at,
31
+ childType,
32
+ zIndex
33
+ } = element;
34
+ // get values based on breakpoint size
35
+ const {
36
+ gridArea,
37
+ width,
38
+ height,
39
+ left,
40
+ top,
41
+ marginTop
42
+ } = breakpointValues(element.type, breakpoint, element);
43
+ const {
44
+ setSelectedElement
45
+ } = useEditorContext();
46
+ const arrangeIndex = zIndex === undefined ? path[path.length - 1] : zIndex;
47
+ const onChangeSettings = () => {};
48
+ const onChange = data => {
49
+ let updateData = {
50
+ ...data
51
+ };
52
+ delete updateData.children;
53
+ updateData = formatBreakpointValues(element.type, breakpoint, updateData);
54
+ Transforms.setNodes(editor, {
55
+ ...updateData
56
+ }, {
57
+ at: path
58
+ });
59
+ };
60
+ const handleDragEvent = (type, data, cb) => {
61
+ const toPosition = {
62
+ left: left + data.lastX,
63
+ top: top + data.lastY
64
+ };
65
+ const {
66
+ node,
67
+ ...rest
68
+ } = data;
69
+ switch (type) {
70
+ case "stop":
71
+ const updated_data = onDropItem({
72
+ editor,
73
+ fromPosition: {
74
+ left,
75
+ top
76
+ },
77
+ toPosition,
78
+ path,
79
+ ref: node,
80
+ breakpoint,
81
+ ...rest
82
+ }, ".freegrid-container");
83
+ if (cb) {
84
+ cb(updated_data);
85
+ }
86
+ break;
87
+ default:
88
+ }
89
+ };
90
+ const handleResizeEvent = (type, data, cb) => {
91
+ switch (type) {
92
+ case "stop":
93
+ return;
94
+ default:
95
+ }
96
+ };
97
+ const onDelete = () => {
98
+ try {
99
+ Transforms.removeNodes(editor, {
100
+ at: path
101
+ });
102
+ } catch (err) {
103
+ console.log(err);
104
+ }
105
+ };
106
+ const handleContextMenuClick = d => {
107
+ switch (d?.name) {
108
+ case "bringForward":
109
+ bringItemToFB(editor, {
110
+ path,
111
+ moveFront: true
112
+ });
113
+ break;
114
+ case "bringBackward":
115
+ bringItemToFB(editor, {
116
+ path,
117
+ moveFront: false
118
+ });
119
+ break;
120
+ case "cut":
121
+ window.copiedNode = JSON.stringify(Node.get(editor, path));
122
+ onDelete();
123
+ focusOnNewItem(editor, Path.parent(path), {
124
+ setSelectedElement
125
+ });
126
+ break;
127
+ case "copy":
128
+ window.copiedNode = JSON.stringify(Node.get(editor, path));
129
+ break;
130
+ case "delete":
131
+ onDelete();
132
+ setSelectedElement({});
133
+ break;
134
+ default:
135
+ return;
136
+ }
137
+ };
138
+ const handleActionClick = type => {
139
+ console.log(type);
140
+ };
141
+ return /*#__PURE__*/_jsx(RnD, {
142
+ id: `freegrid_item_${path.join("|")}_${updated_at}_${breakpoint}`,
143
+ className: `freegrid-item breakpoint-${breakpoint}`,
144
+ editor: editor,
145
+ path: path,
146
+ actions: itemOptions[childType] || itemOptions?.default,
147
+ settingsProps: {
148
+ settings: "freegridItem",
149
+ onChange: onChangeSettings,
150
+ customProps
151
+ },
152
+ style: {
153
+ "--left": `${left || 0}px`,
154
+ "--marginTop": `${marginTop || 0}px`,
155
+ "--gridArea": `${gridArea}`,
156
+ "--width": `${width}px`,
157
+ "--height": `${height}px`,
158
+ "--zIndex": 100 + arrangeIndex
159
+ },
160
+ defaultStyle: {
161
+ height: `${height}px`,
162
+ width: `${width}px`
163
+ },
164
+ gridArea: gridArea,
165
+ onChange: onChange,
166
+ delta: {
167
+ width,
168
+ height
169
+ },
170
+ handleDragEvent: handleDragEvent,
171
+ handleResizeEvent: handleResizeEvent,
172
+ readOnly: readOnly,
173
+ childType: childType || "",
174
+ handleContextMenuClick: handleContextMenuClick,
175
+ handleActionClick: handleActionClick,
176
+ children: /*#__PURE__*/_jsx(Box, {
177
+ component: "div",
178
+ ...attributes,
179
+ className: `fgi_type_${childType}`,
180
+ children: children
181
+ })
182
+ });
183
+ };
184
+ export default FreeGridItem;
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ import { Box, List, ListItemButton } from "@mui/material";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ const AddElement = props => {
6
+ const {
7
+ handleClick
8
+ } = props;
9
+ return /*#__PURE__*/_jsx(Box, {
10
+ children: /*#__PURE__*/_jsxs(List, {
11
+ className: "item-list-wrpr",
12
+ children: [/*#__PURE__*/_jsx(ListItemButton, {
13
+ className: "item-wrapper",
14
+ onClick: handleClick("addText"),
15
+ children: "Text"
16
+ }), /*#__PURE__*/_jsx(ListItemButton, {
17
+ className: "item-wrapper",
18
+ onClick: handleClick("addButton"),
19
+ children: "Button"
20
+ }), /*#__PURE__*/_jsx(ListItemButton, {
21
+ className: "item-wrapper",
22
+ onClick: handleClick("addImage"),
23
+ children: "Image"
24
+ }), /*#__PURE__*/_jsx(ListItemButton, {
25
+ className: "item-wrapper",
26
+ onClick: handleClick("addVideo"),
27
+ children: "Video"
28
+ }), /*#__PURE__*/_jsx(ListItemButton, {
29
+ className: "item-wrapper",
30
+ onClick: handleClick("addBox"),
31
+ children: "Box"
32
+ })]
33
+ })
34
+ });
35
+ };
36
+ export default AddElement;
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { Box, List, ListItemButton } from "@mui/material";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ const More = props => {
6
+ const {
7
+ handleClick
8
+ } = props;
9
+ return /*#__PURE__*/_jsx(Box, {
10
+ children: /*#__PURE__*/_jsxs(List, {
11
+ className: "item-list-wrpr",
12
+ children: [/*#__PURE__*/_jsx(ListItemButton, {
13
+ className: "item-wrapper",
14
+ onClick: handleClick("addSection"),
15
+ children: "Add Section"
16
+ }), /*#__PURE__*/_jsx(ListItemButton, {
17
+ className: "item-wrapper",
18
+ onClick: handleClick("duplicateSection"),
19
+ children: "Duplicate Section"
20
+ })]
21
+ })
22
+ });
23
+ };
24
+ export default More;
@@ -0,0 +1,47 @@
1
+ import React from "react";
2
+ import { Transforms, Node } from "slate";
3
+ import { Box } from "@mui/material";
4
+ import { StyleContent } from "../../../common/StyleBuilder";
5
+ import sectionStyle from "../../../common/StyleBuilder/sectionStyle";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const SectionSettings = props => {
8
+ const {
9
+ editor,
10
+ path,
11
+ classes
12
+ } = props;
13
+ const element = Node.get(editor, path);
14
+ const styleMaps = sectionStyle?.filter(f => !f?.hideOnFGS);
15
+ const onChange = data => {
16
+ const updated_props = {
17
+ ...element,
18
+ ...data,
19
+ field_type: data?.element
20
+ };
21
+ delete updated_props.children;
22
+ Transforms.setNodes(editor, {
23
+ ...updated_props
24
+ }, {
25
+ at: path
26
+ });
27
+ };
28
+ const handleClose = () => {
29
+ console.log("close");
30
+ };
31
+ return /*#__PURE__*/_jsx(Box, {
32
+ component: "div",
33
+ className: "style-settings-wrpr",
34
+ sx: classes.sectionSettingsPopper,
35
+ children: styleMaps?.map((m, i) => {
36
+ return /*#__PURE__*/_jsx(StyleContent, {
37
+ renderTabs: sectionStyle,
38
+ value: m.value,
39
+ element: element,
40
+ onChange: onChange,
41
+ customProps: {},
42
+ handleClose: handleClose
43
+ }, `tab_${m.value}_$${i}`);
44
+ })
45
+ });
46
+ };
47
+ export default SectionSettings;
@@ -0,0 +1,11 @@
1
+ const commonOptions = ["drag", "edit", "settings", "close"];
2
+ const textOptions = ["drag", "edit", "settings", "link", "close"];
3
+ const buttonOptions = ["drag", "edit", "settings", "link", "close"];
4
+ const imageOptions = ["drag", "edit", "settings", "link", "close"];
5
+ const itemOptions = {
6
+ default: commonOptions,
7
+ text: textOptions,
8
+ button: buttonOptions,
9
+ image: imageOptions
10
+ };
11
+ export default itemOptions;
@@ -0,0 +1,75 @@
1
+ const breakpointConstants = {
2
+ freegrid: ["height"],
3
+ freegridItem: ["left", "top", "marginTop", "width", "height", "gridArea"],
4
+ freegridBox: ["left", "top", "marginTop", "width", "height", "gridArea"]
5
+ };
6
+ export function CssVar(device = "lg", key, props) {
7
+ const keyTo = `${key}_${device}`;
8
+ const value = props[keyTo] === undefined ? props[key] : props[keyTo];
9
+ return value;
10
+ }
11
+ export function breakpointValues(type, breakpoint = "lg", props) {
12
+ try {
13
+ const breakpointDatas = breakpointConstants[type]?.reduce((a, b) => {
14
+ const bpKey = `${b}_${breakpoint}`;
15
+ a[b] = props[bpKey] === undefined ? props[b] : props[bpKey];
16
+ return a;
17
+ }, {});
18
+ return breakpointDatas;
19
+ } catch (err) {
20
+ console.log(err);
21
+ return {};
22
+ }
23
+ }
24
+ export function formatBreakpointValues(type, breakpoint = "lg", data) {
25
+ try {
26
+ const bpValues = breakpointConstants[type];
27
+ if (breakpoint === "lg") {
28
+ return data;
29
+ } else {
30
+ let rtData = {};
31
+ Object.keys(data).forEach(key => {
32
+ if (bpValues.indexOf(key) > -1) {
33
+ rtData[`${key}_${breakpoint}`] = data[key];
34
+ } else {
35
+ rtData[key] = data[key];
36
+ }
37
+ });
38
+ return rtData;
39
+ }
40
+ } catch (err) {
41
+ console.log(err);
42
+ return {};
43
+ }
44
+ }
45
+ export function wrapThemeBreakpoints(sxProp, prop, theme) {
46
+ try {
47
+ const formatedSxProp = Object.keys(sxProp).reduce((a, b) => {
48
+ switch (b) {
49
+ case "md":
50
+ a[theme.breakpoints.up("lg")] = {
51
+ [prop]: sxProp["md"] || sxProp["lg"]
52
+ };
53
+ break;
54
+ case "sm":
55
+ a[theme.breakpoints.up("lg")] = {
56
+ [prop]: sxProp["sm"] || sxProp["lg"]
57
+ };
58
+ break;
59
+ case "xs":
60
+ a[theme.breakpoints.between("xs", "md")] = {
61
+ [prop]: sxProp["xs"] || sxProp["lg"]
62
+ };
63
+ break;
64
+ default:
65
+ a[theme.breakpoints.up("lg")] = {
66
+ [prop]: sxProp["lg"]
67
+ };
68
+ }
69
+ return a;
70
+ }, {});
71
+ return formatedSxProp;
72
+ } catch (err) {
73
+ console.log(err);
74
+ }
75
+ }