@flozy/editor 3.2.7 → 3.2.9

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.
@@ -99,6 +99,7 @@ const EditorButton = props => {
99
99
  };
100
100
  const Toolbar = () => {
101
101
  const btnProps = handleLinkType(refURl, linkType, true, true, handleTrigger);
102
+ const hideOpenLink = linkType === "page" || !linkType;
102
103
  return !readOnly ? /*#__PURE__*/_jsxs("div", {
103
104
  className: "element-toolbar hr",
104
105
  style: {
@@ -121,7 +122,7 @@ const EditorButton = props => {
121
122
  onClick: onMenuClick("nav"),
122
123
  children: /*#__PURE__*/_jsx(LinkIcon, {})
123
124
  })
124
- }), linkType === "page" ? null : /*#__PURE__*/_jsx(Tooltip, {
125
+ }), hideOpenLink ? null : /*#__PURE__*/_jsx(Tooltip, {
125
126
  title: "Open Link",
126
127
  arrow: true,
127
128
  children: /*#__PURE__*/_jsx(Box, {
@@ -8,7 +8,8 @@ const DarkFrame = /*#__PURE__*/forwardRef((props, ref) => {
8
8
  imagePos,
9
9
  handleClick,
10
10
  imageRef,
11
- defaultScale
11
+ defaultScale,
12
+ readOnly
12
13
  } = props;
13
14
  const {
14
15
  calX,
@@ -41,7 +42,7 @@ const DarkFrame = /*#__PURE__*/forwardRef((props, ref) => {
41
42
  fill: `url(#imageSource_${id})`,
42
43
  ref: imageRef,
43
44
  style: {
44
- cursor: "move"
45
+ cursor: readOnly ? "pointer" : "move"
45
46
  }
46
47
  })
47
48
  }), /*#__PURE__*/_jsxs("defs", {
@@ -16,7 +16,8 @@ const ImageFrame = props => {
16
16
  id,
17
17
  framePos,
18
18
  onChange,
19
- readOnly
19
+ readOnly,
20
+ handleImageClick
20
21
  } = props;
21
22
  const svgRef = useRef();
22
23
  const [dom, setDOM] = useState(null);
@@ -75,6 +76,8 @@ const ImageFrame = props => {
75
76
  if (!readOnly) {
76
77
  setSelectedPath(id);
77
78
  setAnchorEl(svgRef?.current);
79
+ } else {
80
+ handleImageClick();
78
81
  }
79
82
  };
80
83
  const onClose = () => {
@@ -8,7 +8,8 @@ const InstaFrame = /*#__PURE__*/forwardRef((props, ref) => {
8
8
  imagePos,
9
9
  handleClick,
10
10
  imageRef,
11
- defaultScale
11
+ defaultScale,
12
+ readOnly
12
13
  } = props;
13
14
  const {
14
15
  calX,
@@ -98,7 +99,7 @@ const InstaFrame = /*#__PURE__*/forwardRef((props, ref) => {
98
99
  strokeWidth: "5",
99
100
  fill: `url(#imageSource_${id})`,
100
101
  style: {
101
- cursor: "move"
102
+ cursor: readOnly ? "pointer" : "move"
102
103
  },
103
104
  ref: imageRef
104
105
  }), /*#__PURE__*/_jsx("defs", {
@@ -8,7 +8,8 @@ const InstaFrame = /*#__PURE__*/forwardRef((props, ref) => {
8
8
  imagePos,
9
9
  handleClick,
10
10
  imageRef,
11
- defaultScale
11
+ defaultScale,
12
+ readOnly
12
13
  } = props;
13
14
  const {
14
15
  calX,
@@ -98,7 +99,7 @@ const InstaFrame = /*#__PURE__*/forwardRef((props, ref) => {
98
99
  fill: `url(#imageSource_${id})`,
99
100
  ref: imageRef,
100
101
  style: {
101
- cursor: "move"
102
+ cursor: readOnly ? "pointer" : "move"
102
103
  }
103
104
  }), /*#__PURE__*/_jsx("defs", {
104
105
  children: /*#__PURE__*/_jsx("pattern", {
@@ -8,7 +8,8 @@ const DarkFrame = /*#__PURE__*/forwardRef((props, ref) => {
8
8
  imagePos,
9
9
  handleClick,
10
10
  imageRef,
11
- defaultScale
11
+ defaultScale,
12
+ readOnly
12
13
  } = props;
13
14
  const {
14
15
  calX,
@@ -44,7 +45,7 @@ const DarkFrame = /*#__PURE__*/forwardRef((props, ref) => {
44
45
  fill: `url(#imageSource_${id})`,
45
46
  ref: imageRef,
46
47
  style: {
47
- cursor: "move"
48
+ cursor: readOnly ? "pointer" : "move"
48
49
  }
49
50
  })
50
51
  }), /*#__PURE__*/_jsxs("defs", {
@@ -8,7 +8,8 @@ const RoundedDark = /*#__PURE__*/forwardRef((props, ref) => {
8
8
  imagePos,
9
9
  handleClick,
10
10
  imageRef,
11
- defaultScale
11
+ defaultScale,
12
+ readOnly
12
13
  } = props;
13
14
  const {
14
15
  calX,
@@ -42,7 +43,7 @@ const RoundedDark = /*#__PURE__*/forwardRef((props, ref) => {
42
43
  fill: `url(#imageSource_${id})`,
43
44
  ref: imageRef,
44
45
  style: {
45
- cursor: "move"
46
+ cursor: readOnly ? "pointer" : "move"
46
47
  }
47
48
  })
48
49
  }), /*#__PURE__*/_jsxs("defs", {
@@ -8,7 +8,8 @@ const RoundedLight = /*#__PURE__*/forwardRef((props, ref) => {
8
8
  imagePos,
9
9
  handleClick,
10
10
  imageRef,
11
- defaultScale
11
+ defaultScale,
12
+ readOnly
12
13
  } = props;
13
14
  const {
14
15
  calX,
@@ -39,7 +40,7 @@ const RoundedLight = /*#__PURE__*/forwardRef((props, ref) => {
39
40
  fill: `url(#imageSource_${id})`,
40
41
  ref: imageRef,
41
42
  style: {
42
- cursor: "move"
43
+ cursor: readOnly ? "pointer" : "move"
43
44
  }
44
45
  }), /*#__PURE__*/_jsx("defs", {
45
46
  children: /*#__PURE__*/_jsx("pattern", {
@@ -8,7 +8,8 @@ const RoundedLightB2 = /*#__PURE__*/forwardRef((props, ref) => {
8
8
  imagePos,
9
9
  handleClick,
10
10
  imageRef,
11
- defaultScale
11
+ defaultScale,
12
+ readOnly
12
13
  } = props;
13
14
  const {
14
15
  calX,
@@ -39,7 +40,7 @@ const RoundedLightB2 = /*#__PURE__*/forwardRef((props, ref) => {
39
40
  fill: `url(#imageSource_${id})`,
40
41
  ref: imageRef,
41
42
  style: {
42
- cursor: "move"
43
+ cursor: readOnly ? "pointer" : "move"
43
44
  }
44
45
  }), /*#__PURE__*/_jsx("defs", {
45
46
  children: /*#__PURE__*/_jsx("pattern", {
@@ -15,6 +15,90 @@ import LinkSettings from "../../common/LinkSettings";
15
15
  import { handleLinkType } from "../../utils/helper";
16
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
17
  import { jsxs as _jsxs } from "react/jsx-runtime";
18
+ const ToolBar = ({
19
+ isEmpty,
20
+ onSettings,
21
+ setOpenNav
22
+ }) => {
23
+ return !isEmpty ? /*#__PURE__*/_jsxs("div", {
24
+ className: "element-toolbar visible-on-hover",
25
+ contentEditable: false,
26
+ style: {
27
+ top: "0px",
28
+ right: "0px",
29
+ left: "auto",
30
+ margin: "0px"
31
+ },
32
+ children: [/*#__PURE__*/_jsx(Tooltip, {
33
+ title: "Image Settings",
34
+ arrow: true,
35
+ children: /*#__PURE__*/_jsx(IconButton, {
36
+ onClick: onSettings,
37
+ children: /*#__PURE__*/_jsx(GridSettingsIcon, {})
38
+ })
39
+ }), /*#__PURE__*/_jsx(Tooltip, {
40
+ title: "Link Settings",
41
+ arrow: true,
42
+ children: /*#__PURE__*/_jsx(IconButton, {
43
+ onClick: () => setOpenNav(true),
44
+ children: /*#__PURE__*/_jsx(LinkIcon, {})
45
+ })
46
+ })]
47
+ }) : null;
48
+ };
49
+ const ImageContent = ({
50
+ readOnly,
51
+ setOpenSettings,
52
+ element,
53
+ handleImageClick,
54
+ onTouchEnd,
55
+ path
56
+ }) => {
57
+ const {
58
+ alt,
59
+ url,
60
+ borderColor,
61
+ borderRadius,
62
+ borderWidth,
63
+ boxShadow,
64
+ frame = null,
65
+ objectFit,
66
+ webAddress
67
+ } = element;
68
+ return !url && !readOnly ? /*#__PURE__*/_jsxs(Box, {
69
+ component: "button",
70
+ className: "element-empty-btn",
71
+ contentEditable: false,
72
+ onClick: () => {
73
+ setOpenSettings(true);
74
+ },
75
+ children: [/*#__PURE__*/_jsx(Icon, {
76
+ icon: "image"
77
+ }), "Add Image"]
78
+ }) : /*#__PURE__*/_jsx(Box, {
79
+ component: "img",
80
+ className: "emb-img",
81
+ sx: {
82
+ borderRadius: {
83
+ ...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
84
+ },
85
+ objectFit: "cover",
86
+ boxShadow: boxShadow || "none",
87
+ height: objectFit ? "100%" : "auto",
88
+ opacity: frame ? 0 : 1,
89
+ cursor: webAddress ? "pointer" : "",
90
+ border: `1px solid ${borderColor}`,
91
+ borderWidth: `${borderWidth}`?.includes("px") ? borderWidth : `${borderWidth}px`
92
+ },
93
+ alt: alt,
94
+ src: url,
95
+ onClick: handleImageClick,
96
+ onTouchEnd: onTouchEnd // for mobile
97
+ ,
98
+ "data-path": path.join(","),
99
+ draggable: false
100
+ });
101
+ };
18
102
  const Image = ({
19
103
  attributes,
20
104
  element,
@@ -23,14 +107,9 @@ const Image = ({
23
107
  }) => {
24
108
  const {
25
109
  url,
26
- alt,
27
110
  bannerSpacing,
28
111
  alignment,
29
112
  bgColor,
30
- borderColor,
31
- borderRadius,
32
- borderWidth,
33
- boxShadow,
34
113
  width: oldWidth,
35
114
  xsHidden,
36
115
  objectFit,
@@ -132,67 +211,6 @@ const Image = ({
132
211
  const onPosChange = data => {
133
212
  onSave(data);
134
213
  };
135
- const ToolBar = () => {
136
- return !isEmpty ? /*#__PURE__*/_jsxs("div", {
137
- className: "element-toolbar visible-on-hover",
138
- contentEditable: false,
139
- style: {
140
- top: "0px",
141
- right: "0px",
142
- left: "auto",
143
- margin: "0px"
144
- },
145
- children: [/*#__PURE__*/_jsx(Tooltip, {
146
- title: "Image Settings",
147
- arrow: true,
148
- children: /*#__PURE__*/_jsx(IconButton, {
149
- onClick: onSettings,
150
- children: /*#__PURE__*/_jsx(GridSettingsIcon, {})
151
- })
152
- }), /*#__PURE__*/_jsx(Tooltip, {
153
- title: "Link Settings",
154
- arrow: true,
155
- children: /*#__PURE__*/_jsx(IconButton, {
156
- onClick: () => setOpenNav(true),
157
- children: /*#__PURE__*/_jsx(LinkIcon, {})
158
- })
159
- })]
160
- }) : null;
161
- };
162
- const ImageContent = () => {
163
- return !url && !readOnly ? /*#__PURE__*/_jsxs(Box, {
164
- component: "button",
165
- className: "element-empty-btn",
166
- contentEditable: false,
167
- onClick: () => {
168
- setOpenSettings(true);
169
- },
170
- children: [/*#__PURE__*/_jsx(Icon, {
171
- icon: "image"
172
- }), "Add Image"]
173
- }) : /*#__PURE__*/_jsx(Box, {
174
- component: "img",
175
- className: "emb-img",
176
- sx: {
177
- borderRadius: {
178
- ...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
179
- },
180
- objectFit: "cover",
181
- boxShadow: boxShadow || "none",
182
- height: objectFit ? "100%" : "auto",
183
- opacity: frame ? 0 : 1,
184
- cursor: webAddress ? "pointer" : "",
185
- border: `1px solid ${borderColor}`,
186
- borderWidth: `${borderWidth}`?.includes('px') ? borderWidth : `${borderWidth}px`
187
- },
188
- alt: alt,
189
- src: url,
190
- onClick: handleImageClick,
191
- onTouchEnd: onTouchEnd,
192
- "data-path": path.join(","),
193
- draggable: false
194
- });
195
- };
196
214
  const getWidth = () => {
197
215
  if (resizing) {
198
216
  return {
@@ -246,7 +264,18 @@ const Image = ({
246
264
  position: "relative",
247
265
  ...getWidth()
248
266
  },
249
- children: [!readOnly && /*#__PURE__*/_jsx(ToolBar, {}), /*#__PURE__*/_jsx(ImageContent, {}), url && frames[frame] ? /*#__PURE__*/_jsx(Box, {
267
+ children: [!readOnly && /*#__PURE__*/_jsx(ToolBar, {
268
+ isEmpty: isEmpty,
269
+ onSettings: onSettings,
270
+ setOpenNav: setOpenNav
271
+ }), /*#__PURE__*/_jsx(ImageContent, {
272
+ readOnly: readOnly,
273
+ setOpenSettings: setOpenSettings,
274
+ element: element,
275
+ handleImageClick: handleImageClick,
276
+ onTouchEnd: onTouchEnd,
277
+ path: path
278
+ }), url && frames[frame] ? /*#__PURE__*/_jsx(Box, {
250
279
  component: "div",
251
280
  className: "image-frame",
252
281
  "data-path": path.join(","),
@@ -256,7 +285,8 @@ const Image = ({
256
285
  href: url,
257
286
  id: path.join(","),
258
287
  onChange: onPosChange,
259
- readOnly: readOnly
288
+ readOnly: readOnly,
289
+ handleImageClick: handleImageClick
260
290
  })
261
291
  }) : null, selected && !readOnly && /*#__PURE__*/_jsx(IconButton, {
262
292
  onPointerDown: onMouseDown,
@@ -1,4 +1,6 @@
1
1
  import React, { useEffect, useRef } from "react";
2
+ import sanitizeHtml from "sanitize-html";
3
+ import { allowedDomains } from "../../utils/helper";
2
4
 
3
5
  // const sanitize = (input) => {
4
6
  // const doc = new DOMParser().parseFromString(input, "text/html");
@@ -25,7 +27,14 @@ const Code = props => {
25
27
  } = element;
26
28
  useEffect(() => {
27
29
  if (codeRef?.current) {
28
- const slotHtml = document.createRange().createContextualFragment(embedData); // Create a 'tiny' document and parse the html string
30
+ const clean = sanitizeHtml(embedData, {
31
+ allowedTags: false,
32
+ // Allow all tags
33
+ allowedAttributes: false,
34
+ // Allow all attributes
35
+ allowedScriptDomains: allowedDomains
36
+ });
37
+ const slotHtml = document.createRange().createContextualFragment(clean); // Create a 'tiny' document and parse the html string
29
38
  codeRef.current.innerHTML = ""; // Clear the container
30
39
  codeRef.current.appendChild(slotHtml);
31
40
  }
@@ -22,6 +22,58 @@ const GridSettingsPoupComp = {
22
22
  section: SectionPopup,
23
23
  grid: GridPopup
24
24
  };
25
+ const GridToolBar = ({
26
+ selected,
27
+ showTool,
28
+ onSettings,
29
+ onAddGridItem,
30
+ onAddSection,
31
+ onMoveSection,
32
+ path
33
+ }) => {
34
+ return selected && !showTool ? /*#__PURE__*/_jsxs("div", {
35
+ className: "grid-container-toolbar",
36
+ contentEditable: false,
37
+ children: [/*#__PURE__*/_jsx(Tooltip, {
38
+ title: "Grid Settings",
39
+ arrow: true,
40
+ children: /*#__PURE__*/_jsx(IconButton, {
41
+ onClick: onSettings,
42
+ children: /*#__PURE__*/_jsx(GridSettingsIcon, {})
43
+ })
44
+ }), /*#__PURE__*/_jsx(Tooltip, {
45
+ title: "Add Grid Item",
46
+ arrow: true,
47
+ children: /*#__PURE__*/_jsx(IconButton, {
48
+ onClick: onAddGridItem,
49
+ children: /*#__PURE__*/_jsx(GridAddGridIcon, {})
50
+ })
51
+ }), /*#__PURE__*/_jsx(Tooltip, {
52
+ title: "Duplicate",
53
+ arrow: true,
54
+ children: /*#__PURE__*/_jsx(IconButton, {
55
+ onClick: onAddSection(),
56
+ children: /*#__PURE__*/_jsx(ContentCopyIcon, {})
57
+ })
58
+ }), path.length === 2 ? /*#__PURE__*/_jsxs(_Fragment, {
59
+ children: [/*#__PURE__*/_jsx(Tooltip, {
60
+ title: "Move Up",
61
+ arrow: true,
62
+ children: /*#__PURE__*/_jsx(IconButton, {
63
+ onClick: onMoveSection("up"),
64
+ children: /*#__PURE__*/_jsx(ArrowUpwardIcon, {})
65
+ })
66
+ }), /*#__PURE__*/_jsx(Tooltip, {
67
+ title: "Move Down",
68
+ arrow: true,
69
+ children: /*#__PURE__*/_jsx(IconButton, {
70
+ onClick: onMoveSection("down"),
71
+ children: /*#__PURE__*/_jsx(ArrowDownwardIcon, {})
72
+ })
73
+ })]
74
+ }) : null]
75
+ }) : null;
76
+ };
25
77
  const Grid = props => {
26
78
  const {
27
79
  attributes,
@@ -211,50 +263,6 @@ const Grid = props => {
211
263
  })]
212
264
  }) : null;
213
265
  };
214
- const GridToolBar = () => {
215
- return selected && !showTool ? /*#__PURE__*/_jsxs("div", {
216
- className: "grid-container-toolbar",
217
- contentEditable: false,
218
- children: [/*#__PURE__*/_jsx(Tooltip, {
219
- title: "Grid Settings",
220
- arrow: true,
221
- children: /*#__PURE__*/_jsx(IconButton, {
222
- onClick: onSettings,
223
- children: /*#__PURE__*/_jsx(GridSettingsIcon, {})
224
- })
225
- }), /*#__PURE__*/_jsx(Tooltip, {
226
- title: "Add Grid Item",
227
- arrow: true,
228
- children: /*#__PURE__*/_jsx(IconButton, {
229
- onClick: onAddGridItem,
230
- children: /*#__PURE__*/_jsx(GridAddGridIcon, {})
231
- })
232
- }), /*#__PURE__*/_jsx(Tooltip, {
233
- title: "Duplicate",
234
- arrow: true,
235
- children: /*#__PURE__*/_jsx(IconButton, {
236
- onClick: onAddSection(),
237
- children: /*#__PURE__*/_jsx(ContentCopyIcon, {})
238
- })
239
- }), path.length === 2 ? /*#__PURE__*/_jsxs(_Fragment, {
240
- children: [/*#__PURE__*/_jsx(Tooltip, {
241
- title: "Move Up",
242
- arrow: true,
243
- children: /*#__PURE__*/_jsx(IconButton, {
244
- onClick: onMoveSection("up"),
245
- children: /*#__PURE__*/_jsx(ArrowUpwardIcon, {})
246
- })
247
- }), /*#__PURE__*/_jsx(Tooltip, {
248
- title: "Move Down",
249
- arrow: true,
250
- children: /*#__PURE__*/_jsx(IconButton, {
251
- onClick: onMoveSection("down"),
252
- children: /*#__PURE__*/_jsx(ArrowDownwardIcon, {})
253
- })
254
- })]
255
- }) : null]
256
- }) : null;
257
- };
258
266
  const sectionId = id ? {
259
267
  id
260
268
  } : {};
@@ -312,7 +320,15 @@ const Grid = props => {
312
320
  }), /*#__PURE__*/_jsx("div", {
313
321
  className: "element-selector-dots br",
314
322
  children: " "
315
- }), /*#__PURE__*/_jsx(GridToolBar, {})]
323
+ }), /*#__PURE__*/_jsx(GridToolBar, {
324
+ selected: selected,
325
+ showTool: showTool,
326
+ onSettings: onSettings,
327
+ onAddGridItem: onAddGridItem,
328
+ onAddSection: onAddSection,
329
+ onMoveSection: onMoveSection,
330
+ path: path
331
+ })]
316
332
  }), openSetttings ? /*#__PURE__*/_jsx(PoupComp, {
317
333
  element: element,
318
334
  onSave: onSave,
@@ -10,6 +10,29 @@ import { getBreakPointsValue, getTRBLBreakPoints } from "../../helper/theme";
10
10
  import { isEmptyNode } from "../../utils/helper";
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ const GridItemToolbar = ({
14
+ selected,
15
+ showTool,
16
+ onSettings
17
+ }) => {
18
+ return selected && !showTool ? /*#__PURE__*/_jsx("div", {
19
+ contentEditable: false,
20
+ className: "grid-item-toolbar",
21
+ style: {
22
+ top: "-14px",
23
+ left: "-14px"
24
+ },
25
+ children: /*#__PURE__*/_jsx(Tooltip, {
26
+ title: "Grid Item Settings",
27
+ arrow: true,
28
+ children: /*#__PURE__*/_jsx(IconButton, {
29
+ size: "small",
30
+ onClick: onSettings,
31
+ children: /*#__PURE__*/_jsx(GridSettingsIcon, {})
32
+ })
33
+ })
34
+ }) : null;
35
+ };
13
36
  const GridItem = props => {
14
37
  const {
15
38
  attributes,
@@ -51,25 +74,6 @@ const GridItem = props => {
51
74
  const selected = hoverPath === path.join(",");
52
75
  const [showTool] = useEditorSelection(editor);
53
76
  const isEmpty = !readOnly && isEmptyNode(editor, element?.children, path) ? "empty" : "";
54
- const GridItemToolbar = () => {
55
- return selected && !showTool ? /*#__PURE__*/_jsx("div", {
56
- contentEditable: false,
57
- className: "grid-item-toolbar",
58
- style: {
59
- top: "-14px",
60
- left: "-14px"
61
- },
62
- children: /*#__PURE__*/_jsx(Tooltip, {
63
- title: "Grid Item Settings",
64
- arrow: true,
65
- children: /*#__PURE__*/_jsx(IconButton, {
66
- size: "small",
67
- onClick: onSettings,
68
- children: /*#__PURE__*/_jsx(GridSettingsIcon, {})
69
- })
70
- })
71
- }) : null;
72
- };
73
77
  const onSettings = () => {
74
78
  setOpenSettings(true);
75
79
  };
@@ -153,7 +157,11 @@ const GridItem = props => {
153
157
  }), /*#__PURE__*/_jsx("div", {
154
158
  className: "element-selector-dots br",
155
159
  children: " "
156
- }), /*#__PURE__*/_jsx(GridItemToolbar, {})]
160
+ }), /*#__PURE__*/_jsx(GridItemToolbar, {
161
+ selected: selected,
162
+ showTool: showTool,
163
+ onSettings: onSettings
164
+ })]
157
165
  }), /*#__PURE__*/_jsx(Box, {
158
166
  className: `gi-inner-cw ${animation || ""} content-editable ${isEmpty} np`,
159
167
  component: "div",
@@ -165,15 +165,13 @@ export const toolbarGroups = [[{
165
165
  format: "video",
166
166
  type: "embed",
167
167
  group: "elements"
168
- },
169
- // {
170
- // id: 49,
171
- // lbT: "embedScript",
172
- // format: "embedScript",
173
- // type: "embedScript",
174
- // group: "elements",
175
- // },
176
- {
168
+ }, {
169
+ id: 49,
170
+ lbT: "embedScript",
171
+ format: "embedScript",
172
+ type: "embedScript",
173
+ group: "elements"
174
+ }, {
177
175
  id: 45,
178
176
  format: "topbanner",
179
177
  type: "topbanner",
@@ -103,7 +103,7 @@ export const SelectPage = props => {
103
103
  };
104
104
  export const Trigger = props => {
105
105
  return /*#__PURE__*/_jsx(Typography, {
106
- variant: "h6",
106
+ variant: "subtitle1",
107
107
  gutterBottom: true,
108
108
  children: "Choosing this will trigger the next step"
109
109
  });
@@ -1,17 +1,20 @@
1
- import Button from '@mui/material/Button';
2
- import Dialog from '@mui/material/Dialog';
3
- import DialogTitle from '@mui/material/DialogTitle';
4
- import DialogContent from '@mui/material/DialogContent';
5
- import DialogActions from '@mui/material/DialogActions';
6
- import IconButton from '@mui/material/IconButton';
7
- import CloseIcon from '@mui/icons-material/Close';
8
- import { FormControl, FormControlLabel, Grid, Radio, RadioGroup } from '@mui/material';
9
- import { useState } from 'react';
10
- import LinkSettingsStyles from './style';
11
- import { getNavOptions } from './navOptions';
12
- import { ScrollTopBottom, SelectPage, TextInput, Trigger } from './NavComponents';
1
+ import Button from "@mui/material/Button";
2
+ import Dialog from "@mui/material/Dialog";
3
+ import DialogTitle from "@mui/material/DialogTitle";
4
+ import DialogContent from "@mui/material/DialogContent";
5
+ import DialogActions from "@mui/material/DialogActions";
6
+ import IconButton from "@mui/material/IconButton";
7
+ import CloseIcon from "@mui/icons-material/Close";
8
+ import { Box, FormControl, FormControlLabel, Grid, MenuItem, Radio, RadioGroup, Select, Typography } from "@mui/material";
9
+ import { useState } from "react";
10
+ import LinkSettingsStyles from "./style";
11
+ import { getNavOptions } from "./navOptions";
12
+ import { ScrollTopBottom, SelectPage, TextInput, Trigger } from "./NavComponents";
13
+ import SwipeableDrawer from "../SwipeableDrawer";
14
+ import { useEditorContext } from "../../hooks/useMouseMove";
13
15
  import { jsx as _jsx } from "react/jsx-runtime";
14
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
17
+ import { Fragment as _Fragment } from "react/jsx-runtime";
15
18
  const MAP_COMPONENT = {
16
19
  webAddress: TextInput,
17
20
  email: TextInput,
@@ -20,6 +23,12 @@ const MAP_COMPONENT = {
20
23
  scrollTopOrBottom: ScrollTopBottom,
21
24
  page: SelectPage
22
25
  };
26
+ function getNav(navType, navOptions) {
27
+ return navType ? navOptions.find(n => n.value === navType) : {
28
+ label: "None",
29
+ value: ""
30
+ };
31
+ }
23
32
  export default function LinkSettings(props) {
24
33
  const {
25
34
  handleClose,
@@ -27,86 +36,157 @@ export default function LinkSettings(props) {
27
36
  customProps,
28
37
  navType
29
38
  } = props;
39
+ const {
40
+ isMobile
41
+ } = customProps;
30
42
  const navOptions = getNavOptions(customProps.hideTools);
31
43
  const classes = LinkSettingsStyles();
32
- const [nav, setNav] = useState(navType ? navOptions.find(n => n.value === navType) : {
33
- label: "None",
34
- value: ""
35
- });
44
+ const [nav, setNav] = useState(getNav(navType, navOptions));
36
45
  const [navValue, setNavValue] = useState(props?.navValue || "");
37
46
  const [openInNewTab, setOpenInNewTab] = useState(props.openInNewTab || false);
38
47
  const NavSettings = MAP_COMPONENT[nav?.value];
39
48
  const onChange = value => {
40
49
  setNavValue(value);
41
50
  };
42
- return /*#__PURE__*/_jsxs(Dialog, {
43
- onClose: handleClose,
44
- open: true,
45
- sx: classes.dialogContainer,
46
- fullWidth: true,
47
- maxWidth: "sm",
48
- children: [/*#__PURE__*/_jsx(DialogTitle, {
49
- children: "What do you want to link to?"
50
- }), /*#__PURE__*/_jsx(IconButton, {
51
- "aria-label": "close",
52
- onClick: handleClose,
53
- sx: classes.closeIcon,
54
- children: /*#__PURE__*/_jsx(CloseIcon, {})
55
- }), /*#__PURE__*/_jsx(DialogContent, {
56
- dividers: true,
57
- children: /*#__PURE__*/_jsxs(Grid, {
58
- container: true,
59
- spacing: 2,
60
- children: [/*#__PURE__*/_jsx(Grid, {
61
- item: true,
62
- xs: 6,
63
- sx: classes.gridDivider,
64
- children: /*#__PURE__*/_jsx(FormControl, {
65
- children: /*#__PURE__*/_jsx(RadioGroup, {
66
- value: nav?.value,
67
- children: navOptions?.map((navOption, i) => {
68
- return /*#__PURE__*/_jsx(FormControlLabel, {
69
- value: navOption.value,
70
- control: /*#__PURE__*/_jsx(Radio, {}),
71
- label: navOption.label,
72
- onChange: () => {
73
- setNav(navOption);
74
- setNavValue("");
75
- }
76
- }, i);
77
- })
51
+ const onSubmit = () => {
52
+ onSave({
53
+ linkType: nav?.value,
54
+ navValue,
55
+ openInNewTab
56
+ });
57
+ };
58
+ if (isMobile) {
59
+ return /*#__PURE__*/_jsxs(SwipeableDrawer, {
60
+ onClose: handleClose,
61
+ children: [/*#__PURE__*/_jsx(Typography, {
62
+ variant: "subtitle1",
63
+ gutterBottom: true,
64
+ sx: {
65
+ fontWeight: 600
66
+ },
67
+ children: "What do you want to link to?"
68
+ }), /*#__PURE__*/_jsx(Select, {
69
+ size: "small",
70
+ fullWidth: true,
71
+ value: nav?.value,
72
+ onChange: e => {
73
+ const {
74
+ value
75
+ } = e.target;
76
+ const selected = getNav(value, navOptions);
77
+ setNav(selected);
78
+ setNavValue("");
79
+ },
80
+ displayEmpty: true,
81
+ children: navOptions.map((navOption, i) => {
82
+ return /*#__PURE__*/_jsx(MenuItem, {
83
+ value: navOption.value,
84
+ children: /*#__PURE__*/_jsx(Typography, {
85
+ variant: "body2",
86
+ children: navOption.label
78
87
  })
79
- })
80
- }), /*#__PURE__*/_jsx(Grid, {
81
- item: true,
82
- xs: 6,
83
- children: NavSettings && /*#__PURE__*/_jsx(NavSettings, {
84
- placeholder: nav?.placeholder,
85
- nav: nav,
86
- onChange: onChange,
87
- value: navValue,
88
- openInNewTab: openInNewTab,
89
- onNewTabChange: () => setOpenInNewTab(prev => !prev),
90
- services: customProps.services
91
- })
92
- })]
93
- })
94
- }), /*#__PURE__*/_jsxs(DialogActions, {
95
- children: [/*#__PURE__*/_jsx(Button, {
96
- onClick: handleClose,
97
- sx: classes.closeBtn,
98
- children: "Cancel"
99
- }), /*#__PURE__*/_jsx(Button, {
100
- onClick: () => {
101
- onSave({
102
- linkType: nav?.value,
103
- navValue,
104
- openInNewTab
105
- });
88
+ }, i);
89
+ })
90
+ }), /*#__PURE__*/_jsx(Box, {
91
+ sx: {
92
+ paddingTop: "14px"
106
93
  },
107
- sx: classes.saveBtn,
108
- children: "Save"
94
+ children: NavSettings && /*#__PURE__*/_jsx(NavSettings, {
95
+ placeholder: nav?.placeholder,
96
+ nav: nav,
97
+ onChange: onChange,
98
+ value: navValue,
99
+ openInNewTab: openInNewTab,
100
+ onNewTabChange: () => setOpenInNewTab(prev => !prev),
101
+ services: customProps.services
102
+ })
103
+ }), /*#__PURE__*/_jsx(Box, {
104
+ component: "div",
105
+ sx: classes.mobileActionBtns,
106
+ children: /*#__PURE__*/_jsx(ActionsButtons, {
107
+ classes: classes,
108
+ onCancel: handleClose,
109
+ onSave: onSubmit
110
+ })
111
+ })]
112
+ });
113
+ } else {
114
+ return /*#__PURE__*/_jsxs(Dialog, {
115
+ onClose: handleClose,
116
+ open: true,
117
+ sx: classes.dialogContainer,
118
+ fullWidth: true,
119
+ maxWidth: "sm",
120
+ children: [/*#__PURE__*/_jsx(DialogTitle, {
121
+ children: "What do you want to link to?"
122
+ }), /*#__PURE__*/_jsx(IconButton, {
123
+ "aria-label": "close",
124
+ onClick: handleClose,
125
+ sx: classes.closeIcon,
126
+ children: /*#__PURE__*/_jsx(CloseIcon, {})
127
+ }), /*#__PURE__*/_jsx(DialogContent, {
128
+ dividers: true,
129
+ children: /*#__PURE__*/_jsxs(Grid, {
130
+ container: true,
131
+ spacing: 2,
132
+ children: [/*#__PURE__*/_jsx(Grid, {
133
+ item: true,
134
+ xs: 6,
135
+ sx: classes.gridDivider,
136
+ children: /*#__PURE__*/_jsx(FormControl, {
137
+ children: /*#__PURE__*/_jsx(RadioGroup, {
138
+ value: nav?.value,
139
+ children: navOptions?.map((navOption, i) => {
140
+ return /*#__PURE__*/_jsx(FormControlLabel, {
141
+ value: navOption.value,
142
+ control: /*#__PURE__*/_jsx(Radio, {}),
143
+ label: navOption.label,
144
+ onChange: () => {
145
+ setNav(navOption);
146
+ setNavValue("");
147
+ }
148
+ }, i);
149
+ })
150
+ })
151
+ })
152
+ }), /*#__PURE__*/_jsx(Grid, {
153
+ item: true,
154
+ xs: 6,
155
+ children: NavSettings && /*#__PURE__*/_jsx(NavSettings, {
156
+ placeholder: nav?.placeholder,
157
+ nav: nav,
158
+ onChange: onChange,
159
+ value: navValue,
160
+ openInNewTab: openInNewTab,
161
+ onNewTabChange: () => setOpenInNewTab(prev => !prev),
162
+ services: customProps.services
163
+ })
164
+ })]
165
+ })
166
+ }), /*#__PURE__*/_jsx(DialogActions, {
167
+ children: /*#__PURE__*/_jsx(ActionsButtons, {
168
+ classes: classes,
169
+ onCancel: handleClose,
170
+ onSave: onSubmit
171
+ })
109
172
  })]
173
+ });
174
+ }
175
+ }
176
+ function ActionsButtons({
177
+ classes,
178
+ onCancel,
179
+ onSave
180
+ }) {
181
+ return /*#__PURE__*/_jsxs(_Fragment, {
182
+ children: [/*#__PURE__*/_jsx(Button, {
183
+ onClick: onCancel,
184
+ sx: classes.closeBtn,
185
+ children: "Cancel"
186
+ }), /*#__PURE__*/_jsx(Button, {
187
+ onClick: onSave,
188
+ sx: classes.saveBtn,
189
+ children: "Save"
110
190
  })]
111
191
  });
112
192
  }
@@ -50,6 +50,14 @@ const ButtonNavSettingsStyles = () => ({
50
50
  },
51
51
  gridDivider: {
52
52
  borderRight: "1px solid rgba(0, 0, 0, 0.12)"
53
+ },
54
+ mobileActionBtns: {
55
+ display: "flex",
56
+ justifyContent: "flex-end",
57
+ gap: "8px",
58
+ paddingTop: "14px",
59
+ marginTop: "14px",
60
+ borderTop: theme => `1px solid ${theme.palette.grey[300]}`
53
61
  }
54
62
  });
55
63
  export default ButtonNavSettingsStyles;
@@ -0,0 +1,34 @@
1
+ import { Box, SwipeableDrawer, Typography } from "@mui/material";
2
+ import DrawerStyles from "./style";
3
+ import { grey } from "@mui/material/colors";
4
+ import { styled } from "@mui/material/styles";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ const Puller = styled("div")(({
8
+ theme
9
+ }) => ({
10
+ width: 30,
11
+ height: 6,
12
+ backgroundColor: theme?.palette?.mode === "light" ? grey[300] : grey[900],
13
+ borderRadius: 3,
14
+ margin: "auto",
15
+ marginTop: "14px"
16
+ }));
17
+ function SwipeableDrawerComponent({
18
+ open,
19
+ onClose,
20
+ children
21
+ }) {
22
+ const classes = DrawerStyles();
23
+ return /*#__PURE__*/_jsxs(SwipeableDrawer, {
24
+ anchor: "bottom",
25
+ open: true,
26
+ onClose: onClose,
27
+ sx: classes.drawerContainer,
28
+ children: [/*#__PURE__*/_jsx(Puller, {}), /*#__PURE__*/_jsx(Box, {
29
+ sx: classes.childContainer,
30
+ children: children
31
+ })]
32
+ });
33
+ }
34
+ export default SwipeableDrawerComponent;
@@ -0,0 +1,12 @@
1
+ const Styles = () => ({
2
+ drawerContainer: {
3
+ "& .MuiDrawer-paper": {
4
+ borderTopLeftRadius: 8,
5
+ borderTopRightRadius: 8
6
+ }
7
+ },
8
+ childContainer: {
9
+ padding: "20px"
10
+ }
11
+ });
12
+ export default Styles;
@@ -83,6 +83,17 @@ const withHtml = editor => {
83
83
  }
84
84
  } else if (html) {
85
85
  const parsed = new DOMParser().parseFromString(html, "text/html");
86
+ const isGoogleSheet = parsed.body.querySelector("google-sheets-html-origin");
87
+ if (isGoogleSheet) {
88
+ const table = parsed.body.querySelector("table");
89
+ const colGrp = table.querySelector("colgroup");
90
+ if (colGrp) {
91
+ colGrp.remove();
92
+ }
93
+ const fragment = deserialize(table);
94
+ Transforms.insertFragment(editor, [fragment]);
95
+ return;
96
+ }
86
97
  const fragment = deserialize(parsed.body);
87
98
  const formattedFragment = formatFragment[eltype] ? formatFragment[eltype](fragment) : fragment;
88
99
  Transforms.insertFragment(editor, formattedFragment);
@@ -296,4 +296,5 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
296
296
  };
297
297
  }
298
298
  return props;
299
- };
299
+ };
300
+ export const allowedDomains = ["youtube.com", "lemcal.com", "facebook.com", "calendly.com"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "3.2.7",
3
+ "version": "3.2.9",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"
@@ -39,6 +39,7 @@
39
39
  "react-scripts": "5.0.1",
40
40
  "react-signature-canvas": "^1.0.6",
41
41
  "react-slick": "^0.29.0",
42
+ "sanitize-html": "^2.13.0",
42
43
  "slate": "^0.94.1",
43
44
  "slate-history": "^0.93.0",
44
45
  "slate-hyperscript": "^0.100.0",
@@ -63,7 +64,7 @@
63
64
  "storybook": "storybook dev -p 6006",
64
65
  "build-storybook": "storybook build",
65
66
  "publish:npm": "rm -rf dist && mkdir dist && babel src/components -d dist --copy-files",
66
- "publish:local": "rm -rf /Users/agmac23/Desktop/surya/sweetpsocial-2.0/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agmac23/Desktop/surya/sweetpsocial-2.0/client/node_modules/@flozy/editor/dist --copy-files"
67
+ "publish:local": "rm -rf /Users/agmac03/flozy/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agmac03/flozy/client/node_modules/@flozy/editor/dist --copy-files"
67
68
  },
68
69
  "eslintConfig": {
69
70
  "extends": [