@flozy/editor 3.8.9 → 3.9.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +55 -45
- package/dist/Editor/CommonEditor.js +175 -168
- package/dist/Editor/DialogWrapper.js +3 -4
- package/dist/Editor/Editor.css +7 -4
- package/dist/Editor/Elements/AI/AIInput.js +17 -18
- package/dist/Editor/Elements/AI/CustomSelect.js +19 -12
- package/dist/Editor/Elements/AI/PopoverAIInput.js +58 -74
- package/dist/Editor/Elements/AI/Styles.js +2 -1
- package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +73 -0
- package/dist/Editor/Elements/AI/VoiceToText/index.js +177 -0
- package/dist/Editor/Elements/AI/VoiceToText/style.js +40 -0
- package/dist/Editor/Elements/AppHeader/AppHeader.js +49 -40
- package/dist/Editor/Elements/Button/EditorButton.js +38 -33
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +60 -17
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
- package/dist/Editor/Elements/Color Picker/Styles.js +2 -1
- package/dist/Editor/Elements/Embed/Image.js +14 -15
- package/dist/Editor/Elements/Embed/Video.js +8 -12
- package/dist/Editor/Elements/Emoji/EmojiButton.js +7 -11
- package/dist/Editor/Elements/Emoji/EmojiPicker.js +4 -2
- package/dist/Editor/Elements/Form/Form.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -3
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -1
- package/dist/Editor/Elements/Grid/Grid.js +34 -14
- package/dist/Editor/Elements/Grid/GridItem.js +23 -31
- package/dist/Editor/Elements/Link/Link.js +6 -1
- package/dist/Editor/Elements/Link/LinkButton.js +4 -2
- package/dist/Editor/Elements/Link/LinkPopup.js +10 -3
- package/dist/Editor/Elements/Link/LinkPopupStyles.js +28 -0
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +8 -4
- package/dist/Editor/Elements/Redo/RedoButton.js +14 -0
- package/dist/Editor/Elements/Signature/SignaturePopup.js +14 -3
- package/dist/Editor/Elements/SimpleText/index.js +8 -9
- package/dist/Editor/Elements/SimpleText/style.js +0 -37
- package/dist/Editor/Elements/Table/Styles.js +23 -1
- package/dist/Editor/Elements/Table/Table.js +2 -1
- package/dist/Editor/Elements/Table/TableCell.js +69 -7
- package/dist/Editor/Elements/TableContextMenu/TableContextMenu.js +1 -0
- package/dist/Editor/Elements/Undo/UndoButton.js +14 -0
- package/dist/Editor/MiniEditor.js +3 -1
- package/dist/Editor/Styles/EditorStyles.js +1 -24
- package/dist/Editor/Toolbar/Basic/index.js +4 -2
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +26 -2
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +29 -18
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +29 -3
- package/dist/Editor/Toolbar/Mini/Options/Options.js +10 -0
- package/dist/Editor/Toolbar/Mini/Styles.js +7 -0
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +4 -11
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +213 -86
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +22 -16
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +52 -8
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +7 -25
- package/dist/Editor/Toolbar/Toolbar.js +0 -7
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -11
- package/dist/Editor/assets/svg/AIIcons.js +153 -1
- package/dist/Editor/assets/svg/AddTemplateIcon.js +13 -10
- package/dist/Editor/assets/svg/RedoIcon.js +27 -0
- package/dist/Editor/assets/svg/SettingsIcon.js +28 -0
- package/dist/Editor/assets/svg/TextIcon.js +8 -5
- package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
- package/dist/Editor/assets/svg/UndoIcon.js +27 -0
- package/dist/Editor/common/ColorPickerButton.js +25 -9
- package/dist/Editor/common/CustomColorPicker/index.js +106 -0
- package/dist/Editor/common/CustomColorPicker/style.js +53 -0
- package/dist/Editor/common/CustomDialog/index.js +94 -0
- package/dist/Editor/common/CustomDialog/style.js +67 -0
- package/dist/Editor/common/CustomSelect.js +33 -0
- package/dist/Editor/common/DnD/DragHandleButton.js +56 -47
- package/dist/Editor/common/Icon.js +41 -8
- package/dist/Editor/common/LinkSettings/NavComponents.js +5 -2
- package/dist/Editor/common/LinkSettings/index.js +4 -2
- package/dist/Editor/common/LinkSettings/navOptions.js +7 -2
- package/dist/Editor/common/LinkSettings/style.js +11 -8
- package/dist/Editor/common/MentionsPopup/MentionsListCard.js +6 -1
- package/dist/Editor/common/MentionsPopup/index.js +8 -12
- package/dist/Editor/common/Section/index.js +69 -28
- package/dist/Editor/common/Section/styles.js +12 -6
- package/dist/Editor/common/Shorthands/elements.js +54 -12
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +19 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +31 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +14 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +2 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +14 -4
- package/dist/Editor/common/StyleBuilder/index.js +1 -1
- package/dist/Editor/common/StyleBuilder/sectionStyle.js +2 -13
- package/dist/Editor/common/iconslist.js +0 -31
- package/dist/Editor/helper/index.js +0 -139
- package/dist/Editor/helper/theme.js +185 -48
- package/dist/Editor/hooks/useEditorTheme.js +139 -0
- package/dist/Editor/hooks/useMouseMove.js +12 -37
- package/dist/Editor/hooks/useWindowMessage.js +10 -7
- package/dist/Editor/hooks/withCommon.js +1 -2
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +1 -1
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +50 -173
- package/dist/Editor/theme/index.js +144 -0
- package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
- package/dist/Editor/themeSettings/buttons/index.js +290 -0
- package/dist/Editor/themeSettings/buttons/style.js +21 -0
- package/dist/Editor/themeSettings/colorTheme/index.js +290 -0
- package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +123 -0
- package/dist/Editor/themeSettings/fonts/index.js +213 -0
- package/dist/Editor/themeSettings/fonts/style.js +44 -0
- package/dist/Editor/themeSettings/icons.js +60 -0
- package/dist/Editor/themeSettings/index.js +320 -0
- package/dist/Editor/themeSettings/style.js +152 -0
- package/dist/Editor/themeSettingsAI/icons.js +96 -0
- package/dist/Editor/themeSettingsAI/index.js +356 -0
- package/dist/Editor/themeSettingsAI/saveTheme.js +190 -0
- package/dist/Editor/themeSettingsAI/style.js +247 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +163 -47
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/draftToSlate.js +1 -1
- package/dist/Editor/utils/events.js +54 -7
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +31 -31
- package/dist/Editor/utils/table.js +51 -43
- package/package.json +4 -6
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +0 -391
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +0 -193
- package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +0 -23
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +0 -184
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +0 -36
- package/dist/Editor/Elements/FreeGrid/Options/More.js +0 -24
- package/dist/Editor/Elements/FreeGrid/Options/SectionSettings.js +0 -47
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +0 -11
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +0 -75
- package/dist/Editor/Elements/FreeGrid/styles.js +0 -159
- package/dist/Editor/ErrorBoundary.js +0 -30
- package/dist/Editor/common/RnD/ContextMenu/CMenus.js +0 -105
- package/dist/Editor/common/RnD/ContextMenu/index.js +0 -38
- package/dist/Editor/common/RnD/ContextMenu/styles.js +0 -21
- package/dist/Editor/common/RnD/DragInfo/index.js +0 -31
- package/dist/Editor/common/RnD/DragInfo/styles.js +0 -15
- package/dist/Editor/common/RnD/DragOver/index.js +0 -46
- package/dist/Editor/common/RnD/DragOver/styles.js +0 -23
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +0 -82
- package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +0 -26
- package/dist/Editor/common/RnD/ElementOptions/index.js +0 -93
- package/dist/Editor/common/RnD/ElementOptions/styles.js +0 -41
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Link.js +0 -153
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +0 -58
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +0 -7
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +0 -46
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +0 -46
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +0 -46
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +0 -30
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +0 -46
- package/dist/Editor/common/RnD/ElementSettings/Settings/index.js +0 -13
- package/dist/Editor/common/RnD/ElementSettings/index.js +0 -17
- package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +0 -14
- package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -76
- package/dist/Editor/common/RnD/GuideLines/BoundaryLine.js +0 -52
- package/dist/Editor/common/RnD/GuideLines/index.js +0 -33
- package/dist/Editor/common/RnD/GuideLines/styles.js +0 -60
- package/dist/Editor/common/RnD/OptionsPopup/index.js +0 -50
- package/dist/Editor/common/RnD/OptionsPopup/style.js +0 -36
- package/dist/Editor/common/RnD/RnDCopy.js +0 -23
- package/dist/Editor/common/RnD/ShadowElement.js +0 -34
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +0 -40
- package/dist/Editor/common/RnD/SwitchViewport/styles.js +0 -24
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +0 -63
- package/dist/Editor/common/RnD/TransformHandles/CornerHandle.js +0 -19
- package/dist/Editor/common/RnD/TransformHandles/Icons/BottomRightIcon.js +0 -13
- package/dist/Editor/common/RnD/TransformHandles/SizeHandle.js +0 -18
- package/dist/Editor/common/RnD/TransformHandles/index.js +0 -62
- package/dist/Editor/common/RnD/Utils/alignmentDetection.js +0 -26
- package/dist/Editor/common/RnD/Utils/calculateDropItem.js +0 -98
- package/dist/Editor/common/RnD/Utils/collisionDetection.js +0 -52
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +0 -148
- package/dist/Editor/common/RnD/Utils/index.js +0 -251
- package/dist/Editor/common/RnD/VirtualElement/index.js +0 -76
- package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -27
- package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +0 -28
- package/dist/Editor/common/RnD/index.js +0 -503
- package/dist/Editor/common/RnD/styles.js +0 -4
- package/dist/Editor/common/StyleBuilder/boxStyle.js +0 -30
- package/dist/Editor/helper/RnD/focusOnNewItem.js +0 -39
- package/dist/Editor/helper/RnD/scrollToNewSection.js +0 -24
- package/dist/Editor/helper/breakpoint.js +0 -5
- package/dist/Editor/hooks/useBreakpoints.js +0 -34
- package/dist/Editor/hooks/withErrorHandling.js +0 -14
- package/dist/Editor/utils/RnD/RnDCtrlCmds.js +0 -168
- 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,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,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;
|