@flozy/editor 7.0.6 → 7.0.7

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.
Files changed (53) hide show
  1. package/dist/Editor/CommonEditor.js +19 -19
  2. package/dist/Editor/Editor.css +3 -4
  3. package/dist/Editor/Elements/AI/PopoverAIInput.js +12 -2
  4. package/dist/Editor/Elements/Button/EditorButton.js +0 -1
  5. package/dist/Editor/Elements/DataView/DataView.js +3 -4
  6. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +1 -5
  7. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +1 -5
  8. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +19 -23
  9. package/dist/Editor/Elements/Form/Form.js +0 -1
  10. package/dist/Editor/Elements/FreeGrid/styles.js +0 -1
  11. package/dist/Editor/Elements/List/CheckList.js +1 -2
  12. package/dist/Editor/Elements/Search/SearchAttachment.js +0 -1
  13. package/dist/Editor/Elements/Search/SearchList.js +1 -8
  14. package/dist/Editor/Elements/SimpleText/index.js +7 -19
  15. package/dist/Editor/Elements/SimpleText/style.js +1 -5
  16. package/dist/Editor/Elements/Table/Table.js +15 -15
  17. package/dist/Editor/Elements/Table/TableCell.js +9 -14
  18. package/dist/Editor/MiniEditor.js +2 -4
  19. package/dist/Editor/Styles/EditorStyles.js +287 -291
  20. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +28 -37
  21. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +1 -3
  22. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
  23. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +1 -3
  24. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +8 -3
  25. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +3 -9
  26. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
  27. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +0 -45
  28. package/dist/Editor/Toolbar/PopupTool/index.js +32 -57
  29. package/dist/Editor/common/FontLoader/FontList.js +11 -11
  30. package/dist/Editor/common/FontLoader/FontLoader.js +75 -45
  31. package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -1
  32. package/dist/Editor/common/ImageSelector/UploadStyles.js +1 -2
  33. package/dist/Editor/common/MentionsPopup/index.js +1 -0
  34. package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -1
  35. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +0 -6
  36. package/dist/Editor/common/Section/index.js +60 -89
  37. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
  38. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +0 -4
  39. package/dist/Editor/commonStyle.js +0 -5
  40. package/dist/Editor/helper/deserialize/index.js +1 -1
  41. package/dist/Editor/helper/theme.js +1 -24
  42. package/dist/Editor/hooks/useDrag.js +17 -11
  43. package/dist/Editor/hooks/useEditorScroll.js +1 -2
  44. package/dist/Editor/hooks/useMouseMove.js +4 -6
  45. package/dist/Editor/plugins/withHTML.js +1 -7
  46. package/dist/Editor/utils/SlateUtilityFunctions.js +12 -23
  47. package/dist/Editor/utils/customHooks/useTableResize.js +1 -2
  48. package/dist/Editor/utils/helper.js +0 -41
  49. package/dist/Editor/utils/pageSettings.js +2 -14
  50. package/dist/Editor/utils/table.js +0 -21
  51. package/package.json +3 -3
  52. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
  53. package/dist/Editor/helper/ensureWrappedVariables.js +0 -28
@@ -1,7 +1,11 @@
1
- import { useEffect } from "react";
1
+ import { useEffect, useState } from "react";
2
2
  import WebFont from "webfontloader";
3
3
  import { useEditorContext } from "../../hooks/useMouseMove";
4
- import { defaultFonts, googleFontList, otherFonts } from "./FontList";
4
+ import { googleFontList } from "./FontList";
5
+ import CircularProgress from "@mui/material/CircularProgress";
6
+ import Box from "@mui/material/Box";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
9
  const FontLoader = props => {
6
10
  const {
7
11
  otherProps,
@@ -10,69 +14,74 @@ const FontLoader = props => {
10
14
  const {
11
15
  setFontFamilies
12
16
  } = useEditorContext();
17
+ const [loading, setLoading] = useState(true);
13
18
  const loadFontsInBatches = (families, batchSize = 5, maxRetries = 3) => {
14
19
  let currentIndex = 0;
15
20
  let retryCount = 0;
16
- function loadNextBatch() {
17
- if (currentIndex >= families?.length) {
18
- // console.log("All fonts have been loaded");
19
- return;
20
- }
21
- const batch = families?.slice(currentIndex, currentIndex + batchSize);
22
- const batchWithWeights = batch.map(font => `${font}:300,400,600,700`);
23
- WebFont.load({
24
- google: {
25
- families: [...batchWithWeights]
26
- },
27
- classes: false,
28
- timeout: 2000,
29
- active: () => {
30
- // console.log(`Fonts loaded successfully: ${batch}`);
31
- currentIndex += batchSize;
32
- retryCount = 0; // Reset retry count for the next batch
33
- loadNextBatch();
34
- },
35
- inactive: () => {
36
- // console.log(`Font loading failed for: ${batch}`);
37
-
38
- if (retryCount < maxRetries) {
39
- retryCount++;
40
- // console.log(`Retrying batch (${retryCount}/${maxRetries})...`);
41
- // Retry loading the same batch
42
- loadNextBatch();
43
- } else {
44
- // console.log(
45
- // `Max retries reached for batch: ${batch}. Moving to the next batch.`
46
- // );
21
+ const loadNextBatch = () => {
22
+ try {
23
+ if (currentIndex >= families?.length) {
24
+ // console.log("All fonts have been loaded");
25
+ setLoading(false);
26
+ return;
27
+ }
28
+ const batch = families?.slice(currentIndex, currentIndex + batchSize);
29
+ const batchWithWeights = batch?.map(font => `${font}:300,400,600,700`);
30
+ WebFont.load({
31
+ google: {
32
+ families: [...batchWithWeights]
33
+ },
34
+ classes: false,
35
+ timeout: 2000,
36
+ active: () => {
37
+ // console.log(`Fonts loaded successfully: ${batch}`);
47
38
  currentIndex += batchSize;
48
39
  retryCount = 0; // Reset retry count for the next batch
49
40
  loadNextBatch();
41
+ },
42
+ inactive: () => {
43
+ // console.log(`Font loading failed for: ${batch}`);
44
+ if (retryCount < maxRetries) {
45
+ retryCount++;
46
+ // console.log(`Retrying batch (${retryCount}/${maxRetries})...`);
47
+ // Retry loading the same batch
48
+ loadNextBatch();
49
+ } else {
50
+ // console.log(
51
+ // `Max retries reached for batch: ${batch}. Moving to the next batch.`
52
+ // );
53
+ currentIndex += batchSize;
54
+ retryCount = 0;
55
+ loadNextBatch();
56
+ }
50
57
  }
51
- }
52
- });
53
- }
58
+ });
59
+ } catch (err) {
60
+ setLoading(false);
61
+ }
62
+ };
54
63
  loadNextBatch();
55
64
  };
56
65
  useEffect(() => {
57
- let families = [...otherFonts, ...defaultFonts];
66
+ let families = [...googleFontList];
58
67
  if (!readOnly) {
59
68
  otherProps?.services("listGoogleFont", []).then(data => {
60
- families = [...families, ...(data?.data || [])];
61
- const filteredfamilies = families?.filter(font => !font?.includes("Material"));
69
+ families = [...(data?.data || [])];
62
70
  setFontFamilies({
63
71
  id: 1,
64
72
  format: "fontFamily",
65
73
  type: "fontfamilydropdown",
66
- options: filteredfamilies || []
74
+ options: families || []
67
75
  });
68
76
  loadFontsInBatches(families);
69
77
  }).catch(err => {
70
78
  // console.log(err);
79
+ setLoading(false);
71
80
  });
72
81
  } else {
73
82
  function correctFontArray(fontString) {
74
- let fontsArray = fontString.split(",");
75
- let cleanedFontsArray = [...new Set(fontsArray.map(font => font.trim()))];
83
+ let fontsArray = fontString?.split(",");
84
+ let cleanedFontsArray = [...new Set(fontsArray?.map(font => font.trim()))];
76
85
  return cleanedFontsArray;
77
86
  }
78
87
  function sanitizeFontFamily(fontFamily) {
@@ -88,11 +97,32 @@ const FontLoader = props => {
88
97
  let families = Array.from(fontSet);
89
98
  families = correctFontArray(families.join(", "));
90
99
  families = families?.map(font => font?.replace(/\"/g, ""));
91
- families = families?.map(font => font?.replace(", sans-serif", "")); //This is temporary fix for patch
92
- families = families.filter(font => googleFontList.includes(font));
100
+ families = families?.map(font => font?.replace(", sans-serif", ""));
101
+ families = families?.filter(font => googleFontList?.includes(font));
93
102
  loadFontsInBatches(families);
94
103
  }
104
+
105
+ // Set timeout to hide loader after 5 seconds
106
+ const timeoutId = setTimeout(() => {
107
+ setLoading(false);
108
+ }, 5000);
109
+ return () => clearTimeout(timeoutId);
95
110
  }, []);
96
- return null;
111
+ return /*#__PURE__*/_jsx(_Fragment, {
112
+ children: loading ? /*#__PURE__*/_jsx(Box, {
113
+ sx: {
114
+ position: "absolute",
115
+ top: 0,
116
+ left: 0,
117
+ right: 0,
118
+ bottom: 0,
119
+ zIndex: 99999,
120
+ display: "flex",
121
+ justifyContent: "center",
122
+ alignItems: "center"
123
+ },
124
+ children: /*#__PURE__*/_jsx(CircularProgress, {})
125
+ }) : null
126
+ });
97
127
  };
98
128
  export default FontLoader;
@@ -18,7 +18,7 @@ const Upload = props => {
18
18
  item: true,
19
19
  xs: 12,
20
20
  sx: {
21
- padding: '10px',
21
+ padding: 0,
22
22
  height: '100%'
23
23
  },
24
24
  className: "ims-right",
@@ -6,8 +6,7 @@ const UploadStyles = theme => ({
6
6
  boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.16)",
7
7
  background: theme?.palette?.editor?.uploadFileBg,
8
8
  height: '100%',
9
- minHeight: '150px',
10
- height: "inherit"
9
+ minHeight: '150px'
11
10
  },
12
11
  uploadField: {
13
12
  width: "100%",
@@ -131,6 +131,7 @@ const MentionsPopup = /*#__PURE__*/forwardRef((props, ref) => {
131
131
  setOpenAI("fromElements");
132
132
  }
133
133
  insertMention(editor, char, type);
134
+ Transforms.insertText(editor, " "); //Added to insert space after inserting mention node
134
135
  setMentions({
135
136
  ...mentions,
136
137
  target: null
@@ -58,7 +58,6 @@ const useElementSettingsStyle = theme => ({
58
58
  maxHeight: "500px",
59
59
  overflowX: "hidden",
60
60
  overflowY: "auto",
61
- paddingLeft: "4px",
62
61
  background: theme?.palette?.editor?.background,
63
62
  "& .MuiTypography-root, .MuiInputBase-root, input": {
64
63
  color: theme?.palette?.editor?.textColor
@@ -3,7 +3,6 @@ import PersonalVideoIcon from "@mui/icons-material/PersonalVideo";
3
3
  import PhoneIphoneIcon from "@mui/icons-material/PhoneIphone";
4
4
  import useSwitchViewport from "./styles";
5
5
  import { useEffect } from "react";
6
- import { useEditorContext } from "../../../hooks/useMouseMove";
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
8
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
8
  const SwitchViewport = props => {
@@ -12,9 +11,6 @@ const SwitchViewport = props => {
12
11
  onChange
13
12
  } = props;
14
13
  const classes = useSwitchViewport();
15
- const {
16
- setActiveBreakPoint
17
- } = useEditorContext();
18
14
  useEffect(() => {
19
15
  console.log(breakpoint);
20
16
  }, [breakpoint]);
@@ -25,7 +21,6 @@ const SwitchViewport = props => {
25
21
  children: /*#__PURE__*/_jsx(IconButton, {
26
22
  className: `${!breakpoint || breakpoint === "lg" ? "active" : ""}`,
27
23
  onClick: () => {
28
- setActiveBreakPoint("");
29
24
  onChange("");
30
25
  },
31
26
  children: /*#__PURE__*/_jsx(PersonalVideoIcon, {})
@@ -35,7 +30,6 @@ const SwitchViewport = props => {
35
30
  children: /*#__PURE__*/_jsx(IconButton, {
36
31
  className: `${breakpoint === "xs" ? "active" : ""}`,
37
32
  onClick: () => {
38
- setActiveBreakPoint("xs");
39
33
  onChange("xs");
40
34
  },
41
35
  children: /*#__PURE__*/_jsx(PhoneIphoneIcon, {})
@@ -2,36 +2,34 @@ import React, { useRef, useState } from "react";
2
2
  import { useTheme } from "@mui/material";
3
3
  import { Transforms } from "slate";
4
4
  import { ReactEditor, useSlateStatic } from "slate-react";
5
- import { Box, IconButton, Popper, Tooltip } from "@mui/material";
5
+ import { Box, IconButton, Tooltip } from "@mui/material";
6
6
  import SectionPopup from "../../Elements/Grid/SectionPopup";
7
7
  import { getBreakPointsValue, getTRBLBreakPoints, groupByBreakpoint } from "../../helper/theme";
8
- import DragHandle from "../DnD/DragHandleButton";
9
- import { useEditorSelection } from "../../hooks/useMouseMove";
8
+ // import DragHandle from "../DnD/DragHandleButton";
9
+ // import { useEditorSelection } from "../../hooks/useMouseMove";
10
10
  import SectionStyle from "./styles";
11
11
  import useWindowResize from "../../hooks/useWindowResize";
12
12
  import { SectionSettingIcon } from "../iconListV2";
13
+
14
+ // const list_types = ["orderedList", "unorderedList"];
13
15
  import { jsx as _jsx } from "react/jsx-runtime";
14
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
- import { Fragment as _Fragment } from "react/jsx-runtime";
16
17
  const Toolbar = ({
17
- fromPopper,
18
18
  readOnly,
19
19
  showTool,
20
- onSettings
20
+ onSettings,
21
+ isSectionFullWidth
21
22
  }) => {
22
23
  return !readOnly && !showTool ? /*#__PURE__*/_jsx(Box, {
23
24
  component: "div",
24
25
  className: `element-toolbar no-border-button hr section-tw sectionIcon`,
25
26
  contentEditable: false,
26
- style: fromPopper ? {
27
- position: "unset",
28
- marginLeft: "28px",
29
- paddingTop: "4px",
30
- marginRight: "10px",
31
- height: "100%"
32
- } : {
33
- left: "-28px",
34
- top: "1px"
27
+ sx: {
28
+ left: isSectionFullWidth ? "0px" : "-28px",
29
+ top: isSectionFullWidth ? "-28px" : "1px",
30
+ "&:hover": {
31
+ backgroundColor: "rgba(0,0,0,0.5)"
32
+ }
35
33
  },
36
34
  children: /*#__PURE__*/_jsx(Tooltip, {
37
35
  title: "Section Settings",
@@ -42,7 +40,6 @@ const Toolbar = ({
42
40
  })
43
41
  }) : null;
44
42
  };
45
- const list_types = ["orderedList", "unorderedList"];
46
43
  const Section = props => {
47
44
  const themeReact = useTheme();
48
45
  const theme = props?.theme;
@@ -56,7 +53,8 @@ const Section = props => {
56
53
  readOnly
57
54
  } = customProps;
58
55
  const editor = useSlateStatic();
59
- const [showTool] = useEditorSelection(editor);
56
+ // const [isHovering, setIsHovering] = useState(false);
57
+ const [size] = useWindowResize();
60
58
  const [openSetttings, setOpenSettings] = useState(false);
61
59
  const {
62
60
  sectionBgColor,
@@ -73,41 +71,11 @@ const Section = props => {
73
71
  } = sectionAlignment || {};
74
72
  const path = ReactEditor.findPath(editor, element);
75
73
  const anchorEl = useRef(null);
76
- const popperEl = useRef(null);
77
- const [size] = useWindowResize();
74
+ // const popperEl = useRef(null);
75
+ // const [showTool] = useEditorSelection(editor);
78
76
  const isSectionFullWidth = sectionGridSize && sectionGridSize[size?.device] >= 12;
79
- const [isHovering, setIsHovering] = useState(false);
80
- const onMouseEnter = () => {
81
- setIsHovering(true);
82
- };
83
- const onMouseLeave = () => {
84
- setIsHovering(false);
85
- };
86
- const onSettings = () => {
87
- setOpenSettings(true);
88
- };
89
- const onSave = data => {
90
- const updateData = {
91
- ...data
92
- };
93
- delete updateData.children;
94
- Transforms.setNodes(editor, {
95
- ...updateData
96
- }, {
97
- at: path
98
- });
99
- onClose();
100
- };
101
- const onClose = () => {
102
- setOpenSettings(false);
103
- };
104
- const onDelete = () => {
105
- Transforms.removeNodes(editor, {
106
- at: path
107
- });
108
- };
109
- const isFreeGrid = element?.children?.find(f => f.type === "freegrid");
110
- const needHover = element?.children?.find(f => f.type === "grid" && !list_types.includes(element.type)) ? "" : "";
77
+ const isFreeGrid = element?.children[0]?.type === "freegrid";
78
+ const needHover = false;
111
79
  let tempProps = {};
112
80
  if (element?.type === "temp") {
113
81
  tempProps = {
@@ -131,6 +99,38 @@ const Section = props => {
131
99
  ...getBreakPointsValue(sectionGridSize || 8, null, "overrideGridSize", true)
132
100
  }
133
101
  }, themeReact);
102
+
103
+ // const onMouseEnter = () => {
104
+ // setIsHovering(true);
105
+ // };
106
+
107
+ // const onMouseLeave = () => {
108
+ // setIsHovering(false);
109
+ // };
110
+
111
+ const onSettings = () => {
112
+ setOpenSettings(true);
113
+ };
114
+ const onSave = data => {
115
+ const updateData = {
116
+ ...data
117
+ };
118
+ delete updateData.children;
119
+ Transforms.setNodes(editor, {
120
+ ...updateData
121
+ }, {
122
+ at: path
123
+ });
124
+ onClose();
125
+ };
126
+ const onClose = () => {
127
+ setOpenSettings(false);
128
+ };
129
+ const onDelete = () => {
130
+ Transforms.removeNodes(editor, {
131
+ at: path
132
+ });
133
+ };
134
134
  return path.length === 1 && !isFreeGrid ? /*#__PURE__*/_jsxs(Box, {
135
135
  component: "div",
136
136
  className: `ed-section-wrapper ${readOnly ? "" : "hselect"} ${needHover} is-${element?.type}`,
@@ -145,9 +145,10 @@ const Section = props => {
145
145
  flexDirection: flexDirection || "column",
146
146
  alignItems: horizantal,
147
147
  justifyContent: vertical
148
- },
149
- onMouseEnter: onMouseEnter,
150
- onMouseLeave: onMouseLeave,
148
+ }
149
+ // onMouseEnter={onMouseEnter}
150
+ // onMouseLeave={onMouseLeave}
151
+ ,
151
152
  children: [/*#__PURE__*/_jsxs(Box, {
152
153
  className: "ed-section-inner",
153
154
  sx: {
@@ -155,41 +156,11 @@ const Section = props => {
155
156
  ...edInnerSp
156
157
  },
157
158
  ref: anchorEl,
158
- children: [isHovering && isSectionFullWidth ? /*#__PURE__*/_jsx(Popper, {
159
- open: isHovering && isSectionFullWidth,
160
- anchorEl: anchorEl?.current,
161
- placement: "top-start",
162
- sx: {
163
- zIndex: 9999
164
- },
165
- disablePortal: true,
166
- ref: popperEl,
167
- className: "sectionPopper",
168
- children: /*#__PURE__*/_jsxs(Box, {
169
- sx: {
170
- bgcolor: "background.paper",
171
- height: "30px",
172
- position: "relative",
173
- background: theme?.palette?.type === "dark" ? theme?.palette?.editor?.miniToolBarBackground : "#F6F6F6"
174
- },
175
- children: [!readOnly && !showTool ? /*#__PURE__*/_jsx(DragHandle, {
176
- ...props,
177
- fromPopper: true
178
- }) : null, /*#__PURE__*/_jsx(Toolbar, {
179
- fromPopper: true,
180
- readOnly: readOnly,
181
- showTool: showTool,
182
- onSettings: onSettings
183
- })]
184
- })
185
- }) : /*#__PURE__*/_jsxs(_Fragment, {
186
- children: [!readOnly && !showTool ? /*#__PURE__*/_jsx(DragHandle, {
187
- ...props
188
- }) : null, /*#__PURE__*/_jsx(Toolbar, {
189
- readOnly: readOnly,
190
- showTool: showTool,
191
- onSettings: onSettings
192
- })]
159
+ children: [/*#__PURE__*/_jsx(Toolbar, {
160
+ isSectionFullWidth: isSectionFullWidth,
161
+ readOnly: readOnly,
162
+ showTool: false,
163
+ onSettings: onSettings
193
164
  }), children]
194
165
  }), openSetttings ? /*#__PURE__*/_jsx(SectionPopup, {
195
166
  element: {
@@ -18,7 +18,6 @@ import FontSize from "./fontSize";
18
18
  import SelectSwitch from "./selectSwitch";
19
19
  import CardsMapping from "./card";
20
20
  import MetaDataMapping from "./metaDataMapping";
21
- import LineSpacing from "./lineSpacing";
22
21
  const FieldMap = {
23
22
  text: Text,
24
23
  bannerSpacing: BannerSpacing,
@@ -39,7 +38,6 @@ const FieldMap = {
39
38
  fontSize: FontSize,
40
39
  selectSwitch: SelectSwitch,
41
40
  card: CardsMapping,
42
- metadatamapping: MetaDataMapping,
43
- lineSpacing: LineSpacing
41
+ metadatamapping: MetaDataMapping
44
42
  };
45
43
  export default FieldMap;
@@ -25,10 +25,6 @@ const pageSettingsStyle = [{
25
25
  label: "Padding",
26
26
  key: "bannerSpacing",
27
27
  type: "bannerSpacing"
28
- }, {
29
- label: "Line Spacing",
30
- key: "lineHeight",
31
- type: "lineSpacing"
32
28
  }]
33
29
  }, {
34
30
  tab: "Max Width",
@@ -49,11 +49,6 @@ const useCommonStyle = theme => ({
49
49
  fontWeight: "500",
50
50
  fontFamily: "Inter, sans-serif"
51
51
  },
52
- "& .MuiPaper-root": {
53
- border: `unset !important`,
54
- borderRadius: '0px',
55
- height: 'fit-content'
56
- },
57
52
  "& p": {
58
53
  marginBottom: "7px",
59
54
  marginTop: "4px"
@@ -175,7 +175,7 @@ const deserialize = el => {
175
175
  if (el.nodeType === 3) {
176
176
  // if there is any line-breaks
177
177
  const match = /\r|\n/.exec(el.textContent);
178
- const text = el.textContent.replace(/\r|\n/g, "").trim();
178
+ const text = el.textContent?.trim()?.length === 0 ? el.textContent.replace(/\r|\n/g, "").trim() : el.textContent;
179
179
  return match && !text ? null : {
180
180
  text,
181
181
  ...getInlineTextStyles(el.parentNode)
@@ -161,27 +161,4 @@ export const groupByBreakpoint = (styleProps, theme) => {
161
161
  }
162
162
  };
163
163
  };
164
- export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
165
- export const getBreakpointLineSpacing = (value, breakpoint) => {
166
- try {
167
- const values = getBreakPointsValue(value, breakpoint);
168
- const cssVal = BREAKPOINTS_DEVICES.reduce((a, b) => {
169
- if (values[b] || values["lg"]) {
170
- const value = values[b] || values["lg"];
171
- return {
172
- ...a,
173
- [b]: value
174
- };
175
- } else {
176
- return a;
177
- }
178
- }, {});
179
- if (breakpoint) {
180
- return value[breakpoint] || value["lg"] || value;
181
- } else {
182
- return cssVal["lg"];
183
- }
184
- } catch (err) {
185
- // console.log(err);
186
- }
187
- };
164
+ export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
@@ -1,20 +1,26 @@
1
- import { useCallback, useEffect, useState } from "react";
1
+ import { useEffect, useState } from "react";
2
2
  const useDrag = () => {
3
3
  const [event, setEvent] = useState("");
4
- const onMouseDown = useCallback(() => {
5
- setEvent("start");
6
- }, []);
7
- const onMouseUp = useCallback(() => {
8
- setEvent("end");
9
- }, []);
10
4
  useEffect(() => {
11
- document.addEventListener("pointerdown", onMouseDown);
12
- document.addEventListener("pointerup", onMouseUp);
5
+ addListener();
13
6
  return () => {
14
- document.removeEventListener("pointerdown", onMouseDown);
15
- document.removeEventListener("pointerup", onMouseUp);
7
+ removeListener();
16
8
  };
17
9
  }, []);
10
+ const onMouseDown = () => {
11
+ setEvent("start");
12
+ };
13
+ const onMouseUp = () => {
14
+ setEvent("end");
15
+ };
16
+ const addListener = () => {
17
+ document.addEventListener("pointerdown", onMouseDown);
18
+ document.addEventListener("pointerup", onMouseUp);
19
+ };
20
+ const removeListener = () => {
21
+ document.removeEventListener("pointerdown", onMouseDown);
22
+ document.removeEventListener("pointerup", onMouseUp);
23
+ };
18
24
  return [event];
19
25
  };
20
26
  export default useDrag;
@@ -4,9 +4,8 @@ function useEditorScroll(editorWrapper = {
4
4
  }, callback) {
5
5
  useEffect(() => {
6
6
  const handleScroll = () => {
7
- console.log("Editor debug useEditorScroll ====>", editorWrapper, callback);
8
7
  if (editorWrapper.current) {
9
- callback();
8
+ callback("scroll");
10
9
  }
11
10
  };
12
11
  const currentEditorWrapper = editorWrapper.current;
@@ -1,6 +1,7 @@
1
1
  import { useEffect, useState, createContext, useContext, useMemo } from "react";
2
2
  import { getSelectedText } from "../utils/helper";
3
3
  import { debounce } from "../helper";
4
+ import { defaultFontFamilies } from "../common/FontLoader/FontList";
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  const EditorContext = /*#__PURE__*/createContext();
6
7
  export const useEditorSelection = editor => {
@@ -34,8 +35,7 @@ export const EditorProvider = ({
34
35
  const [contextMenu, setContextMenu] = useState({
35
36
  path: null
36
37
  });
37
- const [fontFamilies, setFontFamilies] = useState({});
38
- const [activeBreakPoint, setActiveBreakPoint] = useState("");
38
+ const [fontFamilies, setFontFamilies] = useState(defaultFontFamilies);
39
39
  useEffect(() => {
40
40
  window.updateSelectedItem = d => {
41
41
  setSelectedElement(d);
@@ -98,10 +98,8 @@ export const EditorProvider = ({
98
98
  setOpenAI,
99
99
  updateDragging,
100
100
  fontFamilies,
101
- setFontFamilies,
102
- activeBreakPoint,
103
- setActiveBreakPoint
104
- }), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, activeBreakPoint]);
101
+ setFontFamilies
102
+ }), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop]);
105
103
  return /*#__PURE__*/_jsx(EditorContext.Provider, {
106
104
  value: otherValues,
107
105
  children: children
@@ -253,13 +253,7 @@ const withHtml = editor => {
253
253
  return;
254
254
  }
255
255
  const fragment = deserialize(parsed.body);
256
- const normalizeFragment = formatFragment[eltype];
257
- if (normalizeFragment && isNonText) {
258
- // When a non-text node is pasted into a list item, insert it into the next node.
259
- insertAtNextNode(editor, fragment);
260
- return;
261
- }
262
- const formattedFragment = normalizeFragment ? normalizeFragment(fragment) : fragment;
256
+ const formattedFragment = formatFragment[eltype] ? formatFragment[eltype](fragment) : fragment;
263
257
  let is_img_table = false;
264
258
  formattedFragment.map(f => {
265
259
  if (f.type === "image" || f?.type?.includes("table")) {