@flozy/editor 1.7.5 → 1.7.6
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.
- package/dist/Editor/CommonEditor.js +30 -12
- package/dist/Editor/DialogWrapper.js +2 -10
- package/dist/Editor/Editor.css +105 -0
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -4
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +9 -6
- package/dist/Editor/Elements/Color Picker/LogoIcon.js +15 -49
- package/dist/Editor/Elements/Color Picker/Styles.js +25 -4
- package/dist/Editor/Elements/Color Picker/defaultColors.js +1 -1
- package/dist/Editor/Elements/Embed/Image.js +25 -31
- package/dist/Editor/Elements/Embed/Video.js +49 -40
- package/dist/Editor/Elements/Form/Workflow/Styles.js +3 -2
- package/dist/Editor/Elements/Grid/Grid.js +67 -114
- package/dist/Editor/Elements/Grid/GridItem.js +9 -23
- package/dist/Editor/Elements/Grid/templates/default_grid.js +0 -23
- package/dist/Editor/Elements/Link/Link.js +58 -20
- package/dist/Editor/Elements/Link/LinkButton.js +37 -97
- package/dist/Editor/Elements/Link/LinkPopup.js +106 -0
- package/dist/Editor/Elements/List/CheckList.js +28 -22
- package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +11 -5
- package/dist/Editor/Elements/Signature/SignaturePopup.js +15 -4
- package/dist/Editor/Elements/SimpleText.js +30 -26
- package/dist/Editor/MiniEditor.js +4 -6
- package/dist/Editor/Styles/EditorStyles.js +72 -1
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +2 -1
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +5 -1
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +4 -0
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +96 -19
- package/dist/Editor/Toolbar/toolbarGroups.js +1 -1
- package/dist/Editor/common/Section/index.js +118 -0
- package/dist/Editor/common/Shorthands/elements.js +1 -1
- package/dist/Editor/common/StyleBuilder/appHeaderStyle.js +5 -1
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +44 -51
- package/dist/Editor/common/StyleBuilder/embedImageStyle.js +2 -24
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +0 -3
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +0 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +52 -62
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +2 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +100 -74
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +41 -10
- package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +3 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +27 -77
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +7 -5
- package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +19 -15
- package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +2 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +2 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +67 -8
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +2 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +21 -32
- package/dist/Editor/common/StyleBuilder/fieldTypes/textAlign.js +37 -41
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +26 -24
- package/dist/Editor/common/StyleBuilder/formStyle.js +0 -6
- package/dist/Editor/common/StyleBuilder/gridItemStyle.js +38 -54
- package/dist/Editor/common/StyleBuilder/gridStyle.js +20 -26
- package/dist/Editor/common/StyleBuilder/index.js +14 -58
- package/dist/Editor/common/StyleBuilder/sectionStyle.js +16 -0
- package/dist/Editor/helper/index.js +63 -1
- package/dist/Editor/utils/Decorators/index.js +5 -0
- package/dist/Editor/utils/Decorators/link.js +26 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +36 -8
- package/dist/Editor/utils/accordion.js +17 -4
- package/dist/Editor/utils/button.js +15 -1
- package/dist/Editor/utils/customHooks/useElement.js +28 -0
- package/dist/Editor/utils/embed.js +1 -7
- package/dist/Editor/utils/events.js +92 -43
- package/dist/Editor/utils/gridItem.js +1 -1
- package/dist/Editor/utils/link.js +10 -9
- package/package.json +1 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useSlateStatic, ReactEditor } from "slate-react";
|
|
3
3
|
import { Node, Transforms } from "slate";
|
|
4
|
+
import { IconButton, Tooltip, Box } from "@mui/material";
|
|
5
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
|
4
6
|
import AspectRatioIcon from "@mui/icons-material/AspectRatio";
|
|
5
7
|
import Icon from "../../common/Icon";
|
|
6
8
|
import useResize from "../../utils/customHooks/useResize";
|
|
7
|
-
import { IconButton, Tooltip } from "@mui/material";
|
|
8
|
-
import DeleteIcon from "@mui/icons-material/Delete";
|
|
9
9
|
import EmbedPopup from "./EmbedPopup";
|
|
10
10
|
import { GridSettingsIcon } from "../../common/iconslist";
|
|
11
11
|
import { gradientBorder } from "../../utils/helper";
|
|
12
|
+
import { getEmbedURL } from "../../helper";
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
15
|
const Video = ({
|
|
@@ -18,18 +19,16 @@ const Video = ({
|
|
|
18
19
|
customProps
|
|
19
20
|
}) => {
|
|
20
21
|
const {
|
|
21
|
-
url,
|
|
22
22
|
alt,
|
|
23
23
|
alignment,
|
|
24
24
|
bannerSpacing,
|
|
25
25
|
borderRadius,
|
|
26
26
|
borderWidth,
|
|
27
27
|
borderColor,
|
|
28
|
-
borderStyle
|
|
28
|
+
borderStyle,
|
|
29
|
+
url
|
|
29
30
|
} = element;
|
|
30
31
|
const editor = useSlateStatic();
|
|
31
|
-
const selected = useSelected();
|
|
32
|
-
const focused = useFocused();
|
|
33
32
|
const [openSetttings, setOpenSettings] = useState(false);
|
|
34
33
|
const [parentDOM, setParentDOM] = useState(null);
|
|
35
34
|
const {
|
|
@@ -116,13 +115,53 @@ const Video = ({
|
|
|
116
115
|
};
|
|
117
116
|
const totalMinus = parseInt(left || 0) + parseInt(right || 0);
|
|
118
117
|
const width = resizing ? `${size.width}px` : `${size.widthInPercent || 100}%`;
|
|
118
|
+
const embedURL = getEmbedURL(element);
|
|
119
|
+
const VideoContent = () => {
|
|
120
|
+
return resizing ? /*#__PURE__*/_jsx("div", {
|
|
121
|
+
style: {
|
|
122
|
+
width: "100%",
|
|
123
|
+
height: "100%",
|
|
124
|
+
border: "2px dashed black",
|
|
125
|
+
display: "flex",
|
|
126
|
+
justifyContent: "center",
|
|
127
|
+
alignItems: "center"
|
|
128
|
+
},
|
|
129
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
130
|
+
icon: "videoPlayer"
|
|
131
|
+
})
|
|
132
|
+
}) : /*#__PURE__*/_jsx("iframe", {
|
|
133
|
+
className: "embedd-iframe",
|
|
134
|
+
style: {
|
|
135
|
+
border: "none",
|
|
136
|
+
position: "absolute",
|
|
137
|
+
width: "100%",
|
|
138
|
+
height: "100%",
|
|
139
|
+
left: "0px",
|
|
140
|
+
...(gradientBorder(borderColor) || {}),
|
|
141
|
+
borderWidth: borderWidth || "1px",
|
|
142
|
+
borderRadius: `${topLeft}px ${topRight}px ${bottomLeft}px ${bottomRight}px`,
|
|
143
|
+
borderStyle: borderStyle || "solid"
|
|
144
|
+
},
|
|
145
|
+
src: embedURL,
|
|
146
|
+
title: alt
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
const VideoPlaceholder = () => {
|
|
150
|
+
return !url && !readOnly ? /*#__PURE__*/_jsxs(Box, {
|
|
151
|
+
component: "button",
|
|
152
|
+
className: "element-empty-btn",
|
|
153
|
+
onClick: onSettings,
|
|
154
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
155
|
+
icon: "video"
|
|
156
|
+
}), "Embed Video or Other"]
|
|
157
|
+
}) : /*#__PURE__*/_jsx(VideoContent, {});
|
|
158
|
+
};
|
|
119
159
|
return /*#__PURE__*/_jsxs("div", {
|
|
120
160
|
...attributes,
|
|
121
161
|
className: "embed has-hover video",
|
|
122
162
|
style: {
|
|
123
163
|
display: "flex",
|
|
124
164
|
width: `calc(100% - ${totalMinus}px)`,
|
|
125
|
-
boxShadow: selected && focused && "0 0 3px 3px lightgray",
|
|
126
165
|
justifyContent: horizantal,
|
|
127
166
|
alignContent: vertical
|
|
128
167
|
},
|
|
@@ -139,39 +178,9 @@ const Video = ({
|
|
|
139
178
|
style: {
|
|
140
179
|
position: "relative",
|
|
141
180
|
width: `${width}`,
|
|
142
|
-
height: `${size.height}px`
|
|
181
|
+
height: url ? `${size.height}px` : "auto"
|
|
143
182
|
},
|
|
144
|
-
children: [!readOnly && /*#__PURE__*/_jsx(ToolBar, {}),
|
|
145
|
-
// The iframe reloads on each re-render and hence it stutters and the document doesn't detect mouse-up event leading to unwanted behaviour
|
|
146
|
-
// So during resize replace the iframe with a simple div
|
|
147
|
-
resizing ? /*#__PURE__*/_jsx("div", {
|
|
148
|
-
style: {
|
|
149
|
-
width: "100%",
|
|
150
|
-
height: "100%",
|
|
151
|
-
border: "2px dashed black",
|
|
152
|
-
display: "flex",
|
|
153
|
-
justifyContent: "center",
|
|
154
|
-
alignItems: "center"
|
|
155
|
-
},
|
|
156
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
157
|
-
icon: "videoPlayer"
|
|
158
|
-
})
|
|
159
|
-
}) : /*#__PURE__*/_jsx("iframe", {
|
|
160
|
-
className: "embedd-iframe",
|
|
161
|
-
style: {
|
|
162
|
-
border: "none",
|
|
163
|
-
position: "absolute",
|
|
164
|
-
width: "100%",
|
|
165
|
-
height: "100%",
|
|
166
|
-
left: "0px",
|
|
167
|
-
...(gradientBorder(borderColor) || {}),
|
|
168
|
-
borderWidth: borderWidth || "1px",
|
|
169
|
-
borderRadius: `${topLeft}px ${topRight}px ${bottomLeft}px ${bottomRight}px`,
|
|
170
|
-
borderStyle: borderStyle || "solid"
|
|
171
|
-
},
|
|
172
|
-
src: url,
|
|
173
|
-
title: alt
|
|
174
|
-
}), !readOnly ? /*#__PURE__*/_jsx(IconButton, {
|
|
183
|
+
children: [!readOnly && url && /*#__PURE__*/_jsx(ToolBar, {}), /*#__PURE__*/_jsx(VideoPlaceholder, {}), !readOnly && url ? /*#__PURE__*/_jsx(IconButton, {
|
|
175
184
|
onPointerDown: onMouseDown,
|
|
176
185
|
style: {
|
|
177
186
|
background: "#FFF"
|
|
@@ -14,7 +14,8 @@ const FormStyles = () => ({
|
|
|
14
14
|
width: "95%",
|
|
15
15
|
maxWidth: "95%",
|
|
16
16
|
outline: "none",
|
|
17
|
-
padding: "12px"
|
|
17
|
+
padding: "12px",
|
|
18
|
+
resize: "none"
|
|
18
19
|
},
|
|
19
20
|
"& textarea:focus-visible": {
|
|
20
21
|
outline: "none",
|
|
@@ -204,7 +205,7 @@ const FormStyles = () => ({
|
|
|
204
205
|
},
|
|
205
206
|
dialogFooter: {
|
|
206
207
|
"&.MuiDialogActions-root": {
|
|
207
|
-
padding: "
|
|
208
|
+
padding: "12px 24px"
|
|
208
209
|
},
|
|
209
210
|
"& .secondaryBtn": {
|
|
210
211
|
marginRight: "0px !important"
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
|
-
import React, { useState
|
|
3
|
-
import { Transforms, Path
|
|
4
|
-
import {
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { Transforms, Path } from "slate";
|
|
4
|
+
import { useSlateStatic, ReactEditor } from "slate-react";
|
|
5
5
|
import { IconButton, Tooltip, Grid as GridContainer } from "@mui/material";
|
|
6
6
|
import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward";
|
|
7
7
|
import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward";
|
|
8
8
|
import KeyboardReturnIcon from "@mui/icons-material/KeyboardReturn";
|
|
9
|
-
import TuneIcon from "@mui/icons-material/Tune";
|
|
10
9
|
import { insertGrid } from "../../utils/grid";
|
|
11
10
|
import { GridAddGridIcon, GridAddSectionIcon, GridSettingsIcon } from "../../common/iconslist";
|
|
12
11
|
import GridPopup from "./GridPopup";
|
|
@@ -43,10 +42,6 @@ const Grid = props => {
|
|
|
43
42
|
borderColor,
|
|
44
43
|
borderStyle,
|
|
45
44
|
borderRadius,
|
|
46
|
-
sectionBgColor,
|
|
47
|
-
sectionBackgroundImage,
|
|
48
|
-
sectionBannerSpacing,
|
|
49
|
-
sectionBorderRadius,
|
|
50
45
|
gridSize
|
|
51
46
|
} = element;
|
|
52
47
|
const {
|
|
@@ -55,12 +50,6 @@ const Grid = props => {
|
|
|
55
50
|
right,
|
|
56
51
|
bottom
|
|
57
52
|
} = bannerSpacing || {};
|
|
58
|
-
const {
|
|
59
|
-
left: ssleft,
|
|
60
|
-
top: sstop,
|
|
61
|
-
right: ssright,
|
|
62
|
-
bottom: ssbottom
|
|
63
|
-
} = sectionBannerSpacing || {};
|
|
64
53
|
const {
|
|
65
54
|
vertical,
|
|
66
55
|
horizantal,
|
|
@@ -72,12 +61,6 @@ const Grid = props => {
|
|
|
72
61
|
bottomLeft,
|
|
73
62
|
bottomRight
|
|
74
63
|
} = borderRadius || {};
|
|
75
|
-
const {
|
|
76
|
-
topLeft: ssTopLeft,
|
|
77
|
-
topRight: ssTopRight,
|
|
78
|
-
bottomLeft: ssBottomLeft,
|
|
79
|
-
bottomRight: ssBottomRight
|
|
80
|
-
} = sectionBorderRadius || {};
|
|
81
64
|
const editor = useSlateStatic();
|
|
82
65
|
const path = ReactEditor.findPath(editor, element);
|
|
83
66
|
const {
|
|
@@ -108,9 +91,6 @@ const Grid = props => {
|
|
|
108
91
|
});
|
|
109
92
|
}
|
|
110
93
|
};
|
|
111
|
-
const onSectionSettings = () => {
|
|
112
|
-
setOpenSettings("section");
|
|
113
|
-
};
|
|
114
94
|
const onSettings = () => {
|
|
115
95
|
setOpenSettings("grid");
|
|
116
96
|
};
|
|
@@ -228,13 +208,6 @@ const Grid = props => {
|
|
|
228
208
|
className: "grid-container-toolbar",
|
|
229
209
|
contentEditable: false,
|
|
230
210
|
children: [/*#__PURE__*/_jsx(Tooltip, {
|
|
231
|
-
title: "Section Settings",
|
|
232
|
-
arrow: true,
|
|
233
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
|
234
|
-
onClick: onSectionSettings,
|
|
235
|
-
children: /*#__PURE__*/_jsx(TuneIcon, {})
|
|
236
|
-
})
|
|
237
|
-
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
238
211
|
title: "Grid Settings",
|
|
239
212
|
arrow: true,
|
|
240
213
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
@@ -280,95 +253,75 @@ const Grid = props => {
|
|
|
280
253
|
const bgImage = backgroundImage && backgroundImage !== "none" ? {
|
|
281
254
|
backgroundImage: `url(${backgroundImage})`
|
|
282
255
|
} : {};
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
256
|
+
return /*#__PURE__*/_jsxs(GridContainer, {
|
|
257
|
+
container: true,
|
|
258
|
+
className: `grid-container ${grid} has-hover element-root`,
|
|
259
|
+
...attributes,
|
|
260
|
+
...sectionId,
|
|
288
261
|
style: {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
paddingLeft: `${ssleft}px`,
|
|
297
|
-
paddingRight: `${ssright}px`,
|
|
298
|
-
paddingTop: `${sstop}px`,
|
|
299
|
-
paddingBottom: `${ssbottom}px`,
|
|
300
|
-
borderRadius: `${ssTopLeft}px ${ssTopRight}px ${ssBottomLeft}px ${ssBottomRight}px`
|
|
262
|
+
background: bgColor,
|
|
263
|
+
alignContent: vertical,
|
|
264
|
+
...bgImage,
|
|
265
|
+
borderColor: borderColor || "transparent",
|
|
266
|
+
borderWidth: borderWidth || "1px",
|
|
267
|
+
borderRadius: `${topLeft}px ${topRight}px ${bottomLeft}px ${bottomRight}px`,
|
|
268
|
+
borderStyle: borderStyle || "solid"
|
|
301
269
|
},
|
|
302
|
-
"data-path": path.join(",")
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
270
|
+
"data-path": path.join(",")
|
|
271
|
+
// sx={{
|
|
272
|
+
// width: `${((gridSize || 12) / 12) * 100}%`,
|
|
273
|
+
// }}
|
|
274
|
+
,
|
|
275
|
+
children: [fgColor && /*#__PURE__*/_jsx("div", {
|
|
308
276
|
style: {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
277
|
+
position: "absolute",
|
|
278
|
+
pointerEvents: "none",
|
|
279
|
+
width: "100%",
|
|
280
|
+
height: "100%",
|
|
281
|
+
background: fgColor,
|
|
282
|
+
backgroundRepeat: "no-repeat",
|
|
283
|
+
backgroundSize: "cover"
|
|
284
|
+
}
|
|
285
|
+
}), !readOnly && /*#__PURE__*/_jsxs("div", {
|
|
286
|
+
className: `element-selector ${selected ? "selected" : ""}`,
|
|
287
|
+
contentEditable: false,
|
|
288
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
289
|
+
className: "element-selector-dots tl",
|
|
290
|
+
children: " "
|
|
291
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
292
|
+
className: "element-selector-dots tr",
|
|
293
|
+
children: " "
|
|
294
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
295
|
+
className: "element-selector-dots bl",
|
|
296
|
+
children: " "
|
|
297
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
298
|
+
className: "element-selector-dots br",
|
|
299
|
+
children: " "
|
|
300
|
+
}), /*#__PURE__*/_jsx(GridToolBar, {})]
|
|
301
|
+
}), openSetttings ? /*#__PURE__*/_jsx(PoupComp, {
|
|
302
|
+
element: element,
|
|
303
|
+
onSave: onSave,
|
|
304
|
+
onClose: onClose,
|
|
305
|
+
onDelete: onDelete,
|
|
306
|
+
customProps: customProps
|
|
307
|
+
}) : null, /*#__PURE__*/_jsx(GridContainer, {
|
|
308
|
+
item: true,
|
|
309
|
+
xs: 12,
|
|
310
|
+
className: "grid-c-wrpr",
|
|
311
|
+
style: {
|
|
312
|
+
display: "flex",
|
|
313
|
+
paddingLeft: `${left}px`,
|
|
314
|
+
paddingRight: `${right}px`,
|
|
315
|
+
paddingTop: `${top}px`,
|
|
316
|
+
paddingBottom: `${bottom}px`,
|
|
317
|
+
alignItems: vertical || "start",
|
|
318
|
+
justifyContent: horizantal || "start",
|
|
319
|
+
flexDirection: flexDirection || "row",
|
|
320
|
+
width: "100%"
|
|
316
321
|
},
|
|
317
322
|
"data-path": path.join(","),
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
},
|
|
321
|
-
children: [fgColor && /*#__PURE__*/_jsx("div", {
|
|
322
|
-
style: {
|
|
323
|
-
position: "absolute",
|
|
324
|
-
pointerEvents: "none",
|
|
325
|
-
width: "100%",
|
|
326
|
-
height: "100%",
|
|
327
|
-
background: fgColor,
|
|
328
|
-
backgroundRepeat: "no-repeat",
|
|
329
|
-
backgroundSize: "cover"
|
|
330
|
-
}
|
|
331
|
-
}), !readOnly && /*#__PURE__*/_jsxs("div", {
|
|
332
|
-
className: `element-selector ${selected ? "selected" : ""}`,
|
|
333
|
-
contentEditable: false,
|
|
334
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
335
|
-
className: "element-selector-dots tl",
|
|
336
|
-
children: " "
|
|
337
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
338
|
-
className: "element-selector-dots tr",
|
|
339
|
-
children: " "
|
|
340
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
341
|
-
className: "element-selector-dots bl",
|
|
342
|
-
children: " "
|
|
343
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
344
|
-
className: "element-selector-dots br",
|
|
345
|
-
children: " "
|
|
346
|
-
}), /*#__PURE__*/_jsx(GridToolBar, {})]
|
|
347
|
-
}), openSetttings ? /*#__PURE__*/_jsx(PoupComp, {
|
|
348
|
-
element: element,
|
|
349
|
-
onSave: onSave,
|
|
350
|
-
onClose: onClose,
|
|
351
|
-
onDelete: onDelete,
|
|
352
|
-
customProps: customProps
|
|
353
|
-
}) : null, /*#__PURE__*/_jsx(GridContainer, {
|
|
354
|
-
item: true,
|
|
355
|
-
xs: 12,
|
|
356
|
-
className: "grid-c-wrpr",
|
|
357
|
-
style: {
|
|
358
|
-
display: "flex",
|
|
359
|
-
paddingLeft: `${left}px`,
|
|
360
|
-
paddingRight: `${right}px`,
|
|
361
|
-
paddingTop: `${top}px`,
|
|
362
|
-
paddingBottom: `${bottom}px`,
|
|
363
|
-
alignItems: vertical || "start",
|
|
364
|
-
justifyContent: horizantal || "start",
|
|
365
|
-
flexDirection: flexDirection || "row",
|
|
366
|
-
width: "100%"
|
|
367
|
-
},
|
|
368
|
-
"data-path": path.join(","),
|
|
369
|
-
children: children
|
|
370
|
-
}), /*#__PURE__*/_jsx(NewLineButtons, {})]
|
|
371
|
-
})
|
|
323
|
+
children: children
|
|
324
|
+
}), /*#__PURE__*/_jsx(NewLineButtons, {})]
|
|
372
325
|
});
|
|
373
326
|
};
|
|
374
327
|
export default Grid;
|
|
@@ -53,8 +53,6 @@ const GridItem = props => {
|
|
|
53
53
|
bottomRight
|
|
54
54
|
} = borderRadius || {};
|
|
55
55
|
const editor = useSlateStatic();
|
|
56
|
-
// const selected = useSelected();
|
|
57
|
-
// const [selected, setSelected] = useState(false);
|
|
58
56
|
const itemWidth = (grid || 6) / 12 * 100;
|
|
59
57
|
const path = ReactEditor.findPath(editor, element);
|
|
60
58
|
const {
|
|
@@ -104,24 +102,11 @@ const GridItem = props => {
|
|
|
104
102
|
});
|
|
105
103
|
}
|
|
106
104
|
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// e.stopPropagation();
|
|
111
|
-
// setSelected(true);
|
|
112
|
-
// }
|
|
113
|
-
// };
|
|
114
|
-
|
|
115
|
-
// const onMouseLeave = (e) => {
|
|
116
|
-
// if (!readOnly) {
|
|
117
|
-
// e.stopPropagation();
|
|
118
|
-
// setSelected(false);
|
|
119
|
-
// }
|
|
120
|
-
// };
|
|
121
|
-
|
|
122
|
-
return /*#__PURE__*/_jsxs(Box, {
|
|
105
|
+
return /*#__PURE__*/_jsxs(Item, {
|
|
106
|
+
item: true,
|
|
107
|
+
xs: grid,
|
|
123
108
|
component: "div",
|
|
124
|
-
className: `grid-item xs-${grid} element-root gi-top-wrpr`,
|
|
109
|
+
className: `grid-item xs-${grid} element-root gi-top-wrpr content-editable`,
|
|
125
110
|
...attributes,
|
|
126
111
|
sx: {
|
|
127
112
|
display: "flex",
|
|
@@ -143,10 +128,11 @@ const GridItem = props => {
|
|
|
143
128
|
},
|
|
144
129
|
height: "100%"
|
|
145
130
|
},
|
|
146
|
-
"data-path": path.join(",")
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
,
|
|
131
|
+
"data-path": path.join(","),
|
|
132
|
+
style: {
|
|
133
|
+
textAlign: element.alignment || "left"
|
|
134
|
+
},
|
|
135
|
+
placeholder: "Grid Item",
|
|
150
136
|
children: [!readOnly && /*#__PURE__*/_jsxs("div", {
|
|
151
137
|
className: `element-selector ${selected ? "selected" : ""}`,
|
|
152
138
|
contentEditable: false,
|
|
@@ -34,24 +34,6 @@ const default_grid = [{
|
|
|
34
34
|
fontFamily: "PoppinsRegular",
|
|
35
35
|
text: ""
|
|
36
36
|
}]
|
|
37
|
-
}, {
|
|
38
|
-
type: "paragraph",
|
|
39
|
-
children: [{
|
|
40
|
-
type: "image",
|
|
41
|
-
url: "https://developers.elementor.com/docs/assets/img/elementor-placeholder-image.png",
|
|
42
|
-
images: [],
|
|
43
|
-
children: [{
|
|
44
|
-
text: " "
|
|
45
|
-
}],
|
|
46
|
-
size: {
|
|
47
|
-
width: 362.59375,
|
|
48
|
-
height: 207,
|
|
49
|
-
widthInPercent: 56.780034254954735
|
|
50
|
-
},
|
|
51
|
-
alignment: {
|
|
52
|
-
horizantal: "center"
|
|
53
|
-
}
|
|
54
|
-
}]
|
|
55
37
|
}, {
|
|
56
38
|
type: "paragraph",
|
|
57
39
|
children: [{
|
|
@@ -85,11 +67,6 @@ const default_grid = [{
|
|
|
85
67
|
children: [{
|
|
86
68
|
type: "alignLeft",
|
|
87
69
|
children: [{
|
|
88
|
-
type: "paragraph",
|
|
89
|
-
children: [{
|
|
90
|
-
text: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."
|
|
91
|
-
}]
|
|
92
|
-
}, {
|
|
93
70
|
type: "paragraph",
|
|
94
71
|
children: [{
|
|
95
72
|
text: ""
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Node, Transforms } from "slate";
|
|
3
|
+
import { ReactEditor, useFocused, useSelected, useSlateStatic } from "slate-react";
|
|
3
4
|
import { IconButton, Tooltip } from "@mui/material";
|
|
4
5
|
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
|
6
|
+
import EditIcon from "@mui/icons-material/Edit";
|
|
5
7
|
import LinkOffIcon from "@mui/icons-material/LinkOff";
|
|
6
|
-
import { insertDefaultEmbed } from "../../utils/embed";
|
|
7
|
-
import { getQueryStrings } from "../../utils/SlateUtilityFunctions";
|
|
8
8
|
import { removeLink } from "../../utils/link";
|
|
9
|
+
import LinkPopup from "./LinkPopup";
|
|
9
10
|
import "./styles.css";
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -17,21 +18,46 @@ const Link = ({
|
|
|
17
18
|
const editor = useSlateStatic();
|
|
18
19
|
const selected = useSelected();
|
|
19
20
|
const focused = useFocused();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
const [showInput, setShowInput] = useState(false);
|
|
22
|
+
const [linkData, setLinkData] = useState({
|
|
23
|
+
name: "",
|
|
24
|
+
url: "",
|
|
25
|
+
showInNewTab: true
|
|
26
|
+
});
|
|
27
|
+
const path = ReactEditor.findPath(editor, element);
|
|
28
|
+
const updateLink = () => {
|
|
29
|
+
Transforms.setNodes(editor, {
|
|
30
|
+
href: linkData?.url,
|
|
31
|
+
showInNewTab: linkData?.showInNewTab
|
|
32
|
+
}, {
|
|
33
|
+
at: path
|
|
34
|
+
});
|
|
35
|
+
setLinkData({
|
|
36
|
+
name: "",
|
|
37
|
+
url: "",
|
|
38
|
+
showInNewTab: true
|
|
39
|
+
});
|
|
40
|
+
setShowInput(false);
|
|
41
|
+
};
|
|
42
|
+
const onEditLink = () => {
|
|
43
|
+
setLinkData({
|
|
44
|
+
name: Node.string(element),
|
|
45
|
+
url: element?.href || "",
|
|
46
|
+
showInNewTab: true
|
|
47
|
+
});
|
|
48
|
+
setShowInput(true);
|
|
49
|
+
};
|
|
50
|
+
const handleInputChange = ({
|
|
51
|
+
target
|
|
52
|
+
}) => {
|
|
53
|
+
let val = target.type === "checkbox" ? target.checked : target.value;
|
|
54
|
+
setLinkData({
|
|
55
|
+
...linkData,
|
|
56
|
+
[target.name]: val
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const handleClose = () => {
|
|
60
|
+
setShowInput(false);
|
|
35
61
|
};
|
|
36
62
|
const Toolbar = () => {
|
|
37
63
|
return selected && focused ? /*#__PURE__*/_jsxs("div", {
|
|
@@ -49,6 +75,12 @@ const Link = ({
|
|
|
49
75
|
target: element.target,
|
|
50
76
|
children: /*#__PURE__*/_jsx(OpenInNewIcon, {})
|
|
51
77
|
})
|
|
78
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
79
|
+
title: "Edit",
|
|
80
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
81
|
+
onClick: onEditLink,
|
|
82
|
+
children: /*#__PURE__*/_jsx(EditIcon, {})
|
|
83
|
+
})
|
|
52
84
|
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
53
85
|
title: "Remove",
|
|
54
86
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
@@ -66,7 +98,13 @@ const Link = ({
|
|
|
66
98
|
...element.attr,
|
|
67
99
|
target: element.target,
|
|
68
100
|
children: children
|
|
69
|
-
}), /*#__PURE__*/_jsx(Toolbar, {})
|
|
101
|
+
}), /*#__PURE__*/_jsx(Toolbar, {}), /*#__PURE__*/_jsx(LinkPopup, {
|
|
102
|
+
open: showInput,
|
|
103
|
+
linkData: linkData,
|
|
104
|
+
handleClose: handleClose,
|
|
105
|
+
handleInputChange: handleInputChange,
|
|
106
|
+
handleInsertLink: updateLink
|
|
107
|
+
})]
|
|
70
108
|
});
|
|
71
109
|
};
|
|
72
110
|
export default Link;
|