@flozy/editor 1.8.9 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -118,7 +118,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
118
118
  pageBgImage,
119
119
  pageColor,
120
120
  color: pageTextColor,
121
- pageWidth
121
+ pageWidth,
122
+ maxWidth: pageMaxWidth
122
123
  } = pageSt?.pageProps || {
123
124
  bannerSpacing: {
124
125
  left: 0,
@@ -355,13 +356,16 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
355
356
  className: `${hasTopBanner() ? "has-topbanner" : ""}`,
356
357
  sx: classes.slateWrapper,
357
358
  id: "slate-wrapper-scroll-container",
359
+ style: {
360
+ background: pageColor || "#FFF"
361
+ },
358
362
  children: /*#__PURE__*/_jsxs(Box, {
359
363
  component: "div",
360
364
  className: "max-content",
361
365
  children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
362
366
  className: "scroll-area",
363
367
  style: {
364
- background: pageColor || "#FFF",
368
+ // background: pageColor || "#FFF",
365
369
  color: pageTextColor || "#000000"
366
370
  },
367
371
  children: /*#__PURE__*/_jsxs(Box, {
@@ -378,7 +382,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
378
382
  alignSelf: "center",
379
383
  transformOrigin: "left top",
380
384
  transition: "all 0.3s",
381
- minHeight: "87%"
385
+ minHeight: "87%",
386
+ maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
382
387
  },
383
388
  children: [!readOnly ? /*#__PURE__*/_jsx(PopupTool, {
384
389
  onDrawerOpen: onDrawerOpen
@@ -222,6 +222,7 @@ blockquote {
222
222
  color: #ffffff;
223
223
  font-weight: bold;
224
224
  opacity: 1;
225
+ border-radius: 32px;
225
226
  }
226
227
 
227
228
  .signature-btn-container button:hover {
@@ -55,6 +55,8 @@ const Attachments = props => {
55
55
  className: "pdf-i"
56
56
  }) : type === "xls" ? /*#__PURE__*/_jsx(Icon, {
57
57
  icon: "excelIcon"
58
+ }) : type === "csv" ? /*#__PURE__*/_jsx(Icon, {
59
+ icon: "csvIcon"
58
60
  }) : /*#__PURE__*/_jsx(TextSnippetIcon, {
59
61
  className: "doc-i"
60
62
  })
@@ -165,8 +165,8 @@ const Image = ({
165
165
  className: "embed-image-wrpr",
166
166
  style: {
167
167
  position: "relative",
168
- width: `${width}`,
169
- height: `${size.height}px`
168
+ width: `${width}`
169
+ // height: `${size.height}px`,
170
170
  },
171
171
  children: [!readOnly && /*#__PURE__*/_jsx(ToolBar, {}), /*#__PURE__*/_jsx(ImageContent, {}), selected && !readOnly && /*#__PURE__*/_jsx(IconButton, {
172
172
  onPointerDown: onMouseDown,
@@ -6,6 +6,7 @@ import DeleteIcon from "@mui/icons-material/Delete";
6
6
  import SettingsIcon from "@mui/icons-material/Settings";
7
7
  import FormElements from "./FormElements";
8
8
  import FieldPopup from "./FieldPopup";
9
+ import { getBreakPointsValue } from "../../helper/theme";
9
10
  import { jsx as _jsx } from "react/jsx-runtime";
10
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
12
  const FormField = props => {
@@ -83,11 +84,13 @@ const FormField = props => {
83
84
  };
84
85
  return /*#__PURE__*/_jsxs(Grid, {
85
86
  item: true,
86
- xs: grid,
87
87
  ...attributes,
88
88
  className: "form-field",
89
- style: {
90
- position: "relative"
89
+ sx: {
90
+ position: "relative",
91
+ width: {
92
+ ...getBreakPointsValue(grid, null, "overrideGridSize", true)
93
+ }
91
94
  },
92
95
  children: [!readOnly && /*#__PURE__*/_jsx(FieldToolbar, {}), /*#__PURE__*/_jsx(FormElement, {
93
96
  fieldProps: elementProps
@@ -8,7 +8,8 @@ const Title = props => {
8
8
  return /*#__PURE__*/_jsx("div", {
9
9
  ...attributes,
10
10
  style: {
11
- fontWeight: "bold"
11
+ fontWeight: "bold",
12
+ fontSize: "20px"
12
13
  },
13
14
  children: children
14
15
  });
@@ -8,6 +8,7 @@ import AddTemplates from "../PopupTool/AddTemplates";
8
8
  import miniToolbarStyles from "./Styles";
9
9
  import usePopupStyle from "../PopupTool/PopupToolStyle";
10
10
  import PopperHeader from "../PopupTool/PopperHeader";
11
+ import { getSelectedText } 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
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -34,6 +35,7 @@ const MiniToolbar = props => {
34
35
  const [popper, setPopper] = useState(null);
35
36
  const [anchorEl, setAnchorEl] = useState(null);
36
37
  const [fullScreen, setFullScreen] = useState(false);
38
+ const [search, setSearch] = useState("");
37
39
  const PopupComponent = POPUP_TYPES[popper] || null;
38
40
  const open = Boolean(PopupComponent);
39
41
  const DialogComp = !fullScreen ? Popper : Dialog;
@@ -47,8 +49,10 @@ const MiniToolbar = props => {
47
49
  }
48
50
  }, [editor.selection]);
49
51
  const handleClick = type => e => {
50
- setPopper(type);
51
- setAnchorEl(e.currentTarget);
52
+ if (getSelectedText(editor)?.length === 0) {
53
+ setPopper(type);
54
+ setAnchorEl(e.currentTarget);
55
+ }
52
56
  };
53
57
  const onClose = () => {
54
58
  setPopper(null);
@@ -57,6 +61,9 @@ const MiniToolbar = props => {
57
61
  const toggleFullscreen = () => {
58
62
  setFullScreen(!fullScreen);
59
63
  };
64
+ const onSearch = e => {
65
+ setSearch(e?.target?.value || "");
66
+ };
60
67
  return /*#__PURE__*/_jsxs(_Fragment, {
61
68
  children: [/*#__PURE__*/_jsx(Box, {
62
69
  component: "div",
@@ -96,14 +103,18 @@ const MiniToolbar = props => {
96
103
  onClose: onClose,
97
104
  needFullscreen: FULLSCREEN_POPUP[popper],
98
105
  fullScreen: fullScreen,
99
- toggleFullscreen: toggleFullscreen
106
+ toggleFullscreen: toggleFullscreen,
107
+ search: search,
108
+ onSearch: onSearch
100
109
  }), /*#__PURE__*/_jsx(PopupComponent, {
101
110
  classes: popupStyles,
102
111
  editor: editor,
103
112
  customProps: customProps,
104
113
  fullScreen: fullScreen,
105
114
  setPopper: setPopper,
106
- onClose: onClose
115
+ onClose: onClose,
116
+ search: search,
117
+ onSearch: onSearch
107
118
  })]
108
119
  }) : null
109
120
  })]
@@ -1,5 +1,6 @@
1
1
  import React, { useEffect, useState } from "react";
2
- import { Grid, Tabs, Tab, Card, CardMedia, CardContent, Box, CircularProgress } from "@mui/material";
2
+ import { Grid, Tabs, Tab, CircularProgress } from "@mui/material";
3
+ import TemplateCard from "./TemplateCard";
3
4
  import { jsx as _jsx } from "react/jsx-runtime";
4
5
  import { jsxs as _jsxs } from "react/jsx-runtime";
5
6
  const Categories = props => {
@@ -47,7 +48,9 @@ const AddTemplates = props => {
47
48
  editor,
48
49
  fullScreen,
49
50
  customProps,
50
- onClose
51
+ onClose,
52
+ search,
53
+ onSearch
51
54
  } = props;
52
55
  const {
53
56
  services
@@ -78,6 +81,7 @@ const AddTemplates = props => {
78
81
  setLoading(false);
79
82
  };
80
83
  const handleChange = (event, newValue) => {
84
+ onSearch("");
81
85
  setCategory(newValue);
82
86
  setFilteredTemplates(templates.filter(f => f.category === newValue));
83
87
  };
@@ -89,6 +93,13 @@ const AddTemplates = props => {
89
93
  console.log(err);
90
94
  }
91
95
  };
96
+ const filterByTitle = f => {
97
+ if (!search) {
98
+ return true;
99
+ } else {
100
+ return f.title.toLowerCase().includes(search);
101
+ }
102
+ };
92
103
  return /*#__PURE__*/_jsxs(Grid, {
93
104
  container: true,
94
105
  className: `templates ${fullScreen ? "fullscreen" : ""}`,
@@ -109,32 +120,13 @@ const AddTemplates = props => {
109
120
  sx: classes.templateCardsWrpr,
110
121
  children: [/*#__PURE__*/_jsx(ProgressBar, {
111
122
  loading: loading
112
- }), filteredTemplates.map(m => {
113
- return /*#__PURE__*/_jsx(Grid, {
114
- item: true,
115
- xs: 4,
116
- children: /*#__PURE__*/_jsxs(Card, {
117
- sx: classes.templateCard,
118
- onClick: onSelectTemplate(m),
119
- children: [/*#__PURE__*/_jsxs(Box, {
120
- sx: classes.templateCardMediaWrpr,
121
- children: [/*#__PURE__*/_jsx("div", {
122
- className: "img-loader-wrapper"
123
- }), /*#__PURE__*/_jsx(CardMedia, {
124
- className: `template-card-media ${fullScreen ? "fullscreen" : ""}`,
125
- component: "div",
126
- image: m?.thumbnail,
127
- alt: m?.title,
128
- sx: classes.templateCardMedia
129
- })]
130
- }), /*#__PURE__*/_jsx(CardContent, {
131
- style: {
132
- height: "30px"
133
- },
134
- children: m?.title
135
- })]
136
- })
137
- }, `template_${m.id}`);
123
+ }), filteredTemplates.filter(filterByTitle).map(m => {
124
+ return /*#__PURE__*/_jsx(TemplateCard, {
125
+ classes: classes,
126
+ onSelectTemplate: onSelectTemplate,
127
+ m: m,
128
+ fullScreen: fullScreen
129
+ }, `template_Card_${m.id}_popup`);
138
130
  })]
139
131
  })]
140
132
  });
@@ -1,10 +1,27 @@
1
1
  import React from "react";
2
- import { Grid, Typography, IconButton, Tooltip } from "@mui/material";
2
+ import { Grid, Typography, IconButton, Tooltip, TextField } from "@mui/material";
3
3
  import CloseIcon from "@mui/icons-material/Close";
4
4
  import OpenInFullIcon from "@mui/icons-material/OpenInFull";
5
5
  import CloseFullscreenIcon from "@mui/icons-material/CloseFullscreen";
6
+ import { Search } from "@mui/icons-material";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ const SearchBox = props => {
10
+ const {
11
+ search,
12
+ classes,
13
+ handleChange
14
+ } = props;
15
+ return /*#__PURE__*/_jsx(TextField, {
16
+ sx: classes.searchBox,
17
+ size: "small",
18
+ InputProps: {
19
+ startAdornment: /*#__PURE__*/_jsx(Search, {})
20
+ },
21
+ value: search,
22
+ onChange: handleChange
23
+ });
24
+ };
8
25
  const PopperHeader = props => {
9
26
  const {
10
27
  title,
@@ -12,7 +29,9 @@ const PopperHeader = props => {
12
29
  onClose,
13
30
  needFullscreen,
14
31
  fullScreen,
15
- toggleFullscreen
32
+ toggleFullscreen,
33
+ search,
34
+ onSearch
16
35
  } = props;
17
36
  return /*#__PURE__*/_jsx(Grid, {
18
37
  container: true,
@@ -42,7 +61,11 @@ const PopperHeader = props => {
42
61
  }), /*#__PURE__*/_jsxs(Grid, {
43
62
  sx: classes.textFormatLabel,
44
63
  justifyContent: "end",
45
- children: [needFullscreen ? /*#__PURE__*/_jsx(Tooltip, {
64
+ children: [needFullscreen ? /*#__PURE__*/_jsx(SearchBox, {
65
+ classes: classes,
66
+ search: search,
67
+ handleChange: onSearch
68
+ }) : null, needFullscreen ? /*#__PURE__*/_jsx(Tooltip, {
46
69
  title: "Toggle Fullscreen",
47
70
  arrow: true,
48
71
  children: /*#__PURE__*/_jsx(IconButton, {
@@ -5,6 +5,7 @@ const usePopupStyle = () => ({
5
5
  marginBottom: "12px !important",
6
6
  border: "1px solid #E0E0E0",
7
7
  borderRadius: "10px",
8
+ maxWidth: "100%",
8
9
  "&.fullscreen": {
9
10
  marginBottom: "0px !important",
10
11
  "& .papper-wrpr": {
@@ -23,6 +24,7 @@ const usePopupStyle = () => ({
23
24
  overflow: "auto",
24
25
  "&.templates": {
25
26
  width: "500px",
27
+ maxWidth: "100%",
26
28
  "&.fullscreen": {
27
29
  width: "100%",
28
30
  maxHeight: "fit-content"
@@ -144,12 +146,16 @@ const usePopupStyle = () => ({
144
146
  position: "relative",
145
147
  padding: "4px",
146
148
  margin: "8px",
149
+ marginBottom: "0px",
147
150
  border: "1px solid rgba(0, 0, 0, 0.1)",
148
151
  borderRadius: "10px",
149
152
  backgroundColor: "#FEFEFE",
150
153
  overflow: "hidden",
151
154
  "&:hover": {
152
- border: "1px solid #2563EB"
155
+ border: "1px solid #2563EB",
156
+ "& .template-card-action": {
157
+ display: "flex"
158
+ }
153
159
  },
154
160
  "& .img-loader-wrapper": {
155
161
  position: "absolute",
@@ -172,6 +178,10 @@ const usePopupStyle = () => ({
172
178
  height: `${window.innerHeight - 300}px`
173
179
  }
174
180
  },
181
+ templateCardTitle: {
182
+ fontSize: "12px",
183
+ padding: "6px 8px"
184
+ },
175
185
  pageWidthBtn: {
176
186
  color: "#64748B",
177
187
  marginTop: "8px",
@@ -221,6 +231,44 @@ const usePopupStyle = () => ({
221
231
  defaultBtn: {
222
232
  color: "#0F172A",
223
233
  textTransform: "none"
234
+ },
235
+ templateCardBtnGrp: {
236
+ display: "none",
237
+ position: "absolute",
238
+ flexDirection: "column",
239
+ left: 0,
240
+ bottom: 0,
241
+ alignItems: "center",
242
+ justifyContent: "center",
243
+ zIndex: 1,
244
+ width: "100%",
245
+ background: "linear-gradient(180deg, #0F172A00, #0f172ae0 96%)",
246
+ padding: "10px",
247
+ boxSizing: "border-box",
248
+ "& .blueBtn": {
249
+ background: "#2563EB !important",
250
+ borderRadius: "7px",
251
+ padding: "7px 15px",
252
+ color: "#FFF",
253
+ width: "100px",
254
+ marginBottom: "10px"
255
+ },
256
+ "& .outlineBtn": {
257
+ border: "1px solid #D7DBEC",
258
+ borderRadius: "7px",
259
+ padding: "7px 15px",
260
+ color: "#FFF",
261
+ width: "100px"
262
+ }
263
+ },
264
+ searchBox: {
265
+ marginRight: "12px",
266
+ "& input": {
267
+ padding: "6px 12px"
268
+ },
269
+ "& svg": {
270
+ color: "#CCC"
271
+ }
224
272
  }
225
273
  });
226
274
  export default usePopupStyle;
@@ -0,0 +1,65 @@
1
+ import React from "react";
2
+ import { Grid, Card, CardMedia, CardContent, Box, Button } from "@mui/material";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ const PreviewAndSelect = props => {
6
+ const {
7
+ classes,
8
+ data,
9
+ onSelectTemplate
10
+ } = props;
11
+ return /*#__PURE__*/_jsxs(Box, {
12
+ className: "template-card-action",
13
+ component: "div",
14
+ sx: classes.templateCardBtnGrp,
15
+ children: [/*#__PURE__*/_jsx(Button, {
16
+ className: "blueBtn",
17
+ onClick: onSelectTemplate(data),
18
+ children: "Select"
19
+ }), /*#__PURE__*/_jsx(Button, {
20
+ href: data?.previewLink,
21
+ target: "_blank",
22
+ className: "outlineBtn",
23
+ children: "Preview"
24
+ })]
25
+ });
26
+ };
27
+ const TemplateCard = props => {
28
+ const {
29
+ classes,
30
+ m,
31
+ onSelectTemplate,
32
+ fullScreen
33
+ } = props;
34
+ return /*#__PURE__*/_jsx(Grid, {
35
+ item: true,
36
+ xs: 4,
37
+ style: {
38
+ minWidth: "150px",
39
+ minHeight: "200px"
40
+ },
41
+ children: /*#__PURE__*/_jsxs(Card, {
42
+ sx: classes.templateCard,
43
+ children: [/*#__PURE__*/_jsxs(Box, {
44
+ sx: classes.templateCardMediaWrpr,
45
+ children: [/*#__PURE__*/_jsx("div", {
46
+ className: "img-loader-wrapper"
47
+ }), /*#__PURE__*/_jsx(CardMedia, {
48
+ className: `template-card-media ${fullScreen ? "fullscreen" : ""}`,
49
+ component: "div",
50
+ image: m?.thumbnail,
51
+ alt: m?.title,
52
+ sx: classes.templateCardMedia
53
+ }), /*#__PURE__*/_jsx(PreviewAndSelect, {
54
+ classes: classes,
55
+ onSelectTemplate: onSelectTemplate,
56
+ data: m
57
+ })]
58
+ }), /*#__PURE__*/_jsx(CardContent, {
59
+ sx: classes.templateCardTitle,
60
+ children: m?.title
61
+ })]
62
+ })
63
+ }, `template_${m.id}`);
64
+ };
65
+ export default TemplateCard;
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from "react";
2
- import { Popper, Fade, Paper, Popover } from "@mui/material";
2
+ import { Popper, Fade, Paper } from "@mui/material";
3
3
  import { Editor, Range } from "slate";
4
4
  import { useSlate, useFocused } from "slate-react";
5
5
  import TextFormat from "./TextFormat";
@@ -7,7 +7,7 @@ import { AiFillEdit, AiOutlineInsertRowBelow, AiOutlineInsertRowRight, AiOutline
7
7
  import { SiLatex } from "react-icons/si";
8
8
  import { RiDeleteColumn, RiDeleteRow } from "react-icons/ri";
9
9
  import { IoIosImage, IoMdArrowDroprightCircle, IoMdArrowDropdownCircle } from "react-icons/io";
10
- import { GridIcon, AccordionIcon, SignatureIcon, ButtonIcon, Carousal, FormIcon, BoldIcon, FontFamilyIcon, FontSizeIcon, ImageIcon, ItalicIcon, LinkIcon, StrikethroughIcon, TableIcon, UnderLineIcon, VideoIcon, CheckboxIcon, AppHeader, MoreHorizontal, UploadImage, DocsUpload, LeftArrow, RightArrow, CheckListButton, CheckListButtonActive, ExcelIcon } from "./iconslist";
10
+ import { GridIcon, AccordionIcon, SignatureIcon, ButtonIcon, Carousal, FormIcon, BoldIcon, FontFamilyIcon, FontSizeIcon, ImageIcon, ItalicIcon, LinkIcon, StrikethroughIcon, TableIcon, UnderLineIcon, VideoIcon, CheckboxIcon, AppHeader, MoreHorizontal, UploadImage, DocsUpload, LeftArrow, RightArrow, CheckListButton, CheckListButtonActive, ExcelIcon, CsvIcon } from "./iconslist";
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
13
  const iconList = {
@@ -194,7 +194,8 @@ const iconList = {
194
194
  rightArrow: /*#__PURE__*/_jsx(RightArrow, {}),
195
195
  checkListButton: /*#__PURE__*/_jsx(CheckListButton, {}),
196
196
  checkListButtonActive: /*#__PURE__*/_jsx(CheckListButtonActive, {}),
197
- excelIcon: /*#__PURE__*/_jsx(ExcelIcon, {})
197
+ excelIcon: /*#__PURE__*/_jsx(ExcelIcon, {}),
198
+ csvIcon: /*#__PURE__*/_jsx(CsvIcon, {})
198
199
  };
199
200
  const Icon = props => {
200
201
  const {
@@ -23,6 +23,7 @@ const BannerSpacing = props => {
23
23
  }
24
24
  const [size] = useWindowResize();
25
25
  const value = getBreakPointsValue(val, size?.device);
26
+ console.log(value, val, size?.device);
26
27
  const handleChange = e => {
27
28
  let changeAll = {};
28
29
  if (lockSpacing) {
@@ -26,5 +26,14 @@ const pageSettingsStyle = [{
26
26
  key: "bannerSpacing",
27
27
  type: "bannerSpacing"
28
28
  }]
29
+ }, {
30
+ tab: "Max Width",
31
+ value: "maxWidth",
32
+ fields: [{
33
+ label: "Max Width",
34
+ key: "maxWidth",
35
+ type: "text",
36
+ placeholder: "Maximum width of page in px"
37
+ }]
29
38
  }];
30
39
  export default pageSettingsStyle;
@@ -1648,4 +1648,29 @@ export const ExcelIcon = () => /*#__PURE__*/_jsx("svg", {
1648
1648
  })
1649
1649
  })
1650
1650
  })
1651
+ });
1652
+ export const CsvIcon = () => /*#__PURE__*/_jsxs("svg", {
1653
+ width: "32",
1654
+ height: "32",
1655
+ viewBox: "0 0 32 32",
1656
+ fill: "none",
1657
+ xmlns: "http://www.w3.org/2000/svg",
1658
+ children: [/*#__PURE__*/_jsx("rect", {
1659
+ width: "32",
1660
+ height: "32",
1661
+ rx: "3.69038",
1662
+ fill: "#E0E0E0"
1663
+ }), /*#__PURE__*/_jsx("path", {
1664
+ d: "M26.1095 9.38475H20.3567V3.63197C20.3567 3.51461 20.3101 3.40205 20.2271 3.31906C20.1441 3.23608 20.0315 3.18945 19.9142 3.18945H7.52358C7.40621 3.18945 7.29366 3.23608 7.21067 3.31906C7.12768 3.40205 7.08105 3.51461 7.08105 3.63197V16.0226C7.08105 16.1399 7.12768 16.2525 7.21067 16.3355C7.29366 16.4185 7.40621 16.4651 7.52358 16.4651H19.4716V23.5454H7.52358C7.40621 23.5454 7.29366 23.5921 7.21067 23.6751C7.12768 23.758 7.08105 23.8706 7.08105 23.988V27.5281C7.08105 27.6455 7.12768 27.7581 7.21067 27.841C7.29366 27.924 7.40621 27.9707 7.52358 27.9707H26.1095C26.2268 27.9707 26.3394 27.924 26.4224 27.841C26.5054 27.7581 26.552 27.6455 26.552 27.5281V9.82728C26.552 9.70991 26.5054 9.59735 26.4224 9.51437C26.3394 9.43138 26.2268 9.38475 26.1095 9.38475Z",
1665
+ fill: "white"
1666
+ }), /*#__PURE__*/_jsx("path", {
1667
+ d: "M19.9118 15.5752H5.75112C5.50672 15.5752 5.30859 15.7733 5.30859 16.0177V23.9831C5.30859 24.2275 5.50672 24.4256 5.75112 24.4256H19.9118C20.1562 24.4256 20.3543 24.2275 20.3543 23.9831V16.0177C20.3543 15.7733 20.1562 15.5752 19.9118 15.5752Z",
1668
+ fill: "#66BB6A"
1669
+ }), /*#__PURE__*/_jsx("path", {
1670
+ d: "M26.4208 9.5098L20.2255 3.3145C20.1636 3.25209 20.0845 3.20953 19.9983 3.19224C19.9121 3.17495 19.8228 3.18372 19.7416 3.21742C19.6604 3.25113 19.5911 3.30824 19.5425 3.38149C19.4939 3.45474 19.4682 3.54079 19.4688 3.62869V9.82399C19.4688 9.94135 19.5154 10.0539 19.5984 10.1369C19.6814 10.2199 19.7939 10.2665 19.9113 10.2665H26.1066C26.1945 10.267 26.2805 10.2413 26.3538 10.1928C26.427 10.1442 26.4841 10.0749 26.5178 9.99369C26.5515 9.91251 26.5603 9.82313 26.543 9.73695C26.5257 9.65077 26.4832 9.5717 26.4208 9.5098Z",
1671
+ fill: "#E0E0E0"
1672
+ }), /*#__PURE__*/_jsx("path", {
1673
+ d: "M10.1788 20.5847H10.9753C10.9475 20.8284 10.8559 21.0604 10.7098 21.2573C10.5697 21.4397 10.3875 21.5855 10.1788 21.6821C9.9552 21.7844 9.71217 21.8373 9.46631 21.837C9.23734 21.8459 9.00918 21.805 8.79756 21.7171C8.58593 21.6293 8.39588 21.4965 8.24052 21.3281C7.91249 20.9659 7.74073 20.4888 7.7626 20.0006C7.74301 19.5143 7.91093 19.039 8.23167 18.673C8.37983 18.5042 8.56321 18.37 8.76889 18.2797C8.97456 18.1895 9.19753 18.1455 9.42206 18.1508C9.64785 18.1457 9.87206 18.1898 10.0791 18.2799C10.2862 18.3701 10.4712 18.5042 10.6213 18.673C10.8099 18.8938 10.9313 19.1641 10.9709 19.4518H10.1788C10.1395 19.2957 10.0472 19.158 9.91768 19.0624C9.77323 18.9681 9.60336 18.9202 9.43091 18.9252C9.30533 18.9217 9.18061 18.9471 9.06632 18.9992C8.95203 19.0514 8.8512 19.129 8.77155 19.2261C8.59958 19.4467 8.51173 19.7212 8.52374 20.0006C8.51183 20.2814 8.60313 20.5569 8.7804 20.775C8.86139 20.8714 8.96321 20.9482 9.07819 20.9996C9.19317 21.0509 9.31832 21.0755 9.44418 21.0715C9.6028 21.0807 9.76013 21.0382 9.89257 20.9505C10.025 20.8627 10.1254 20.7344 10.1788 20.5847ZM11.6612 20.7174H12.3914C12.4223 20.8647 12.507 20.9953 12.6289 21.0836C12.7507 21.1719 12.9011 21.2118 13.0507 21.1954C13.1892 21.2025 13.3261 21.1636 13.4402 21.0847C13.4868 21.0509 13.5244 21.0062 13.5499 20.9546C13.5753 20.9029 13.5878 20.8458 13.5862 20.7882C13.5903 20.7117 13.5686 20.636 13.5244 20.5734C13.4803 20.5108 13.4163 20.4649 13.3428 20.4431C13.3103 20.4431 13.1628 20.3988 12.9003 20.3103C12.6226 20.2507 12.3565 20.146 12.1126 20.0006C11.9949 19.9147 11.9001 19.8011 11.8368 19.6699C11.7735 19.5387 11.7436 19.3938 11.7497 19.2483C11.7437 19.1007 11.7703 18.9535 11.8277 18.8174C11.8851 18.6812 11.9718 18.5594 12.0816 18.4606C12.3279 18.2522 12.6446 18.1461 12.9667 18.1641C13.2843 18.152 13.5966 18.2488 13.8517 18.4385C13.9632 18.52 14.0542 18.6265 14.1172 18.7494C14.1802 18.8724 14.2135 19.0083 14.2146 19.1465H13.4756C13.452 19.036 13.3871 18.9387 13.2941 18.8745C13.2012 18.8103 13.0872 18.7842 12.9755 18.8013C12.8543 18.7955 12.7346 18.8297 12.6348 18.8987C12.5939 18.9286 12.5609 18.968 12.5386 19.0135C12.5162 19.0589 12.5052 19.1091 12.5064 19.1598C12.5032 19.2161 12.5165 19.2721 12.5448 19.3209C12.5732 19.3697 12.6152 19.4091 12.6657 19.4341C12.8434 19.5084 13.029 19.5619 13.2189 19.5934C13.4646 19.6346 13.7013 19.7184 13.9181 19.8413C14.0591 19.9314 14.1741 20.0568 14.2517 20.205C14.3293 20.3533 14.3669 20.5192 14.3606 20.6865C14.3679 20.8731 14.3255 21.0584 14.2376 21.2233C14.1498 21.3881 14.0196 21.5266 13.8605 21.6246C13.61 21.7706 13.3227 21.8412 13.033 21.8282C12.8135 21.8476 12.5925 21.8121 12.3901 21.7248C12.1877 21.6375 12.0102 21.5012 11.8736 21.3281C11.7519 21.146 11.6787 20.9358 11.6612 20.7174ZM16.0466 21.7706L14.719 18.2305H15.5111L16.3741 20.6201L17.1131 18.2305H17.8875L16.7148 21.7706H16.0466Z",
1674
+ fill: "white"
1675
+ })]
1651
1676
  });
@@ -13,6 +13,9 @@ export const getDevice = width => {
13
13
  }
14
14
  };
15
15
  const copyAllLg = (value, ot) => {
16
+ if (value && value["lg"] !== undefined) {
17
+ return value;
18
+ }
16
19
  return BREAKPOINTS_DEVICES.reduce((a, b) => {
17
20
  return {
18
21
  ...a,
@@ -42,7 +45,12 @@ export const getBreakPointsValue = (value, breakpoint, ot = null, ov = false) =>
42
45
  if (typeof value !== "object") {
43
46
  return value;
44
47
  }
45
- return value ? value[breakpoint] || value["lg"] : value;
48
+ if (value && value["lg"] === undefined) {
49
+ let val = copyAllLg(value, ot);
50
+ return val ? val[breakpoint] || val["lg"] : val;
51
+ } else {
52
+ return value ? value[breakpoint] || value["lg"] : value;
53
+ }
46
54
  } else if (typeof value === "object") {
47
55
  return !breakpoint && value["lg"] ? !ov ? value : overrideValues(value, ot) : value[breakpoint] || copyAllLg(value, ot);
48
56
  } else {
@@ -0,0 +1,20 @@
1
+ import { useState, useEffect } from "react";
2
+ const useIntersection = (element, rootMargin, threshold) => {
3
+ const [isVisible, setState] = useState(false);
4
+ useEffect(() => {
5
+ const observer = new IntersectionObserver(([entry]) => {
6
+ setState(entry.isIntersecting);
7
+ }, {
8
+ rootMargin,
9
+ threshold
10
+ });
11
+ element?.current && observer.observe(element.current);
12
+ return () => {
13
+ if (element && element?.current) {
14
+ observer.unobserve(element.current);
15
+ }
16
+ };
17
+ }, [element?.current]);
18
+ return isVisible;
19
+ };
20
+ export default useIntersection;
@@ -491,6 +491,7 @@ export const getBlock = props => {
491
491
  case "docs":
492
492
  case "pdf":
493
493
  case "xls":
494
+ case "csv":
494
495
  return /*#__PURE__*/_jsx(Attachments, {
495
496
  ...props
496
497
  });
@@ -24,7 +24,7 @@ export const insertAttachments = (editor, data) => {
24
24
  if (url) {
25
25
  const attachmentsNode = createAttachmentsNode({
26
26
  ...data,
27
- type: docType?.includes("pdf") ? "pdf" : docType?.includes("doc") || docType?.includes("page") ? "docs" : docType?.includes("xls") || docType?.includes("numbers") ? "xls" : "docs"
27
+ type: docType?.includes("pdf") ? "pdf" : docType?.includes("doc") || docType?.includes("page") ? "docs" : docType?.includes("xls") || docType?.includes("numbers") ? "xls" : docType?.includes("csv") ? "csv" : "docs"
28
28
  });
29
29
  Transforms.insertNodes(editor, [attachmentsNode]);
30
30
  insertNewLine(editor);
@@ -10,6 +10,12 @@ export const gridItem = (props = {}) => {
10
10
  }]
11
11
  }],
12
12
  bgColor: "rgba(255, 255, 255, 0)",
13
+ bannerSpacing: {
14
+ left: 8,
15
+ right: 8,
16
+ top: 8,
17
+ bottom: 8
18
+ },
13
19
  ...(props || {})
14
20
  };
15
21
  };
@@ -1,3 +1,4 @@
1
+ import { Editor } from "slate";
1
2
  export const formatDate = (date, format = "MM/DD/YYYY") => {
2
3
  if (!date) return "";
3
4
  var d = new Date(date),
@@ -71,4 +72,13 @@ export const isTextSelected = selection => {
71
72
  console.log(err);
72
73
  return false;
73
74
  }
75
+ };
76
+ export const getSelectedText = editor => {
77
+ try {
78
+ console.log("Q1", Editor.string(editor, editor?.selection));
79
+ return Editor.string(editor, editor?.selection);
80
+ } catch (err) {
81
+ console.log(err);
82
+ return '';
83
+ }
74
84
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "1.8.9",
3
+ "version": "1.9.1",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"