@flozy/editor 1.6.9 → 1.7.1

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.
@@ -26,6 +26,7 @@ import { EditorProvider } from "./hooks/useMouseMove";
26
26
  import TopBanner from "./Elements/TopBanner/TopBanner";
27
27
  import editorStyles from "./Styles/EditorStyles";
28
28
  import "animate.css";
29
+ import Section from "./Elements/Section";
29
30
  import { jsx as _jsx } from "react/jsx-runtime";
30
31
  import { jsxs as _jsxs } from "react/jsx-runtime";
31
32
  const PREVIEW_IMAGE_HIDE_CLASS = ["grid-container-toolbar", "grid-item-toolbar", "element-toolbar"];
@@ -122,8 +122,6 @@ blockquote {
122
122
  .grid-container-toolbar {
123
123
  right: -32px;
124
124
  top: 0;
125
- bottom: 0;
126
- margin: auto;
127
125
  height: fit-content;
128
126
  }
129
127
 
@@ -157,6 +157,7 @@ const Image = ({
157
157
  onDelete: onDelete
158
158
  }) : null, /*#__PURE__*/_jsxs("div", {
159
159
  contentEditable: false,
160
+ className: "embed-image-wrpr",
160
161
  style: {
161
162
  position: "relative",
162
163
  width: `${width}`,
@@ -8,6 +8,7 @@ import { IconButton, Tooltip } from "@mui/material";
8
8
  import DeleteIcon from "@mui/icons-material/Delete";
9
9
  import EmbedPopup from "./EmbedPopup";
10
10
  import { GridSettingsIcon } from "../../common/iconslist";
11
+ import { gradientBorder } from "../../utils/helper";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
14
  const Video = ({
@@ -20,7 +21,11 @@ const Video = ({
20
21
  url,
21
22
  alt,
22
23
  alignment,
23
- bannerSpacing
24
+ bannerSpacing,
25
+ borderRadius,
26
+ borderWidth,
27
+ borderColor,
28
+ borderStyle
24
29
  } = element;
25
30
  const editor = useSlateStatic();
26
31
  const selected = useSelected();
@@ -52,6 +57,12 @@ const Video = ({
52
57
  });
53
58
  const arr = Array.from(Node.elements(editor));
54
59
  const ele = arr.find(([elem]) => element === elem);
60
+ const {
61
+ topLeft,
62
+ topRight,
63
+ bottomLeft,
64
+ bottomRight
65
+ } = borderRadius || {};
55
66
  useEffect(() => {
56
67
  if (editor && ele[1] !== undefined) {
57
68
  const dom = ReactEditor.toDOMNode(editor, Node.get(editor, ele[1]));
@@ -107,7 +118,7 @@ const Video = ({
107
118
  const width = resizing ? `${size.width}px` : `${size.widthInPercent || 100}%`;
108
119
  return /*#__PURE__*/_jsxs("div", {
109
120
  ...attributes,
110
- className: "embed has-hover",
121
+ className: "embed has-hover video",
111
122
  style: {
112
123
  display: "flex",
113
124
  width: `calc(100% - ${totalMinus}px)`,
@@ -152,7 +163,11 @@ const Video = ({
152
163
  position: "absolute",
153
164
  width: "100%",
154
165
  height: "100%",
155
- left: "0px"
166
+ left: "0px",
167
+ ...(gradientBorder(borderColor) || {}),
168
+ borderWidth: borderWidth || "1px",
169
+ borderRadius: `${topLeft}px ${topRight}px ${bottomLeft}px ${bottomRight}px`,
170
+ borderStyle: borderStyle || "solid"
156
171
  },
157
172
  src: url,
158
173
  title: alt
@@ -155,6 +155,11 @@ const FormWorkflow = props => {
155
155
  "& textarea": {
156
156
  fontSize: '16px',
157
157
  fontWeight: 500
158
+ },
159
+ "& textarea:focus-visible": {
160
+ outline: "none",
161
+ borderRadius: "none",
162
+ border: "none"
158
163
  }
159
164
  }
160
165
  })]
@@ -3,8 +3,8 @@ import { IconButton, Menu, MenuItem, Tooltip } from "@mui/material";
3
3
  import { MoreHorizontal } from "../../../common/iconslist";
4
4
  import Icon from "../../../common/Icon";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
- import { jsxs as _jsxs } from "react/jsx-runtime";
7
6
  import { Fragment as _Fragment } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
8
  function MoreOptions(props) {
9
9
  const {
10
10
  classes,
@@ -27,15 +27,12 @@ function MoreOptions(props) {
27
27
  children: [/*#__PURE__*/_jsx(Tooltip, {
28
28
  arrow: true,
29
29
  title: "More Options",
30
- children: /*#__PURE__*/_jsxs(IconButton, {
30
+ children: /*#__PURE__*/_jsx(IconButton, {
31
31
  sx: classes.moreOption,
32
32
  onClick: handleClick,
33
- children: [/*#__PURE__*/_jsx(Icon, {
33
+ children: /*#__PURE__*/_jsx(Icon, {
34
34
  icon: "moreHorizantal"
35
- }), /*#__PURE__*/_jsx(MoreHorizontal, {
36
- width: "24px",
37
- height: "24px"
38
- })]
35
+ })
39
36
  })
40
37
  }), /*#__PURE__*/_jsx(Menu, {
41
38
  id: "basic-menu",
@@ -1,147 +1,154 @@
1
1
  const FormStyles = () => ({
2
2
  addButton: {
3
- display: 'flex',
4
- justifyContent: 'flex-end'
3
+ display: "flex",
4
+ justifyContent: "flex-end"
5
5
  },
6
6
  infoText: {
7
- fontSize: '12px',
8
- fontWeight: '400',
9
- color: '#94A3B8'
7
+ fontSize: "12px",
8
+ fontWeight: "400",
9
+ color: "#94A3B8"
10
10
  },
11
11
  bodyTextArea: {
12
- '& textarea': {
13
- border: 'none',
14
- width: '96%',
15
- maxWidth: '96%',
16
- outline: 'none'
12
+ "& textarea": {
13
+ border: "none",
14
+ width: "100%",
15
+ maxWidth: "100%",
16
+ outline: "none"
17
17
  },
18
- '& textarea: focus-visible': {
19
- outline: 'none',
20
- border: 'none'
18
+ "& textarea:focus-visible": {
19
+ outline: "none",
20
+ border: "none"
21
21
  }
22
22
  },
23
23
  formHeadings: {
24
- fontSize: '14px',
24
+ fontSize: "14px",
25
25
  fontWeight: 500,
26
- paddingBottom: '10px',
27
- paddingTop: '10px'
26
+ paddingBottom: "10px",
27
+ paddingTop: "10px"
28
28
  },
29
29
  flowListCard: {
30
- border: '1px solid #6F6F6F33',
31
- borderRadius: '8px',
32
- padding: '10px'
30
+ border: "1px solid #6F6F6F33",
31
+ borderRadius: "8px",
32
+ padding: "10px"
33
33
  },
34
34
  listHeading: {
35
- fontSize: '14px',
35
+ fontSize: "14px",
36
36
  fontWeight: 700
37
37
  },
38
38
  listSubHeading: {
39
- fontSize: '12px',
39
+ fontSize: "12px",
40
40
  fontWeight: 500,
41
- color: '#64748B',
42
- maxWidth: '380px',
43
- textTransform: 'capitalize',
41
+ color: "#64748B",
42
+ maxWidth: "380px",
43
+ textTransform: "capitalize",
44
44
  whiteSpace: "nowrap",
45
- overflow: 'hidden',
46
- textOverflow: 'ellipsis'
45
+ overflow: "hidden",
46
+ textOverflow: "ellipsis"
47
47
  },
48
48
  addBtnTypo: {
49
- color: '#94A3B8',
49
+ color: "#94A3B8",
50
50
  fontWeight: 500,
51
- fontSize: '12px'
51
+ fontSize: "12px"
52
52
  },
53
53
  emptyList: {
54
- justifyContent: 'center',
55
- display: 'flex',
56
- border: '1px solid #6F6F6F33',
57
- borderRadius: '8px',
58
- padding: '10px',
59
- color: '#94A3B8'
54
+ justifyContent: "center",
55
+ display: "flex",
56
+ border: "1px solid #6F6F6F33",
57
+ borderRadius: "8px",
58
+ padding: "10px",
59
+ color: "#94A3B8"
60
60
  },
61
61
  popupTitle: {
62
62
  fontWeight: 600,
63
- fontSize: '16px',
64
- display: 'flex',
65
- alignItems: 'center'
63
+ fontSize: "16px",
64
+ display: "flex",
65
+ alignItems: "center"
66
66
  },
67
67
  subHeadings: {
68
68
  fontWeight: 500,
69
- fontSize: '14px'
69
+ fontSize: "14px"
70
70
  },
71
71
  radioBtn: {
72
- '& .MuiFormControlLabel-label': {
73
- fontSize: '14px',
74
- color: '#64748B'
72
+ "& .MuiFormControlLabel-label": {
73
+ fontSize: "14px",
74
+ color: "#64748B"
75
75
  }
76
76
  },
77
77
  dialogTitle: {
78
- '& MuiDialogTitle-root': {
79
- padding: '16px 12px'
78
+ "& MuiDialogTitle-root": {
79
+ padding: "16px 12px"
80
80
  }
81
81
  },
82
82
  closeBtn: {
83
- background: '#F4F6F9',
84
- color: '#64748B',
85
- fontSize: '14px',
83
+ background: "#F4F6F9",
84
+ color: "#64748B",
85
+ fontSize: "14px",
86
86
  fontWeight: 500,
87
- padding: '4px 22px',
88
- textTransform: 'none',
89
- border: '1px solid #D8DDE1',
90
- '&:hover': {
91
- border: '1px solid #64748B'
87
+ padding: "4px 22px",
88
+ textTransform: "none",
89
+ border: "1px solid #D8DDE1",
90
+ "&:hover": {
91
+ border: "1px solid #64748B"
92
92
  }
93
93
  },
94
94
  variableBtn: {
95
- background: '#F4F6F9',
96
- color: '#64748B',
97
- fontSize: '14px',
95
+ background: "#F4F6F9",
96
+ color: "#64748B",
97
+ fontSize: "14px",
98
98
  fontWeight: 500,
99
- padding: '4px 22px',
100
- textTransform: 'none',
101
- border: '1px solid #D8DDE1',
102
- '& svg': {
103
- '& path': {
104
- stroke: '#64748B'
99
+ padding: "4px 22px",
100
+ textTransform: "none",
101
+ border: "1px solid #D8DDE1",
102
+ "& svg": {
103
+ "& path": {
104
+ stroke: "#64748B"
105
105
  }
106
106
  },
107
- '&:hover': {
108
- border: '1px solid #64748B'
107
+ "&:hover": {
108
+ border: "1px solid #64748B"
109
109
  }
110
110
  },
111
111
  saveBtn: {
112
- background: '#2563EB',
113
- fontSize: '14px',
112
+ background: "#2563EB",
113
+ fontSize: "14px",
114
114
  fontWeight: 500,
115
- padding: '4px 24px',
116
- textTransform: 'none'
115
+ padding: "4px 24px",
116
+ textTransform: "none",
117
+ "& .MuiButton-containedSizeSmall": {
118
+ borderRadius: "5px"
119
+ },
120
+ "& .MuiButton-containedPrimary": {
121
+ background: "#2563EB",
122
+ borderRadius: "5px"
123
+ }
117
124
  },
118
125
  select: {
119
- minWidth: '110px',
120
- '& .MuiOutlinedInput-notchedOutline': {
121
- borderRadius: '8px',
122
- border: '1px solid #6F6F6F33',
123
- boxShadow: '0px 4px 16px 0px #0000000D'
126
+ minWidth: "110px",
127
+ "& .MuiOutlinedInput-notchedOutline": {
128
+ borderRadius: "8px",
129
+ border: "1px solid #6F6F6F33",
130
+ boxShadow: "0px 4px 16px 0px #0000000D"
124
131
  },
125
- '&:hover .MuiOutlinedInput-notchedOutline': {
126
- borderRadius: '8px',
127
- border: '1px solid #6F6F6F33',
128
- boxShadow: '0px 4px 16px 0px #0000000D'
132
+ "&:hover .MuiOutlinedInput-notchedOutline": {
133
+ borderRadius: "8px",
134
+ border: "1px solid #6F6F6F33",
135
+ boxShadow: "0px 4px 16px 0px #0000000D"
129
136
  },
130
- '& .MuiSelect-select': {
131
- color: '#94A3B8',
132
- fontSize: '14px'
137
+ "& .MuiSelect-select": {
138
+ color: "#94A3B8",
139
+ fontSize: "14px"
133
140
  }
134
141
  },
135
142
  selectList: {
136
- color: '#94A3B8',
137
- fontSize: '14px'
143
+ color: "#94A3B8",
144
+ fontSize: "14px"
138
145
  },
139
146
  toolbarContainer: {
140
- border: '1px solid #6F6F6F33',
141
- borderRadius: '10px'
147
+ border: "1px solid #6F6F6F33",
148
+ borderRadius: "10px"
142
149
  },
143
150
  toolBar: {
144
- padding: '5px'
151
+ padding: "5px"
145
152
  },
146
153
  colorButtons: {
147
154
  "& .buttonsWrpr": {
@@ -191,17 +198,17 @@ const FormStyles = () => ({
191
198
  }
192
199
  },
193
200
  moreOption: {
194
- background: '#F4F4F4',
195
- borderRadius: '8px'
201
+ background: "#F4F4F4",
202
+ borderRadius: "8px"
196
203
  },
197
204
  dialogFooter: {
198
- '&.MuiDialogActions-root': {
199
- padding: '8px 24px'
205
+ "&.MuiDialogActions-root": {
206
+ padding: "8px 24px"
200
207
  }
201
208
  },
202
209
  toolButtons: {
203
- width: '36px',
204
- height: '36px'
210
+ width: "36px",
211
+ height: "36px"
205
212
  }
206
213
  });
207
214
  export default FormStyles;
@@ -3,7 +3,7 @@ import React, { useState } from "react";
3
3
  import FormStyles from "./Styles";
4
4
  import Icon from "../../../common/Icon";
5
5
  import { PlusIcon, RestRight } from "../../../common/iconslist";
6
- import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
6
+ import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
7
7
  import { AllColors } from "../../Color Picker/ColorButtons";
8
8
  import PopupToolStyle from "../../../Toolbar/PopupTool/PopupToolStyle";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -20,7 +20,7 @@ const UserInputs = props => {
20
20
  const variables = element?.children;
21
21
  const classes = FormStyles();
22
22
  const popupClasses = PopupToolStyle();
23
- const [activeColor, setActiveColor] = useState(['#000000']);
23
+ const [activeColor, setActiveColor] = useState(["#000000"]);
24
24
  //state
25
25
  const [anchorEl, setAnchorEl] = useState(null);
26
26
  const [colorAnchorEl, setColorAnchorEl] = useState(null);
@@ -115,7 +115,7 @@ const UserInputs = props => {
115
115
  title: "Current Color",
116
116
  children: /*#__PURE__*/_jsx(IconButton, {
117
117
  style: {
118
- borderRadius: '50px',
118
+ borderRadius: "50px",
119
119
  background: activeColor
120
120
  }
121
121
  })
@@ -140,6 +140,7 @@ const UserInputs = props => {
140
140
  item: true,
141
141
  children: /*#__PURE__*/_jsxs(Grid, {
142
142
  container: true,
143
+ alignItems: "center",
143
144
  children: [/*#__PURE__*/_jsx(Grid, {
144
145
  item: true,
145
146
  children: /*#__PURE__*/_jsx(Tooltip, {
@@ -166,12 +167,12 @@ const UserInputs = props => {
166
167
  anchorEl: anchorEl,
167
168
  onClose: handleClose,
168
169
  anchorOrigin: {
169
- vertical: 'bottom',
170
- horizontal: 'right'
170
+ vertical: "bottom",
171
+ horizontal: "right"
171
172
  },
172
173
  transformOrigin: {
173
- vertical: 'top',
174
- horizontal: 'right'
174
+ vertical: "top",
175
+ horizontal: "right"
175
176
  },
176
177
  children: variables?.map((m, i) => /*#__PURE__*/_jsx(MenuItem, {
177
178
  sx: {
@@ -188,18 +189,12 @@ const UserInputs = props => {
188
189
  }), /*#__PURE__*/_jsx(Grid, {
189
190
  item: true,
190
191
  xs: 12,
192
+ sx: classes.bodyTextArea,
191
193
  children: type === 2 && /*#__PURE__*/_jsx(TextareaAutosize, {
192
194
  margin: "none",
193
195
  minRows: 6,
194
196
  value: subject,
195
- onChange: handleField,
196
- className: classes.bodyTextArea,
197
- style: {
198
- border: 'none',
199
- width: "96%",
200
- padding: '10px',
201
- outline: "none"
202
- }
197
+ onChange: handleField
203
198
  })
204
199
  })]
205
200
  });
@@ -127,7 +127,8 @@ const Workflow = props => {
127
127
  variant: "outlined",
128
128
  sx: {
129
129
  textTransform: 'none',
130
- background: '#EBF1F9'
130
+ background: '#EBF1F9',
131
+ padding: '7px 15px'
131
132
  },
132
133
  onClick: handleAddFormWorkflow,
133
134
  size: "small",
@@ -2,18 +2,24 @@
2
2
  import React, { useState, useEffect } from "react";
3
3
  import { Transforms, Path, Node } from "slate";
4
4
  import { useSelected, useSlateStatic, ReactEditor } from "slate-react";
5
- import { gridItem } from "../../utils/gridItem";
6
- import GridPopup from "./GridPopup";
7
5
  import { IconButton, Tooltip, Grid as GridContainer } from "@mui/material";
8
- import { insertGrid } from "../../utils/grid";
9
- import { GridAddGridIcon, GridAddSectionIcon, GridSettingsIcon } from "../../common/iconslist";
10
6
  import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward";
11
7
  import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward";
12
8
  import KeyboardReturnIcon from "@mui/icons-material/KeyboardReturn";
9
+ import TuneIcon from "@mui/icons-material/Tune";
10
+ import { insertGrid } from "../../utils/grid";
11
+ import { GridAddGridIcon, GridAddSectionIcon, GridSettingsIcon } from "../../common/iconslist";
12
+ import GridPopup from "./GridPopup";
13
+ import SectionPopup from "./SectionPopup";
14
+ import { gridItem } from "../../utils/gridItem";
13
15
  import { useEditorContext } from "../../hooks/useMouseMove";
14
16
  import { jsx as _jsx } from "react/jsx-runtime";
15
17
  import { Fragment as _Fragment } from "react/jsx-runtime";
16
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
+ const GridSettingsPoupComp = {
20
+ section: SectionPopup,
21
+ grid: GridPopup
22
+ };
17
23
  const Grid = props => {
18
24
  const {
19
25
  attributes,
@@ -36,7 +42,12 @@ const Grid = props => {
36
42
  borderWidth,
37
43
  borderColor,
38
44
  borderStyle,
39
- borderRadius
45
+ borderRadius,
46
+ sectionBgColor,
47
+ sectionBackgroundImage,
48
+ sectionBannerSpacing,
49
+ sectionBorderRadius,
50
+ gridSize
40
51
  } = element;
41
52
  const {
42
53
  left,
@@ -44,6 +55,12 @@ const Grid = props => {
44
55
  right,
45
56
  bottom
46
57
  } = bannerSpacing || {};
58
+ const {
59
+ left: ssleft,
60
+ top: sstop,
61
+ right: ssright,
62
+ bottom: ssbottom
63
+ } = sectionBannerSpacing || {};
47
64
  const {
48
65
  vertical,
49
66
  horizantal,
@@ -55,10 +72,14 @@ const Grid = props => {
55
72
  bottomLeft,
56
73
  bottomRight
57
74
  } = borderRadius || {};
75
+ const {
76
+ topLeft: ssTopLeft,
77
+ topRight: ssTopRight,
78
+ bottomLeft: ssBottomLeft,
79
+ bottomRight: ssBottomRight
80
+ } = sectionBorderRadius || {};
58
81
  const editor = useSlateStatic();
59
82
  const path = ReactEditor.findPath(editor, element);
60
- const arr = Array.from(Node.elements(editor));
61
- const ele = arr.find(([elem]) => element === elem);
62
83
  const {
63
84
  hoverPath
64
85
  } = useEditorContext();
@@ -87,8 +108,11 @@ const Grid = props => {
87
108
  });
88
109
  }
89
110
  };
111
+ const onSectionSettings = () => {
112
+ setOpenSettings("section");
113
+ };
90
114
  const onSettings = () => {
91
- setOpenSettings(true);
115
+ setOpenSettings("grid");
92
116
  };
93
117
  const onSave = data => {
94
118
  const updateData = {
@@ -173,6 +197,7 @@ const Grid = props => {
173
197
  console.log(err);
174
198
  }
175
199
  };
200
+ const PoupComp = GridSettingsPoupComp[openSetttings];
176
201
  const NewLineButtons = () => {
177
202
  return !readOnly && selected && path.length === 2 ? /*#__PURE__*/_jsxs(_Fragment, {
178
203
  children: [/*#__PURE__*/_jsx("div", {
@@ -203,6 +228,13 @@ const Grid = props => {
203
228
  className: "grid-container-toolbar",
204
229
  contentEditable: false,
205
230
  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, {
206
238
  title: "Grid Settings",
207
239
  arrow: true,
208
240
  children: /*#__PURE__*/_jsx(IconButton, {
@@ -248,34 +280,44 @@ const Grid = props => {
248
280
  const bgImage = backgroundImage && backgroundImage !== "none" ? {
249
281
  backgroundImage: `url(${backgroundImage})`
250
282
  } : {};
283
+ const sectionBgImage = sectionBackgroundImage && sectionBackgroundImage !== "none" ? {
284
+ backgroundImage: `url(${sectionBackgroundImage})`
285
+ } : {};
251
286
  return /*#__PURE__*/_jsx("section", {
252
287
  className: "section-wrapper-fluid",
253
288
  style: {
254
289
  display: "flex",
255
290
  width: "100%",
256
- background: bgColor,
257
- ...bgImage,
291
+ background: sectionBgColor,
292
+ ...sectionBgImage,
258
293
  backgroundSize: "cover",
259
294
  justifyContent: "center",
260
- alignItems: "center"
295
+ alignItems: "center",
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`
261
301
  },
302
+ "data-path": path.join(","),
262
303
  children: /*#__PURE__*/_jsxs(GridContainer, {
263
304
  container: true,
264
305
  className: `grid-container ${grid} has-hover element-root`,
265
306
  ...attributes,
266
307
  ...sectionId,
267
308
  style: {
268
- // background: bgColor,
309
+ background: bgColor,
269
310
  alignContent: vertical,
270
- // ...bgImage,
311
+ ...bgImage,
271
312
  borderColor: borderColor || "transparent",
272
313
  borderWidth: borderWidth || "1px",
273
314
  borderRadius: `${topLeft}px ${topRight}px ${bottomLeft}px ${bottomRight}px`,
274
- borderStyle: borderStyle || "solid",
275
- maxWidth: "1440px",
276
- width: "80%"
315
+ borderStyle: borderStyle || "solid"
277
316
  },
278
317
  "data-path": path.join(","),
318
+ sx: {
319
+ width: `${(gridSize || 8) / 12 * 100}%`
320
+ },
279
321
  children: [fgColor && /*#__PURE__*/_jsx("div", {
280
322
  style: {
281
323
  position: "absolute",
@@ -302,7 +344,7 @@ const Grid = props => {
302
344
  className: "element-selector-dots br",
303
345
  children: " "
304
346
  }), /*#__PURE__*/_jsx(GridToolBar, {})]
305
- }), openSetttings ? /*#__PURE__*/_jsx(GridPopup, {
347
+ }), openSetttings ? /*#__PURE__*/_jsx(PoupComp, {
306
348
  element: element,
307
349
  onSave: onSave,
308
350
  onClose: onClose,
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import StyleBuilder from "../../common/StyleBuilder";
3
+ import sectionStyle from "../../common/StyleBuilder/sectionStyle";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const SectionPopup = props => {
6
+ const {
7
+ element,
8
+ onSave,
9
+ onClose,
10
+ onDelete,
11
+ customProps
12
+ } = props;
13
+ return /*#__PURE__*/_jsx(StyleBuilder, {
14
+ title: "Section",
15
+ type: "sectionStyle",
16
+ element: element,
17
+ onSave: onSave,
18
+ onClose: onClose,
19
+ renderTabs: sectionStyle,
20
+ customProps: customProps,
21
+ onDelete: onDelete
22
+ });
23
+ };
24
+ export default SectionPopup;
@@ -1,11 +1,11 @@
1
- const default_grid = {
1
+ const default_grid = [{
2
2
  type: "grid",
3
3
  grid: "container",
4
4
  children: [{
5
5
  type: "grid-item",
6
6
  grid: 12,
7
7
  children: [{
8
- type: "alignCenter",
8
+ type: "alignLeft",
9
9
  children: [{
10
10
  type: "paragraph",
11
11
  children: [{
@@ -13,6 +13,59 @@ const default_grid = {
13
13
  fontSize: "huge",
14
14
  fontFamily: "PoppinsBold"
15
15
  }]
16
+ }, {
17
+ type: "paragraph",
18
+ children: [{
19
+ fontSize: "16px",
20
+ fontFamily: "PoppinsRegular",
21
+ text: ""
22
+ }]
23
+ }, {
24
+ type: "paragraph",
25
+ children: [{
26
+ fontSize: "16px",
27
+ fontFamily: "PoppinsRegular",
28
+ 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."
29
+ }]
30
+ }, {
31
+ type: "paragraph",
32
+ children: [{
33
+ fontSize: "16px",
34
+ fontFamily: "PoppinsRegular",
35
+ text: ""
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
+ }, {
56
+ type: "paragraph",
57
+ children: [{
58
+ fontSize: "16px",
59
+ fontFamily: "PoppinsRegular",
60
+ text: ""
61
+ }]
62
+ }, {
63
+ type: "paragraph",
64
+ children: [{
65
+ fontSize: "16px",
66
+ fontFamily: "PoppinsRegular",
67
+ 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."
68
+ }]
16
69
  }]
17
70
  }],
18
71
  bgColor: "rgba(255, 255, 255, 0)",
@@ -30,12 +83,35 @@ const default_grid = {
30
83
  type: "grid-item",
31
84
  grid: 12,
32
85
  children: [{
33
- type: "alignCenter",
86
+ type: "alignLeft",
34
87
  children: [{
35
88
  type: "paragraph",
36
89
  children: [{
37
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."
38
91
  }]
92
+ }, {
93
+ type: "paragraph",
94
+ children: [{
95
+ text: ""
96
+ }]
97
+ }, {
98
+ type: "paragraph",
99
+ children: [{
100
+ type: "image",
101
+ url: "https://developers.elementor.com/docs/assets/img/elementor-placeholder-image.png",
102
+ images: [],
103
+ children: [{
104
+ text: " "
105
+ }],
106
+ size: {
107
+ width: 570.1953125,
108
+ height: 450,
109
+ widthInPercent: 89.06583684178412
110
+ },
111
+ alignment: {
112
+ horizantal: "center"
113
+ }
114
+ }]
39
115
  }]
40
116
  }],
41
117
  bgColor: "rgba(255, 255, 255, 0)",
@@ -46,92 +122,9 @@ const default_grid = {
46
122
  right: "16",
47
123
  bottom: "16"
48
124
  }
49
- }, {
50
- type: "grid-item",
51
- grid: 12,
52
- children: [{
53
- type: "paragraph",
54
- children: [{
55
- text: ""
56
- }]
57
- }, {
58
- type: "paragraph",
59
- children: [{
60
- text: ""
61
- }]
62
- }, {
63
- type: "button",
64
- children: [{
65
- text: " "
66
- }],
67
- buttonLink: {
68
- linkType: "webAddress"
69
- },
70
- label: "Gettings Started",
71
- bgColor: "rgba(192,192,192, 1)",
72
- textColor: "rgba(0,0,0,1)",
73
- lockSpacing: true,
74
- bannerSpacing: {
75
- top: "16",
76
- left: "16",
77
- right: "16",
78
- bottom: "16"
79
- },
80
- lockRadius: true,
81
- borderRadius: {
82
- topLeft: "12",
83
- topRight: "12",
84
- bottomLeft: "12",
85
- bottomRight: "12"
86
- },
87
- bgColorHover: "rgba(0, 0, 0, 1)",
88
- textColorHover: "rgba(255, 255, 255, 1)",
89
- borderColor: "rgba(175, 51, 242, 0)"
90
- }, {
91
- type: "button",
92
- children: [{
93
- text: ""
94
- }],
95
- buttonLink: {
96
- linkType: "webAddress"
97
- },
98
- label: "Learn More",
99
- bgColor: "rgba(192,192,192, 1)",
100
- textColor: "rgba(0,0,0,1)",
101
- lockSpacing: false,
102
- bannerSpacing: {
103
- top: "16",
104
- left: "32",
105
- right: "32",
106
- bottom: "16"
107
- },
108
- lockRadius: true,
109
- borderRadius: {
110
- topLeft: "12",
111
- topRight: "12",
112
- bottomLeft: "12",
113
- bottomRight: "12"
114
- },
115
- borderColor: "rgba(175, 51, 242, 0)",
116
- bgColorHover: "rgba(0,0,0,1)",
117
- textColorHover: "rgba(255,255,255, 1)"
118
- }],
119
- bgColor: "rgba(255, 255, 255, 0)",
120
- alignment: {
121
- flexDirection: "row",
122
- vertical: "center",
123
- horizantal: "center"
124
- },
125
- lockSpacing: true,
126
- bannerSpacing: {
127
- top: "16",
128
- left: "16",
129
- right: "16",
130
- bottom: "16"
131
- }
132
125
  }],
133
126
  alignment: {
134
- flexDirection: "column"
127
+ flexDirection: "row"
135
128
  },
136
129
  lockSpacing: true,
137
130
  bannerSpacing: {
@@ -140,5 +133,5 @@ const default_grid = {
140
133
  right: "16",
141
134
  bottom: "16"
142
135
  }
143
- };
136
+ }];
144
137
  export default JSON.stringify(default_grid);
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ import { Box } from "@mui/material";
3
+ import { ReactEditor, useSlateStatic } from "slate-react";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const SectionStyle = () => ({
6
+ root: {
7
+ position: "relative",
8
+ padding: "0px",
9
+ display: "flex",
10
+ alignItems: "center",
11
+ justifyContent: "center",
12
+ width: "100%",
13
+ "&.root-1": {
14
+ "& .section-inner-ed.root-1": {
15
+ width: "80%",
16
+ maxWidth: "1440px"
17
+ }
18
+ }
19
+ }
20
+ });
21
+ const Section = props => {
22
+ const {
23
+ element
24
+ } = props;
25
+ const editor = useSlateStatic();
26
+ const path = ReactEditor.findPath(editor, element);
27
+ console.log(path);
28
+ const classes = SectionStyle();
29
+ const {
30
+ children
31
+ } = props;
32
+ return /*#__PURE__*/_jsx(Box, {
33
+ component: "div",
34
+ className: `root-${path.length}`,
35
+ sx: classes.root,
36
+ children: /*#__PURE__*/_jsx("div", {
37
+ className: `section-inner-ed root-${path.length}`,
38
+ children: children
39
+ })
40
+ });
41
+ };
42
+ export default Section;
@@ -33,7 +33,12 @@ const editorStyles = ({
33
33
  maxWidth: "100%",
34
34
  height: "100%",
35
35
  backgroundColor: "#FFF",
36
- overflow: "visible"
36
+ overflow: "visible",
37
+ "& .section-wrapper-fluid": {
38
+ "& .grid-container": {
39
+ maxWidth: "1440px"
40
+ }
41
+ }
37
42
  },
38
43
  "& .el-toolbar": {
39
44
  position: "absolute",
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  const embedVideoStyle = [{
2
3
  tab: "URL",
3
4
  value: "url",
@@ -14,5 +15,44 @@ const embedVideoStyle = [{
14
15
  key: "alignment",
15
16
  type: "alignment"
16
17
  }]
18
+ }, {
19
+ tab: "Border",
20
+ value: "border",
21
+ fields: [{
22
+ label: "Border Color",
23
+ key: "borderColor",
24
+ type: "color"
25
+ }, {
26
+ label: "Border",
27
+ key: "borderRadius",
28
+ type: "borderRadius"
29
+ }, {
30
+ label: "Border Width",
31
+ key: "borderWidth",
32
+ type: "text",
33
+ placeholder: "1px"
34
+ }, {
35
+ label: "Border Style",
36
+ key: "borderStyle",
37
+ type: "textOptions",
38
+ options: [{
39
+ text: "Solid",
40
+ value: "solid"
41
+ }, {
42
+ text: "Dotted",
43
+ value: "dotted"
44
+ }, {
45
+ text: "Dashed",
46
+ value: "dashed"
47
+ }],
48
+ renderOption: option => {
49
+ return /*#__PURE__*/_jsx("span", {
50
+ style: {
51
+ fontFamily: option.value
52
+ },
53
+ children: option.text
54
+ });
55
+ }
56
+ }]
17
57
  }];
18
58
  export default embedVideoStyle;
@@ -8,6 +8,14 @@ const gridStyle = [{
8
8
  type: "text",
9
9
  placeholder: "Id should be unique for the page..."
10
10
  }]
11
+ }, {
12
+ tab: "Size",
13
+ value: "gridSize",
14
+ fields: [{
15
+ label: "Grid Size",
16
+ key: "gridSize",
17
+ type: "gridSize"
18
+ }]
11
19
  }, {
12
20
  tab: "Colors",
13
21
  value: "colors",
@@ -0,0 +1,38 @@
1
+ const gridStyle = [{
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: "Padding",
23
+ value: "sectionBannerSpacing",
24
+ fields: [{
25
+ label: "Padding",
26
+ key: "sectionBannerSpacing",
27
+ type: "bannerSpacing"
28
+ }]
29
+ }, {
30
+ tab: "Border",
31
+ value: "sectionBorderRadius",
32
+ fields: [{
33
+ label: "Border",
34
+ key: "sectionBorderRadius",
35
+ type: "borderRadius"
36
+ }]
37
+ }];
38
+ export default gridStyle;
@@ -1,4 +1,4 @@
1
- import { Editor, Range, Point, Element, Transforms } from "slate";
1
+ import { Editor, Range, Point, Element, Transforms, Node } from "slate";
2
2
  const NON_DELETABLE_BLOCKS = ["table-cell", "carousel-item"];
3
3
  const withTable = editor => {
4
4
  const {
@@ -38,6 +38,25 @@ const withTable = editor => {
38
38
  return;
39
39
  }
40
40
  }
41
+ if (selection) {
42
+ try {
43
+ const [selectedNode] = Editor.nodes(editor, {
44
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "paragraph"
45
+ });
46
+ if (selectedNode && selectedNode[1]) {
47
+ const [nodeEle, nodePath] = selectedNode;
48
+ const dataText = Node.string(nodeEle);
49
+ // remove first node if no text and has other nodes in index 1 or more
50
+ if (editor.children.length > 1 && nodePath[0] === 0 && nodePath.length === 1 && dataText?.length === 0) {
51
+ Transforms.removeNodes(editor, {
52
+ at: nodePath
53
+ });
54
+ }
55
+ }
56
+ } catch (err) {
57
+ console.log(err);
58
+ }
59
+ }
41
60
  deleteBackward(unit);
42
61
  };
43
62
  editor.deleteForward = unit => {
@@ -28,7 +28,8 @@ export const insertPlainGrid = count => {
28
28
  left: "16",
29
29
  right: "16",
30
30
  bottom: "16"
31
- }
31
+ },
32
+ gridSize: 8
32
33
  };
33
34
  };
34
35
  export const insertGrid = (editor, item, path) => {
@@ -29,4 +29,15 @@ export const convertBase64 = file => {
29
29
  resolve("");
30
30
  }
31
31
  });
32
+ };
33
+ export const gradientBorder = color => {
34
+ if (color?.indexOf("linear") > -1) {
35
+ return {
36
+ borderImage: `${color} 30`
37
+ };
38
+ } else {
39
+ return {
40
+ borderColor: color || "transparent"
41
+ };
42
+ }
32
43
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "1.6.9",
3
+ "version": "1.7.1",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"