@flozy/editor 4.9.0 → 4.9.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +2 -1
- package/dist/Editor/Editor.css +1 -3
- package/dist/Editor/Elements/Embed/Video.js +3 -2
- package/dist/Editor/Elements/Grid/GridItem.js +30 -10
- package/dist/Editor/Elements/Grid/Styles.js +11 -0
- package/dist/Editor/Elements/Grid/templates/default_grid.js +4 -4
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +27 -38
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -2
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +1 -1
- package/dist/Editor/common/StyleBuilder/index.js +43 -57
- package/dist/Editor/utils/gridItem.js +8 -4
- package/package.json +1 -1
@@ -579,8 +579,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
579
579
|
setIsTextSelected: setIsTextSelected,
|
580
580
|
customProps: customProps,
|
581
581
|
editorWrapper: editorWrapper
|
582
|
-
}) : null, !readOnly
|
582
|
+
}) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
|
583
583
|
breakpoint: breakpoint,
|
584
|
+
show: showViewport,
|
584
585
|
onChange: b => onSwitchBreakpoint(b)
|
585
586
|
}) : null]
|
586
587
|
})
|
package/dist/Editor/Editor.css
CHANGED
@@ -101,6 +101,7 @@ const Video = ({
|
|
101
101
|
horizantal
|
102
102
|
} = alignment || {};
|
103
103
|
const path = ReactEditor.findPath(editor, element);
|
104
|
+
const hasAspect = url && aspectRatio !== "custom" && aspectRatio;
|
104
105
|
const getSize = () => {
|
105
106
|
if (element?.size === undefined) {
|
106
107
|
return {
|
@@ -190,10 +191,10 @@ const Video = ({
|
|
190
191
|
width: {
|
191
192
|
...getBreakPointsValue(getSize(), null, "overrideReSize", true)
|
192
193
|
},
|
193
|
-
height: url && !aspectRatio ? {
|
194
|
+
height: url && (aspectRatio === "custom" || !aspectRatio) ? {
|
194
195
|
...getBreakPointsValue(getSize(), null, "overrideReSizeH", true)
|
195
196
|
} : "auto",
|
196
|
-
aspectRatio:
|
197
|
+
aspectRatio: hasAspect ? aspectRatio : "auto"
|
197
198
|
}, theme)
|
198
199
|
};
|
199
200
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
2
2
|
import React, { useEffect, useState, useRef } from "react";
|
3
|
-
import { useTheme } from "@mui/material";
|
3
|
+
import { Button, Dialog, DialogActions, DialogContent, useTheme } from "@mui/material";
|
4
4
|
import { Node, Path, Transforms } from "slate";
|
5
5
|
import { useSlateStatic, ReactEditor } from "slate-react";
|
6
6
|
import GridItemPopup from "./GridItemPopup";
|
@@ -83,7 +83,7 @@ const GridItem = props => {
|
|
83
83
|
initColumnWidth,
|
84
84
|
updateColumnWidth,
|
85
85
|
updateColNodes
|
86
|
-
} = useGrid();
|
86
|
+
} = useGrid() || {};
|
87
87
|
const columnRef = useRef(null);
|
88
88
|
const theme = useTheme();
|
89
89
|
const classes = GridStyles(theme);
|
@@ -129,6 +129,7 @@ const GridItem = props => {
|
|
129
129
|
const selected = hoverPath === path.join(",");
|
130
130
|
const [showTool] = useEditorSelection(editor);
|
131
131
|
const [parentDOM, setParentDOM] = useState({});
|
132
|
+
const [alert, setAlert] = useState(null);
|
132
133
|
const [size, onMouseDown, resizing, onLoad, isDone] = useTableResize({
|
133
134
|
...parentDOM
|
134
135
|
});
|
@@ -216,16 +217,23 @@ const GridItem = props => {
|
|
216
217
|
try {
|
217
218
|
const gridPath = Path.parent(path);
|
218
219
|
const gridNode = Node.get(editor, gridPath);
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
220
|
+
if (gridNode?.children?.length === 5) {
|
221
|
+
setAlert("Maximum column limit exceeded");
|
222
|
+
} else {
|
223
|
+
onAddGridItem({
|
224
|
+
editor,
|
225
|
+
element: gridNode,
|
226
|
+
children: gridNode?.children || [],
|
227
|
+
isColumn: gridNode?.equalItems
|
228
|
+
});
|
229
|
+
}
|
225
230
|
} catch (err) {
|
226
231
|
console.log(err);
|
227
232
|
}
|
228
233
|
};
|
234
|
+
const handleClose = () => {
|
235
|
+
setAlert(null);
|
236
|
+
};
|
229
237
|
const getBorderColor = () => {
|
230
238
|
return borderColor || "transparent";
|
231
239
|
};
|
@@ -315,7 +323,8 @@ const GridItem = props => {
|
|
315
323
|
...giInProps,
|
316
324
|
width: "100%",
|
317
325
|
height: "100%",
|
318
|
-
color
|
326
|
+
// dark theme default color effect - FS-6961
|
327
|
+
color: textColor || "inherit",
|
319
328
|
"&:hover": {
|
320
329
|
borderColor: borderColorHover || borderColor || "transparent"
|
321
330
|
}
|
@@ -328,11 +337,22 @@ const GridItem = props => {
|
|
328
337
|
onClose: onClose,
|
329
338
|
onDelete: onDelete,
|
330
339
|
customProps: customProps
|
331
|
-
}) : null, /*#__PURE__*/_jsx(Resizer, {
|
340
|
+
}) : null, !readOnly ? /*#__PURE__*/_jsx(Resizer, {
|
332
341
|
classes: classes,
|
333
342
|
className: resizing ? "resizing" : "",
|
334
343
|
onMouseDown: onMouseDown,
|
335
344
|
height: "auto"
|
345
|
+
}) : null, /*#__PURE__*/_jsxs(Dialog, {
|
346
|
+
open: Boolean(alert),
|
347
|
+
onClose: handleClose,
|
348
|
+
children: [/*#__PURE__*/_jsx(DialogContent, {
|
349
|
+
children: alert
|
350
|
+
}), /*#__PURE__*/_jsx(DialogActions, {
|
351
|
+
children: /*#__PURE__*/_jsx(Button, {
|
352
|
+
onClick: handleClose,
|
353
|
+
children: "Close"
|
354
|
+
})
|
355
|
+
})]
|
336
356
|
})]
|
337
357
|
});
|
338
358
|
};
|
@@ -38,14 +38,25 @@ const GridStyles = theme => ({
|
|
38
38
|
}
|
39
39
|
},
|
40
40
|
flex: "1 1 0",
|
41
|
+
height: "100%",
|
41
42
|
[theme?.breakpoints?.between("xs", "md")]: {
|
42
43
|
flex: "1 1 100%",
|
44
|
+
height: "auto",
|
43
45
|
padding: "0px !important",
|
44
46
|
minWidth: "100% !important",
|
45
47
|
maxWidth: "100% !important",
|
46
48
|
"& .col-width-resizer": {
|
47
49
|
display: "none !important"
|
48
50
|
}
|
51
|
+
},
|
52
|
+
"& .gi-inner-cw": {
|
53
|
+
overflowX: "auto",
|
54
|
+
wordBreak: "break-word",
|
55
|
+
"& .tableToolBar": {
|
56
|
+
display: "flex",
|
57
|
+
maxWidth: "100%",
|
58
|
+
overflowX: "auto"
|
59
|
+
}
|
49
60
|
}
|
50
61
|
},
|
51
62
|
"& .col-width-resizer": {
|
@@ -14,10 +14,10 @@ const default_grid = [{
|
|
14
14
|
bgColor: "rgba(255, 255, 255, 0)",
|
15
15
|
lockSpacing: true,
|
16
16
|
bannerSpacing: {
|
17
|
-
top: "
|
17
|
+
top: "8",
|
18
18
|
left: "0",
|
19
19
|
right: "0",
|
20
|
-
bottom: "
|
20
|
+
bottom: "16"
|
21
21
|
},
|
22
22
|
alignment: {
|
23
23
|
horizantal: "center"
|
@@ -36,10 +36,10 @@ const default_grid = [{
|
|
36
36
|
bgColor: "rgba(255, 255, 255, 0)",
|
37
37
|
lockSpacing: true,
|
38
38
|
bannerSpacing: {
|
39
|
-
top: "
|
39
|
+
top: "8",
|
40
40
|
left: "0",
|
41
41
|
right: "0",
|
42
|
-
bottom: "
|
42
|
+
bottom: "16"
|
43
43
|
},
|
44
44
|
forceFullWidth: true,
|
45
45
|
borderWidth: "0px"
|
@@ -5,6 +5,7 @@ import { StyleContent } from "../../../StyleBuilder";
|
|
5
5
|
import { formStyle } from "../../../StyleBuilder/formStyle";
|
6
6
|
import { ReactEditor } from "slate-react";
|
7
7
|
import { ExpandMoreOutlined } from "@mui/icons-material";
|
8
|
+
import { useEditorContext } from "../../../../hooks/useMouseMove";
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
11
|
const FormSettings = props => {
|
@@ -20,6 +21,9 @@ const FormSettings = props => {
|
|
20
21
|
const {
|
21
22
|
hideTools
|
22
23
|
} = customProps || {};
|
24
|
+
const {
|
25
|
+
theme
|
26
|
+
} = useEditorContext();
|
23
27
|
const onChange = data => {
|
24
28
|
const currentPath = ReactEditor.findPath(editor, element);
|
25
29
|
const updateData = {
|
@@ -58,6 +62,17 @@ const FormSettings = props => {
|
|
58
62
|
MuiAccordion: {
|
59
63
|
styleOverrides: {
|
60
64
|
root: {
|
65
|
+
"& .MuiAccordionSummary-root": {
|
66
|
+
flexDirection: "row-reverse",
|
67
|
+
"& .MuiSvgIcon-root": {
|
68
|
+
color: theme?.palette?.primary?.main
|
69
|
+
},
|
70
|
+
"& .Mui-expanded": {
|
71
|
+
"& .MuiSvgIcon-root": {
|
72
|
+
color: theme?.palette?.text?.blueText
|
73
|
+
}
|
74
|
+
}
|
75
|
+
},
|
61
76
|
padding: "0px",
|
62
77
|
"&.Mui-expanded": {
|
63
78
|
margin: "0"
|
@@ -85,7 +100,7 @@ const FormSettings = props => {
|
|
85
100
|
padding: "0px"
|
86
101
|
},
|
87
102
|
children: /*#__PURE__*/_jsx(Typography, {
|
88
|
-
variant: "
|
103
|
+
variant: "body1",
|
89
104
|
className: "settingsHeader",
|
90
105
|
color: "primary",
|
91
106
|
style: {
|
@@ -99,41 +114,15 @@ const FormSettings = props => {
|
|
99
114
|
padding: "5px"
|
100
115
|
},
|
101
116
|
children: m?.fields.filter(f => (hideTools || []).indexOf(f.value) === -1).map((field, index) => {
|
102
|
-
return /*#__PURE__*/_jsx(
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
112
|
-
variant: "h3",
|
113
|
-
className: "settingsHeader",
|
114
|
-
color: "primary",
|
115
|
-
style: {
|
116
|
-
fontSize: "14px !important",
|
117
|
-
fontWeight: "400"
|
118
|
-
},
|
119
|
-
children: field?.tab
|
120
|
-
})
|
121
|
-
}), /*#__PURE__*/_jsx(AccordionDetails, {
|
122
|
-
sx: {
|
123
|
-
padding: "0px"
|
124
|
-
},
|
125
|
-
children: /*#__PURE__*/_jsx(StyleContent, {
|
126
|
-
renderTabs: [field],
|
127
|
-
value: field.value,
|
128
|
-
element: element,
|
129
|
-
onChange: onChange,
|
130
|
-
customElement: element?.children?.[0] || null,
|
131
|
-
customProps: customProps,
|
132
|
-
handleClose: handleClose
|
133
|
-
}, `tab_${field.value}_${index}`)
|
134
|
-
})]
|
135
|
-
}, `accordion_${index}`)
|
136
|
-
}, index);
|
117
|
+
return /*#__PURE__*/_jsx(StyleContent, {
|
118
|
+
renderTabs: [field],
|
119
|
+
value: field.value,
|
120
|
+
element: element,
|
121
|
+
onChange: onChange,
|
122
|
+
customElement: element?.children?.[0] || null,
|
123
|
+
customProps: customProps,
|
124
|
+
handleClose: handleClose
|
125
|
+
}, `tab_${field.value}_${index}`);
|
137
126
|
})
|
138
127
|
})]
|
139
128
|
}, `accordion_${i}`)
|
@@ -146,10 +135,10 @@ const FormSettings = props => {
|
|
146
135
|
children: [/*#__PURE__*/_jsx(AccordionSummary, {
|
147
136
|
expandIcon: /*#__PURE__*/_jsx(ExpandMoreOutlined, {}),
|
148
137
|
sx: {
|
149
|
-
padding: "
|
138
|
+
padding: "5px"
|
150
139
|
},
|
151
140
|
children: /*#__PURE__*/_jsx(Typography, {
|
152
|
-
variant: "
|
141
|
+
variant: "body1",
|
153
142
|
className: "settingsHeader",
|
154
143
|
color: "primary",
|
155
144
|
style: {
|
@@ -3,19 +3,28 @@ import PersonalVideoIcon from "@mui/icons-material/PersonalVideo";
|
|
3
3
|
import PhoneIphoneIcon from "@mui/icons-material/PhoneIphone";
|
4
4
|
import useSwitchViewport from "./styles";
|
5
5
|
import { useEffect } from "react";
|
6
|
+
import { useEditorContext } from "../../../hooks/useMouseMove";
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
9
|
const SwitchViewport = props => {
|
9
10
|
const {
|
10
11
|
breakpoint,
|
11
|
-
onChange
|
12
|
+
onChange,
|
13
|
+
show
|
12
14
|
} = props;
|
13
15
|
const classes = useSwitchViewport();
|
16
|
+
const {
|
17
|
+
setSelectedElement
|
18
|
+
} = useEditorContext();
|
14
19
|
useEffect(() => {
|
15
|
-
|
20
|
+
// to reset selection on viewport changes - FS-6589
|
21
|
+
setSelectedElement({});
|
16
22
|
}, [breakpoint]);
|
17
23
|
return /*#__PURE__*/_jsxs(Box, {
|
18
24
|
sx: classes.root,
|
25
|
+
style: {
|
26
|
+
display: show ? "block" : "none"
|
27
|
+
},
|
19
28
|
children: [/*#__PURE__*/_jsx(Tooltip, {
|
20
29
|
title: "Desktop View",
|
21
30
|
children: /*#__PURE__*/_jsx(IconButton, {
|
@@ -5,27 +5,10 @@ import CloseIcon from "@mui/icons-material/Close";
|
|
5
5
|
import useCommonStyle from "../../commonStyle";
|
6
6
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
7
7
|
import { ThemeProvider } from "@mui/material/styles";
|
8
|
-
import { ExpandMoreOutlined,
|
8
|
+
import { ExpandMoreOutlined, ExpandMoreSharp } from "@mui/icons-material";
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
10
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
11
11
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
12
|
-
const muiTheme = createTheme({
|
13
|
-
components: {
|
14
|
-
MuiAccordion: {
|
15
|
-
styleOverrides: {
|
16
|
-
root: {
|
17
|
-
padding: "0px",
|
18
|
-
"&.Mui-expanded": {
|
19
|
-
margin: "0"
|
20
|
-
}
|
21
|
-
}
|
22
|
-
},
|
23
|
-
defaultProps: {
|
24
|
-
elevation: 0
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
28
|
-
});
|
29
12
|
export const StyleContent = props => {
|
30
13
|
const {
|
31
14
|
value,
|
@@ -95,6 +78,34 @@ const StyleBuilder = props => {
|
|
95
78
|
const {
|
96
79
|
hideTools
|
97
80
|
} = customProps || {};
|
81
|
+
const muiTheme = createTheme({
|
82
|
+
components: {
|
83
|
+
MuiAccordion: {
|
84
|
+
styleOverrides: {
|
85
|
+
root: {
|
86
|
+
"& .MuiAccordionSummary-root": {
|
87
|
+
flexDirection: "row-reverse",
|
88
|
+
"& .MuiSvgIcon-root": {
|
89
|
+
color: theme?.palette?.primary?.main
|
90
|
+
},
|
91
|
+
"& .Mui-expanded": {
|
92
|
+
"& .MuiSvgIcon-root": {
|
93
|
+
color: theme?.palette?.text?.blueText
|
94
|
+
}
|
95
|
+
}
|
96
|
+
},
|
97
|
+
padding: "0px",
|
98
|
+
"&.Mui-expanded": {
|
99
|
+
margin: "0"
|
100
|
+
}
|
101
|
+
}
|
102
|
+
},
|
103
|
+
defaultProps: {
|
104
|
+
elevation: 0
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
});
|
98
109
|
useEffect(() => {
|
99
110
|
if (customProps?.onDrawerOpen) {
|
100
111
|
customProps?.onDrawerOpen(true);
|
@@ -171,17 +182,17 @@ const StyleBuilder = props => {
|
|
171
182
|
children: /*#__PURE__*/_jsxs(Accordion, {
|
172
183
|
defaultExpanded: true,
|
173
184
|
children: [/*#__PURE__*/_jsx(AccordionSummary, {
|
174
|
-
expandIcon: /*#__PURE__*/_jsx(
|
185
|
+
expandIcon: /*#__PURE__*/_jsx(ExpandMoreSharp, {}),
|
175
186
|
sx: {
|
176
187
|
padding: "0px"
|
177
188
|
},
|
178
189
|
children: /*#__PURE__*/_jsx(Typography, {
|
179
|
-
variant: "
|
190
|
+
variant: "body1",
|
180
191
|
className: "settingsHeader",
|
181
192
|
color: "primary",
|
182
193
|
style: {
|
183
194
|
fontSize: "14px !important",
|
184
|
-
fontWeight: "400"
|
195
|
+
fontWeight: "400 !important"
|
185
196
|
},
|
186
197
|
children: m?.tab
|
187
198
|
})
|
@@ -190,40 +201,14 @@ const StyleBuilder = props => {
|
|
190
201
|
padding: "5px"
|
191
202
|
},
|
192
203
|
children: m?.fields.filter(f => (hideTools || []).indexOf(f.value) === -1).map((field, index) => {
|
193
|
-
return /*#__PURE__*/_jsx(
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
},
|
202
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
203
|
-
variant: "h3",
|
204
|
-
className: "settingsHeader",
|
205
|
-
color: "primary",
|
206
|
-
style: {
|
207
|
-
fontSize: "14px !important",
|
208
|
-
fontWeight: "400"
|
209
|
-
},
|
210
|
-
children: field?.tab
|
211
|
-
})
|
212
|
-
}), /*#__PURE__*/_jsx(AccordionDetails, {
|
213
|
-
sx: {
|
214
|
-
padding: "0px"
|
215
|
-
},
|
216
|
-
children: /*#__PURE__*/_jsx(StyleContent, {
|
217
|
-
renderTabs: [field],
|
218
|
-
value: field.value,
|
219
|
-
element: elementProps,
|
220
|
-
onChange: onElementPropsChange,
|
221
|
-
customProps: customProps,
|
222
|
-
handleClose: handleClose
|
223
|
-
}, `tab_${field.value}_${index}`)
|
224
|
-
})]
|
225
|
-
}, `accordion_${index}`)
|
226
|
-
}, index);
|
204
|
+
return /*#__PURE__*/_jsx(StyleContent, {
|
205
|
+
renderTabs: [field],
|
206
|
+
value: field.value,
|
207
|
+
element: elementProps,
|
208
|
+
onChange: onElementPropsChange,
|
209
|
+
customProps: customProps,
|
210
|
+
handleClose: handleClose
|
211
|
+
}, `tab_${field.value}_${index}`);
|
227
212
|
})
|
228
213
|
})]
|
229
214
|
}, `accordion_${i}`)
|
@@ -239,7 +224,7 @@ const StyleBuilder = props => {
|
|
239
224
|
padding: "0px"
|
240
225
|
},
|
241
226
|
children: /*#__PURE__*/_jsx(Typography, {
|
242
|
-
variant: "
|
227
|
+
variant: "body1",
|
243
228
|
className: "settingsHeader",
|
244
229
|
color: "primary",
|
245
230
|
style: {
|
@@ -250,7 +235,7 @@ const StyleBuilder = props => {
|
|
250
235
|
})
|
251
236
|
}), /*#__PURE__*/_jsx(AccordionDetails, {
|
252
237
|
sx: {
|
253
|
-
padding: "
|
238
|
+
padding: "5px"
|
254
239
|
},
|
255
240
|
children: /*#__PURE__*/_jsx(StyleContent, {
|
256
241
|
renderTabs: renderTabs,
|
@@ -269,6 +254,7 @@ const StyleBuilder = props => {
|
|
269
254
|
sx: {
|
270
255
|
p: 0,
|
271
256
|
pt: 2,
|
257
|
+
pl: 1,
|
272
258
|
justifyContent: "space-between"
|
273
259
|
},
|
274
260
|
children: [onDelete ? /*#__PURE__*/_jsx(Button, {
|
@@ -45,15 +45,19 @@ export const onAddGridItem = ({
|
|
45
45
|
if (insertPath) {
|
46
46
|
insertPath[insertPath.length - 1] = element.children.length;
|
47
47
|
const lp = ReactEditor.findPath(editor, element);
|
48
|
-
const lastElement = {
|
49
|
-
...element.children[element.children.length - 1]
|
50
|
-
};
|
48
|
+
// const lastElement = { ...element.children[element.children.length - 1] };
|
51
49
|
if (isColumn && children?.length - 1 > 0) {
|
52
50
|
updateLastSiblingWidths(editor, [...lp, children.length - 1]);
|
53
51
|
}
|
54
52
|
Transforms.insertNodes(editor, gridItem({
|
55
|
-
...(lastElement || {}),
|
53
|
+
// ...(lastElement || {}),
|
56
54
|
minWidth: null,
|
55
|
+
bannerSpacing: {
|
56
|
+
top: "8",
|
57
|
+
left: "0",
|
58
|
+
right: "0",
|
59
|
+
bottom: "16"
|
60
|
+
},
|
57
61
|
children: [{
|
58
62
|
type: "paragraph",
|
59
63
|
children: [{
|