@flozy/editor 4.0.1 → 4.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/dist/Editor/ChatEditor.js +17 -28
  2. package/dist/Editor/CommonEditor.js +16 -1
  3. package/dist/Editor/Editor.css +1 -13
  4. package/dist/Editor/Elements/Accordion/Accordion.js +1 -1
  5. package/dist/Editor/Elements/Accordion/AccordionSummary.js +5 -21
  6. package/dist/Editor/Elements/AppHeader/AppHeader.js +23 -1
  7. package/dist/Editor/Elements/Emoji/EmojiPicker.js +2 -4
  8. package/dist/Editor/Elements/Grid/Grid.js +25 -3
  9. package/dist/Editor/Elements/List/CheckList.js +1 -2
  10. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +3 -3
  11. package/dist/Editor/Elements/Redo/RedoButton.js +14 -0
  12. package/dist/Editor/Elements/Table/Styles.js +23 -1
  13. package/dist/Editor/Elements/Table/Table.js +2 -1
  14. package/dist/Editor/Elements/Table/TableCell.js +69 -7
  15. package/dist/Editor/Elements/TableContextMenu/TableContextMenu.js +1 -0
  16. package/dist/Editor/Elements/Undo/UndoButton.js +14 -0
  17. package/dist/Editor/Styles/EditorStyles.js +1 -1
  18. package/dist/Editor/Toolbar/FormatTools/TextSize.js +24 -7
  19. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +4 -2
  20. package/dist/Editor/Toolbar/Mini/Options/Options.js +10 -0
  21. package/dist/Editor/Toolbar/Mini/Styles.js +7 -0
  22. package/dist/Editor/Toolbar/PopupTool/index.js +2 -3
  23. package/dist/Editor/assets/svg/AddTemplateIcon.js +13 -10
  24. package/dist/Editor/assets/svg/RedoIcon.js +27 -0
  25. package/dist/Editor/assets/svg/SettingsIcon.js +28 -0
  26. package/dist/Editor/assets/svg/TextIcon.js +8 -5
  27. package/dist/Editor/assets/svg/UndoIcon.js +27 -0
  28. package/dist/Editor/common/ColorPickerButton.js +4 -12
  29. package/dist/Editor/common/DnD/DragHandleButton.js +55 -46
  30. package/dist/Editor/common/Icon.js +13 -1
  31. package/dist/Editor/common/Section/index.js +57 -7
  32. package/dist/Editor/common/Section/styles.js +11 -0
  33. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +1 -2
  34. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +20 -26
  35. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +16 -18
  36. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +4 -6
  37. package/dist/Editor/common/iconslist.js +0 -31
  38. package/dist/Editor/helper/index.js +0 -22
  39. package/dist/Editor/helper/theme.js +1 -2
  40. package/dist/Editor/utils/SlateUtilityFunctions.js +8 -2
  41. package/dist/Editor/utils/events.js +54 -2
  42. package/dist/Editor/utils/helper.js +1 -1
  43. package/dist/Editor/utils/table.js +51 -43
  44. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { Checkbox, FormControlLabel, Grid, Slider, Typography, Box } from "@mui/material";
3
3
  import { squreStyle } from "./radiusStyle";
4
- import { getBreakPointsValue, getCustomizationValue } from "../../../helper/theme";
4
+ import { getBreakPointsValue } from "../../../helper/theme";
5
5
  import useWindowResize from "../../../hooks/useWindowResize";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -78,12 +78,10 @@ const BannerSpacing = props => {
78
78
  component: "input",
79
79
  sx: classes.sapcingInput,
80
80
  name: "top",
81
- value: !lockSpacing ? "" : getCustomizationValue(value?.top),
82
- className: "sliderInput removeScroll",
81
+ value: !lockSpacing ? "" : value?.top || 0,
82
+ className: "sliderInput",
83
83
  disabled: !lockSpacing,
84
- onChange: handleChange,
85
- type: "number",
86
- placeholder: "0"
84
+ onChange: handleChange
87
85
  })]
88
86
  }), /*#__PURE__*/_jsx(FormControlLabel, {
89
87
  className: "ccheckbox-primary",
@@ -125,54 +123,50 @@ const BannerSpacing = props => {
125
123
  children: [/*#__PURE__*/_jsx("div", {
126
124
  className: "bannerSpaceBoxTop",
127
125
  children: /*#__PURE__*/_jsx("input", {
128
- type: "number",
126
+ type: "text",
129
127
  name: "top",
130
- value: getCustomizationValue(value?.top),
131
- className: "borderInput removeScroll",
128
+ value: value?.top,
129
+ className: "borderInput",
132
130
  style: {
133
131
  ...squreStyle.topRight
134
132
  },
135
- onChange: handleChange,
136
- placeholder: "0"
133
+ onChange: handleChange
137
134
  })
138
135
  }), /*#__PURE__*/_jsx("div", {
139
136
  className: "bannerSpaceBoxRight",
140
137
  children: /*#__PURE__*/_jsx("input", {
141
- type: "number",
138
+ type: "text",
142
139
  name: "right",
143
- value: getCustomizationValue(value?.right),
144
- className: "borderInput removeScroll",
140
+ value: value?.right,
141
+ className: "borderInput",
145
142
  style: {
146
143
  ...squreStyle.bottomLeft
147
144
  },
148
- onChange: handleChange,
149
- placeholder: "0"
145
+ onChange: handleChange
150
146
  })
151
147
  }), /*#__PURE__*/_jsx("div", {
152
148
  className: "bannerSpaceBoxBottom",
153
149
  children: /*#__PURE__*/_jsx("input", {
154
- type: "number",
150
+ type: "text",
155
151
  name: "bottom",
156
- value: getCustomizationValue(value?.bottom),
157
- className: "borderInput removeScroll",
152
+ value: value?.bottom,
153
+ className: "borderInput",
158
154
  style: {
159
155
  ...squreStyle.bottomRight
160
156
  },
161
- onChange: handleChange,
162
- placeholder: "0"
157
+ onChange: handleChange
163
158
  })
164
159
  }), /*#__PURE__*/_jsx("div", {
165
160
  className: "bannerSpaceBoxLeft",
166
161
  children: /*#__PURE__*/_jsx("input", {
167
- type: "number",
162
+ type: "text",
168
163
  name: "left",
169
- className: "borderInput removeScroll",
170
- value: getCustomizationValue(value?.left),
164
+ className: "borderInput",
165
+ value: value?.left,
171
166
  style: {
172
167
  ...squreStyle.topLeft
173
168
  },
174
- onChange: handleChange,
175
- placeholder: "0"
169
+ onChange: handleChange
176
170
  })
177
171
  })]
178
172
  })
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { Grid, Typography, Slider, FormControlLabel, Checkbox, Box } from "@mui/material";
3
3
  import { radiusStyle } from "./radiusStyle";
4
4
  import useWindowResize from "../../../hooks/useWindowResize";
5
- import { getBreakPointsValue, getCustomizationValue } from "../../../helper/theme";
5
+ import { getBreakPointsValue } from "../../../helper/theme";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const BORDER_RADIUS_KEYS = ["topLeft", "topRight", "bottomLeft", "bottomRight"];
@@ -80,13 +80,11 @@ const BorderRadius = props => {
80
80
  }), /*#__PURE__*/_jsx(Box, {
81
81
  sx: classes.sapcingInput,
82
82
  component: "input",
83
- value: !lockRadius ? "" : getCustomizationValue(value?.topLeft),
84
- className: "sliderInput removeScroll",
83
+ value: !lockRadius ? "" : value?.topLeft || 0,
84
+ className: "sliderInput",
85
85
  name: "topLeft",
86
86
  disabled: !lockRadius,
87
- onChange: handleChange,
88
- type: "number",
89
- placeholder: "0"
87
+ onChange: handleChange
90
88
  })]
91
89
  }), /*#__PURE__*/_jsx(FormControlLabel, {
92
90
  className: "ccheckbox-primary",
@@ -127,10 +125,10 @@ const BorderRadius = props => {
127
125
  borderRadius: `${value?.topLeft}px ${value?.topRight}px ${value?.bottomLeft}px ${value?.bottomRight}px`
128
126
  },
129
127
  children: [/*#__PURE__*/_jsx("input", {
130
- type: "number",
128
+ type: "text",
131
129
  name: "topLeft",
132
- value: getCustomizationValue(value?.topLeft),
133
- className: "borderInput removeScroll",
130
+ value: value?.topLeft,
131
+ className: "borderInput",
134
132
  placeholder: "0",
135
133
  style: {
136
134
  ...radiusStyle.topLeft,
@@ -138,10 +136,10 @@ const BorderRadius = props => {
138
136
  },
139
137
  onChange: handleChange
140
138
  }), /*#__PURE__*/_jsx("input", {
141
- type: "number",
139
+ type: "text",
142
140
  name: "topRight",
143
- value: getCustomizationValue(value?.topRight),
144
- className: "borderInput removeScroll",
141
+ value: value?.topRight,
142
+ className: "borderInput",
145
143
  placeholder: "0",
146
144
  style: {
147
145
  ...radiusStyle.topRight,
@@ -150,10 +148,10 @@ const BorderRadius = props => {
150
148
  },
151
149
  onChange: handleChange
152
150
  }), /*#__PURE__*/_jsx("input", {
153
- type: "number",
151
+ type: "text",
154
152
  name: "bottomLeft",
155
- value: getCustomizationValue(value?.bottomLeft),
156
- className: "borderInput removeScroll",
153
+ value: value?.bottomLeft,
154
+ className: "borderInput",
157
155
  placeholder: "0",
158
156
  style: {
159
157
  ...radiusStyle.bottomLeft,
@@ -162,10 +160,10 @@ const BorderRadius = props => {
162
160
  },
163
161
  onChange: handleChange
164
162
  }), /*#__PURE__*/_jsx("input", {
165
- type: "number",
163
+ type: "text",
166
164
  name: "bottomRight",
167
- value: getCustomizationValue(value?.bottomRight),
168
- className: "borderInput removeScroll",
165
+ value: value?.bottomRight,
166
+ className: "borderInput",
169
167
  placeholder: "0",
170
168
  style: {
171
169
  ...radiusStyle.bottomRight,
@@ -12,12 +12,11 @@ const Color = props => {
12
12
  } = props;
13
13
  const {
14
14
  key,
15
- label,
16
- hideGradient
15
+ label
17
16
  } = data;
18
17
  const [recentColors, setRecentColors] = useState({});
19
18
  useEffect(() => {
20
- const storedColors = JSON.parse(localStorage.getItem("recentColors"));
19
+ const storedColors = JSON.parse(localStorage.getItem('recentColors'));
21
20
  if (storedColors) {
22
21
  setRecentColors(storedColors);
23
22
  }
@@ -40,7 +39,7 @@ const Color = props => {
40
39
  [key]: updatedColors
41
40
  };
42
41
  setRecentColors(updatedColors);
43
- localStorage.setItem("recentColors", JSON.stringify(updatedColors));
42
+ localStorage.setItem('recentColors', JSON.stringify(updatedColors));
44
43
  };
45
44
  return /*#__PURE__*/_jsxs(Grid, {
46
45
  item: true,
@@ -69,8 +68,7 @@ const Color = props => {
69
68
  classes: classes,
70
69
  value: value,
71
70
  onSave: onSave,
72
- recentColors: recentColors[key],
73
- hideGradient: hideGradient
71
+ recentColors: recentColors[key]
74
72
  })
75
73
  })
76
74
  }
@@ -855,37 +855,6 @@ export const Carousal = props => /*#__PURE__*/_jsxs("svg", {
855
855
  fill: "#64748B"
856
856
  })]
857
857
  });
858
- export const PageSettings = (props = {}) => /*#__PURE__*/_jsxs("svg", {
859
- width: "16",
860
- height: "16",
861
- viewBox: "0 0 16 16",
862
- fill: "none",
863
- xmlns: "http://www.w3.org/2000/svg",
864
- ...props,
865
- children: [/*#__PURE__*/_jsx("path", {
866
- d: "M13.2386 0.535156H2.76091C2.30289 0.535814 1.86383 0.718051 1.53996 1.04192C1.2161 1.36578 1.03386 1.80485 1.0332 2.26286V11.7453C1.03386 12.2033 1.2161 12.6424 1.53996 12.9663C1.86383 13.2901 2.30289 13.4724 2.76091 13.473H4.29405C4.30918 13.5774 4.3571 13.6743 4.43089 13.7497L5.23503 14.5539C5.3155 14.6344 5.42114 14.6849 5.53434 14.6969C5.64753 14.7089 5.76143 14.6818 5.85704 14.62L6.42979 14.2498C6.5507 14.308 6.67481 14.3594 6.80151 14.4036L6.94482 15.0704C6.96871 15.1816 7.02999 15.2813 7.11846 15.3528C7.20692 15.4243 7.31722 15.4634 7.43099 15.4635H8.56852C8.68229 15.4634 8.79259 15.4243 8.88105 15.3528C8.96952 15.2813 9.0308 15.1816 9.05469 15.0704L9.198 14.4036C9.32471 14.3594 9.44881 14.308 9.56972 14.2498L10.1425 14.62C10.2381 14.6818 10.352 14.7089 10.4652 14.6969C10.5784 14.6849 10.684 14.6344 10.7645 14.5539L11.5686 13.7497C11.6424 13.6743 11.6903 13.5774 11.7055 13.473H13.2386C13.6966 13.4724 14.1357 13.2901 14.4595 12.9663C14.7834 12.6424 14.9657 12.2033 14.9663 11.7453V2.26286C14.9657 1.80485 14.7834 1.36578 14.4595 1.04192C14.1357 0.718051 13.6966 0.535814 13.2386 0.535156ZM2.76091 1.53038H13.2386C13.4328 1.53051 13.6191 1.60772 13.7564 1.74506C13.8937 1.8824 13.971 2.06864 13.9711 2.26286V3.52082H2.02842V2.26286C2.02856 2.06864 2.10577 1.8824 2.24311 1.74506C2.38045 1.60772 2.56668 1.53051 2.76091 1.53038ZM10.345 13.5656L9.8643 13.2546C9.78643 13.2042 9.696 13.1765 9.60323 13.1747C9.51047 13.173 9.41906 13.1972 9.33932 13.2446C9.12471 13.3725 8.89275 13.4687 8.65063 13.5303C8.56076 13.553 8.47904 13.6005 8.41468 13.6672C8.35032 13.7339 8.30588 13.8173 8.28638 13.908L8.16596 14.4683H7.83355L7.71313 13.908C7.69363 13.8173 7.64919 13.7339 7.58483 13.6672C7.52047 13.6005 7.43875 13.553 7.34888 13.5303C7.10676 13.4687 6.8748 13.3725 6.66019 13.2446C6.58045 13.1972 6.48904 13.173 6.39628 13.1747C6.30351 13.1765 6.21308 13.2042 6.13521 13.2546L5.65452 13.5656L5.41915 13.3302L5.73015 12.8495C5.78059 12.7717 5.80825 12.6812 5.81001 12.5885C5.81177 12.4957 5.78755 12.4043 5.7401 12.3246C5.61223 12.1099 5.51603 11.878 5.45448 11.6359C5.4317 11.546 5.38428 11.4643 5.31754 11.3999C5.25081 11.3355 5.16743 11.2911 5.07679 11.2716L4.51648 11.1512V10.8188L5.07679 10.6984C5.16743 10.6789 5.25081 10.6344 5.31754 10.5701C5.38428 10.5057 5.4317 10.424 5.45448 10.3341C5.51603 10.092 5.61223 9.86003 5.7401 9.64542C5.78755 9.56568 5.81177 9.47427 5.81001 9.38151C5.80825 9.28874 5.78059 9.19831 5.73015 9.12044L5.41915 8.63975L5.65452 8.40438L6.13521 8.71538C6.21308 8.76582 6.30351 8.79348 6.39628 8.79524C6.48904 8.797 6.58045 8.77278 6.66019 8.72533C6.8748 8.59746 7.10676 8.50126 7.34888 8.43971C7.43875 8.41693 7.52047 8.36951 7.58483 8.30277C7.64919 8.23604 7.69363 8.15266 7.71313 8.06202L7.83355 7.50171H8.16596L8.28638 8.06202C8.30588 8.15266 8.35032 8.23604 8.41468 8.30277C8.47904 8.36951 8.56076 8.41693 8.65063 8.43971C8.89275 8.50126 9.12471 8.59746 9.33932 8.72533C9.41906 8.77278 9.51047 8.797 9.60323 8.79524C9.696 8.79348 9.78643 8.76582 9.8643 8.71538L10.345 8.40438L10.5804 8.63975L10.2694 9.12044C10.2189 9.19831 10.1913 9.28874 10.1895 9.38151C10.1877 9.47427 10.212 9.56568 10.2594 9.64542C10.3873 9.86003 10.4835 10.092 10.545 10.3341C10.5678 10.424 10.6152 10.5057 10.682 10.5701C10.7487 10.6344 10.8321 10.6789 10.9227 10.6984L11.483 10.8188V11.1512L10.9227 11.2716C10.8321 11.2911 10.7487 11.3355 10.682 11.3999C10.6152 11.4643 10.5678 11.546 10.545 11.6359C10.4835 11.878 10.3873 12.1099 10.2594 12.3246C10.212 12.4043 10.1877 12.4957 10.1895 12.5885C10.1913 12.6812 10.2189 12.7717 10.2694 12.8495L10.5804 13.3302L10.345 13.5656ZM11.7132 12.4001L11.7055 13.473C11.7493 13.3735 11.385 12.2838 11.4198 12.1832L12.0866 12.0399C12.1979 12.016 12.2975 11.9547 12.3691 11.8663C12.4406 11.7778 12.4797 11.6675 12.4797 11.5538V10.4162C12.4797 10.3025 12.4406 10.1921 12.3691 10.1037C12.2975 10.0152 12.1979 9.95394 12.0866 9.93005L11.4198 9.78674C11.3756 9.66004 11.3243 9.53593 11.2661 9.41502L11.6363 8.84227C11.6981 8.74666 11.7252 8.63276 11.7132 8.51957C11.7011 8.40637 11.6506 8.30073 11.5701 8.22026L10.766 7.41612C10.6855 7.33561 10.5799 7.28512 10.4667 7.27307C10.3535 7.26103 10.2396 7.28816 10.144 7.34994L9.57121 7.72016C9.4503 7.66194 9.3262 7.61061 9.1995 7.5664L9.05618 6.8996C9.03229 6.78837 8.97101 6.68869 8.88255 6.61716C8.79408 6.54563 8.68378 6.50657 8.57002 6.50649H7.43099C7.31722 6.50657 7.20692 6.54563 7.11846 6.61716C7.02999 6.68869 6.96871 6.78837 6.94482 6.8996L6.80151 7.5664C6.67481 7.61061 6.5507 7.66194 6.42979 7.72016L5.85704 7.35243C5.76143 7.29065 5.64753 7.26352 5.53434 7.27556C5.42114 7.28761 5.3155 7.3381 5.23503 7.41861L4.43089 8.22026C4.35038 8.30073 4.29989 8.40637 4.28784 8.51957C4.2758 8.63276 4.30293 8.74666 4.36471 8.84227L4.73493 9.41502C4.67671 9.53593 4.62538 9.66004 4.58117 9.78674L3.91437 9.93005C3.80314 9.95394 3.70346 10.0152 3.63193 10.1037C3.5604 10.1921 3.52134 10.3025 3.52126 10.4162V11.5538C3.52134 11.6675 3.5604 11.7778 3.63193 11.8663C3.70346 11.9547 3.80314 12.016 3.91437 12.0399L4.58117 12.1832C4.616 12.2828 4.25026 13.3775 4.29405 13.473V12.5C4.19775 12.5001 2.57072 12.4591 2.48171 12.4224C2.3927 12.3856 2.3118 12.3317 2.24364 12.2637C2.17548 12.1956 2.12138 12.1148 2.08446 12.0259C2.04753 11.937 2.02849 11.8416 2.02842 11.7453V4.51604H13.9711V11.7453C13.971 11.9396 13.8937 12.1258 13.7564 12.2631C13.6191 12.4005 11.9074 12.4 11.7132 12.4001Z",
867
- fill: "#64748A"
868
- }), /*#__PURE__*/_jsx("path", {
869
- d: "M4.29405 13.473H2.76091C2.30289 13.4724 1.86383 13.2901 1.53996 12.9663C1.2161 12.6424 1.03386 12.2033 1.0332 11.7453V2.26286C1.03386 1.80485 1.2161 1.36578 1.53996 1.04192C1.86383 0.718051 2.30289 0.535814 2.76091 0.535156H13.2386C13.6966 0.535814 14.1357 0.718051 14.4595 1.04192C14.7834 1.36578 14.9657 1.80485 14.9663 2.26286V11.7453C14.9657 12.2033 14.7834 12.6424 14.4595 12.9663C14.1357 13.2901 13.6966 13.4724 13.2386 13.473H11.7055M4.29405 13.473C4.30918 13.5774 4.3571 13.6743 4.43089 13.7497L5.23503 14.5539C5.3155 14.6344 5.42114 14.6849 5.53434 14.6969C5.64753 14.7089 5.76143 14.6818 5.85704 14.62L6.42979 14.2498C6.5507 14.308 6.67481 14.3594 6.80151 14.4036L6.94482 15.0704C6.96871 15.1816 7.02999 15.2813 7.11846 15.3528C7.20692 15.4243 7.31722 15.4634 7.43099 15.4635H8.56852C8.68229 15.4634 8.79259 15.4243 8.88105 15.3528C8.96952 15.2813 9.0308 15.1816 9.05469 15.0704L9.198 14.4036C9.32471 14.3594 9.44881 14.308 9.56972 14.2498L10.1425 14.62C10.2381 14.6818 10.352 14.7089 10.4652 14.6969C10.5784 14.6849 10.684 14.6344 10.7645 14.5539L11.5686 13.7497C11.6424 13.6743 11.6903 13.5774 11.7055 13.473M4.29405 13.473C4.25026 13.3775 4.616 12.2828 4.58117 12.1832L3.91437 12.0399C3.80314 12.016 3.70346 11.9547 3.63193 11.8663C3.5604 11.7778 3.52134 11.6675 3.52126 11.5538V10.4162C3.52134 10.3025 3.5604 10.1921 3.63193 10.1037C3.70346 10.0152 3.80314 9.95394 3.91437 9.93005L4.58117 9.78674C4.62538 9.66004 4.67671 9.53593 4.73493 9.41502L4.36471 8.84227C4.30293 8.74666 4.2758 8.63276 4.28784 8.51957C4.29989 8.40637 4.35038 8.30073 4.43089 8.22026L5.23503 7.41861C5.3155 7.3381 5.42114 7.28761 5.53434 7.27556C5.64753 7.26352 5.76143 7.29065 5.85704 7.35243L6.42979 7.72016C6.5507 7.66194 6.67481 7.61061 6.80151 7.5664L6.94482 6.8996C6.96871 6.78837 7.02999 6.68869 7.11846 6.61716C7.20692 6.54563 7.31722 6.50657 7.43099 6.50649H8.57002C8.68378 6.50657 8.79408 6.54563 8.88255 6.61716C8.97101 6.68869 9.03229 6.78837 9.05618 6.8996L9.1995 7.5664C9.3262 7.61061 9.4503 7.66194 9.57121 7.72016L10.144 7.34994C10.2396 7.28816 10.3535 7.26103 10.4667 7.27307C10.5799 7.28512 10.6855 7.33561 10.766 7.41612L11.5701 8.22026C11.6506 8.30073 11.7011 8.40637 11.7132 8.51957C11.7252 8.63276 11.6981 8.74666 11.6363 8.84227L11.2661 9.41502C11.3243 9.53593 11.3756 9.66004 11.4198 9.78674L12.0866 9.93005C12.1979 9.95394 12.2975 10.0152 12.3691 10.1037C12.4406 10.1921 12.4797 10.3025 12.4797 10.4162V11.5538C12.4797 11.6675 12.4406 11.7778 12.3691 11.8663C12.2975 11.9547 12.1979 12.016 12.0866 12.0399L11.4198 12.1832C11.385 12.2838 11.7493 13.3735 11.7055 13.473M4.29405 13.473V12.5C4.19775 12.5001 2.57072 12.4591 2.48171 12.4224C2.3927 12.3856 2.3118 12.3317 2.24364 12.2637C2.17548 12.1956 2.12138 12.1148 2.08446 12.0259C2.04753 11.937 2.02849 11.8416 2.02842 11.7453V4.51604H13.9711V11.7453C13.971 11.9396 13.8937 12.1258 13.7564 12.2631C13.6191 12.4005 11.9074 12.4 11.7132 12.4001L11.7055 13.473M2.76091 1.53038H13.2386C13.4328 1.53051 13.6191 1.60772 13.7564 1.74506C13.8937 1.8824 13.971 2.06864 13.9711 2.26286V3.52082H2.02842V2.26286C2.02856 2.06864 2.10577 1.8824 2.24311 1.74506C2.38045 1.60772 2.56668 1.53051 2.76091 1.53038ZM10.345 13.5656L9.8643 13.2546C9.78643 13.2042 9.696 13.1765 9.60323 13.1747C9.51047 13.173 9.41906 13.1972 9.33932 13.2446C9.12471 13.3725 8.89275 13.4687 8.65063 13.5303C8.56076 13.553 8.47904 13.6005 8.41468 13.6672C8.35032 13.7339 8.30588 13.8173 8.28638 13.908L8.16596 14.4683H7.83355L7.71313 13.908C7.69363 13.8173 7.64919 13.7339 7.58483 13.6672C7.52047 13.6005 7.43875 13.553 7.34888 13.5303C7.10676 13.4687 6.8748 13.3725 6.66019 13.2446C6.58045 13.1972 6.48904 13.173 6.39628 13.1747C6.30351 13.1765 6.21308 13.2042 6.13521 13.2546L5.65452 13.5656L5.41915 13.3302L5.73015 12.8495C5.78059 12.7717 5.80825 12.6812 5.81001 12.5885C5.81177 12.4957 5.78755 12.4043 5.7401 12.3246C5.61223 12.1099 5.51603 11.878 5.45448 11.6359C5.4317 11.546 5.38428 11.4643 5.31754 11.3999C5.25081 11.3355 5.16743 11.2911 5.07679 11.2716L4.51648 11.1512V10.8188L5.07679 10.6984C5.16743 10.6789 5.25081 10.6344 5.31754 10.5701C5.38428 10.5057 5.4317 10.424 5.45448 10.3341C5.51603 10.092 5.61223 9.86003 5.7401 9.64542C5.78755 9.56568 5.81177 9.47427 5.81001 9.38151C5.80825 9.28874 5.78059 9.19831 5.73015 9.12044L5.41915 8.63975L5.65452 8.40438L6.13521 8.71538C6.21308 8.76582 6.30351 8.79348 6.39628 8.79524C6.48904 8.797 6.58045 8.77278 6.66019 8.72533C6.8748 8.59746 7.10676 8.50126 7.34888 8.43971C7.43875 8.41693 7.52047 8.36951 7.58483 8.30277C7.64919 8.23604 7.69363 8.15266 7.71313 8.06202L7.83355 7.50171H8.16596L8.28638 8.06202C8.30588 8.15266 8.35032 8.23604 8.41468 8.30277C8.47904 8.36951 8.56076 8.41693 8.65063 8.43971C8.89275 8.50126 9.12471 8.59746 9.33932 8.72533C9.41906 8.77278 9.51047 8.797 9.60323 8.79524C9.696 8.79348 9.78643 8.76582 9.8643 8.71538L10.345 8.40438L10.5804 8.63975L10.2694 9.12044C10.2189 9.19831 10.1913 9.28874 10.1895 9.38151C10.1877 9.47427 10.212 9.56568 10.2594 9.64542C10.3873 9.86003 10.4835 10.092 10.545 10.3341C10.5678 10.424 10.6152 10.5057 10.682 10.5701C10.7487 10.6344 10.8321 10.6789 10.9227 10.6984L11.483 10.8188V11.1512L10.9227 11.2716C10.8321 11.2911 10.7487 11.3355 10.682 11.3999C10.6152 11.4643 10.5678 11.546 10.545 11.6359C10.4835 11.878 10.3873 12.1099 10.2594 12.3246C10.212 12.4043 10.1877 12.4957 10.1895 12.5885C10.1913 12.6812 10.2189 12.7717 10.2694 12.8495L10.5804 13.3302L10.345 13.5656Z",
870
- stroke: "white",
871
- strokeWidth: "0.1"
872
- }), /*#__PURE__*/_jsx("path", {
873
- d: "M3.52105 3.02257C3.79587 3.02257 4.01866 2.79978 4.01866 2.52495C4.01866 2.25013 3.79587 2.02734 3.52105 2.02734C3.24623 2.02734 3.02344 2.25013 3.02344 2.52495C3.02344 2.79978 3.24623 3.02257 3.52105 3.02257Z",
874
- fill: "#64748A",
875
- stroke: "white",
876
- strokeWidth: "0.1"
877
- }), /*#__PURE__*/_jsx("path", {
878
- d: "M5.01421 3.02257C5.28904 3.02257 5.51182 2.79978 5.51182 2.52495C5.51182 2.25013 5.28904 2.02734 5.01421 2.02734C4.73939 2.02734 4.5166 2.25013 4.5166 2.52495C4.5166 2.79978 4.73939 3.02257 5.01421 3.02257Z",
879
- fill: "#64748A",
880
- stroke: "white",
881
- strokeWidth: "0.1"
882
- }), /*#__PURE__*/_jsx("path", {
883
- d: "M7.99972 8.99414C7.60605 8.99414 7.22122 9.11088 6.89389 9.32959C6.56656 9.5483 6.31144 9.85917 6.16079 10.2229C6.01014 10.5866 5.97072 10.9868 6.04752 11.3729C6.12433 11.759 6.3139 12.1137 6.59227 12.392C6.87063 12.6704 7.2253 12.86 7.61141 12.9368C7.99751 13.0136 8.39773 12.9742 8.76143 12.8235C9.12514 12.6729 9.436 12.4177 9.65472 12.0904C9.87343 11.7631 9.99017 11.3783 9.99017 10.9846C9.99017 10.4567 9.78046 9.95041 9.40718 9.57713C9.0339 9.20385 8.52762 8.99414 7.99972 8.99414ZM7.99972 11.9798C7.80289 11.9798 7.61047 11.9214 7.44681 11.8121C7.28314 11.7027 7.15558 11.5473 7.08026 11.3654C7.00493 11.1836 6.98522 10.9835 7.02362 10.7904C7.06202 10.5974 7.15681 10.42 7.29599 10.2809C7.43518 10.1417 7.61251 10.0469 7.80556 10.0085C7.99862 9.97008 8.19872 9.98979 8.38058 10.0651C8.56243 10.1404 8.71786 10.268 8.82722 10.4317C8.93658 10.5953 8.99494 10.7877 8.99494 10.9846C8.99494 11.2485 8.89009 11.5017 8.70345 11.6883C8.51681 11.875 8.26367 11.9798 7.99972 11.9798Z",
884
- fill: "#64748A",
885
- stroke: "white",
886
- strokeWidth: "0.1"
887
- })]
888
- });
889
858
  export const TextLeftAlign = props => /*#__PURE__*/_jsxs("svg", {
890
859
  xmlns: "http://www.w3.org/2000/svg",
891
860
  width: "24",
@@ -154,26 +154,4 @@ export const debounce = function (func, wait, immediate) {
154
154
  timeout = setTimeout(later, wait);
155
155
  if (callNow) func.apply(context, args);
156
156
  };
157
- };
158
- export const getTextColor = (color = "") => {
159
- return color?.indexOf("gradient") >= 0 ? {
160
- background: color?.concat("text"),
161
- WebkitBackgroundClip: "text",
162
- WebkitTextFillColor: "transparent",
163
- color: "transparent",
164
- caretColor: "black"
165
- } : {
166
- color
167
- };
168
- };
169
- export const getBorderColor = (borderColor = "") => {
170
- const borderStyle = borderColor ? {
171
- border: "1px solid"
172
- } : {};
173
- if (borderColor?.indexOf("gradient") >= 0) {
174
- borderStyle.borderImage = `${borderColor} 1`;
175
- } else {
176
- borderStyle.borderColor = borderColor;
177
- }
178
- return borderStyle;
179
157
  };
@@ -97,5 +97,4 @@ export const getTRBLBreakPoints = (value, breakpoint) => {
97
97
  } catch (err) {
98
98
  console.log(err);
99
99
  }
100
- };
101
- export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
100
+ };
@@ -32,7 +32,7 @@ import FormField from "../Elements/Form/FormField";
32
32
  import InlineIcon from "../Elements/InlineIcon/InlineIcon";
33
33
  import SimpleText from "../Elements/SimpleText";
34
34
  import CheckList from "../Elements/List/CheckList";
35
- import { getTextColor, isEmptyTextNode } from "../helper";
35
+ import { isEmptyTextNode } from "../helper";
36
36
  import Attachments from "../Elements/Attachments/Attachments";
37
37
  import { getBreakPointsValue } from "../helper/theme";
38
38
  import Variables from "../Elements/Variables/Variable";
@@ -203,7 +203,13 @@ export const getMarked = (leaf, children) => {
203
203
  // cover under single span
204
204
  if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || className) {
205
205
  const family = fontFamilyMap[leaf?.fontFamily];
206
- const textStyles = getTextColor(leaf?.color);
206
+ const textStyles = leaf?.color?.indexOf("gradient") >= 0 ? {
207
+ background: leaf?.color?.concat("text"),
208
+ WebkitBackgroundClip: "text",
209
+ WebkitTextFillColor: "transparent"
210
+ } : {
211
+ color: leaf.color
212
+ };
207
213
  children = /*#__PURE__*/_jsx("span", {
208
214
  style: {
209
215
  background: leaf.bgColor
@@ -1,4 +1,4 @@
1
- import { Editor, Transforms, Element, Node, Path } from "slate";
1
+ import { Editor, Transforms, Element, Node, Path, Range } from "slate";
2
2
  import { toggleBlock } from "./SlateUtilityFunctions";
3
3
  import insertNewLine from "./insertNewLine";
4
4
  import { insertAccordion } from "./accordion";
@@ -179,7 +179,6 @@ const checkListEnterEvent = (editor, type) => {
179
179
  export const enterEvent = (e, editor, isMobile) => {
180
180
  try {
181
181
  const ele = isListItem(editor);
182
-
183
182
  // on shift enter break line in same node
184
183
  if (e.shiftKey && !isMobile) {
185
184
  e.preventDefault();
@@ -188,6 +187,7 @@ export const enterEvent = (e, editor, isMobile) => {
188
187
  const {
189
188
  type
190
189
  } = ele[0];
190
+ const path = ele[1];
191
191
  const text = Node.string(ele[0]);
192
192
  switch (type) {
193
193
  case "list-item":
@@ -219,6 +219,58 @@ export const enterEvent = (e, editor, isMobile) => {
219
219
  insertAccordion(editor, nextPath);
220
220
  }
221
221
  break;
222
+ case "headingOne":
223
+ case "headingTwo":
224
+ case "headingThree":
225
+ const {
226
+ selection
227
+ } = editor;
228
+ if (selection && Range.isCollapsed(selection)) {
229
+ const isAtEnd = Editor.isEnd(editor, selection.anchor, path);
230
+ const isAtStart = Editor.isStart(editor, selection.anchor, path);
231
+ if (isAtEnd) {
232
+ e.preventDefault();
233
+ Transforms.insertNodes(editor, {
234
+ type: 'paragraph',
235
+ children: [{
236
+ text: ''
237
+ }]
238
+ });
239
+ const newLocation = Editor.after(editor, selection);
240
+ if (newLocation) {
241
+ Transforms.select(editor, newLocation);
242
+ }
243
+ } else if (!isAtStart) {
244
+ e.preventDefault();
245
+ Transforms.splitNodes(editor);
246
+ Transforms.setNodes(editor, {
247
+ type: 'paragraph'
248
+ }, {
249
+ at: Editor.after(editor, selection)
250
+ });
251
+ const newLocation = Editor.after(editor, selection);
252
+ if (newLocation) {
253
+ Transforms.select(editor, newLocation);
254
+ }
255
+ } else if (isAtStart) {
256
+ e.preventDefault();
257
+ Transforms.insertNodes(editor, {
258
+ type: 'paragraph',
259
+ children: [{
260
+ text: ''
261
+ }]
262
+ }, {
263
+ at: Editor.before(editor, selection)
264
+ });
265
+ Transforms.select(editor, Editor.before(editor, selection));
266
+ const newLocation = Editor.before(editor, selection);
267
+ if (newLocation) {
268
+ Transforms.select(editor, newLocation);
269
+ }
270
+ }
271
+ return;
272
+ }
273
+ break;
222
274
  default:
223
275
  }
224
276
  }
@@ -146,7 +146,7 @@ export const handleInsertLastElement = (event, editor) => {
146
146
  }
147
147
  };
148
148
  export const isListItem = editor => {
149
- const format = ["list-item", "check-list-item", "accordion-summary"];
149
+ const format = ["list-item", "check-list-item", "accordion-summary", "headingOne", "headingTwo", "headingThree"];
150
150
  const [node] = Editor.nodes(editor, {
151
151
  match: n => !Editor.isEditor(n) && Element.isElement(n) && format.indexOf(n.type) > -1
152
152
  });
@@ -95,28 +95,32 @@ export class TableUtil {
95
95
  }
96
96
  };
97
97
  deleteRow = () => {
98
- const {
99
- selection
100
- } = this.editor;
101
- if (!!selection && Range.isCollapsed(selection)) {
102
- const [tableNode] = Editor.nodes(this.editor, {
103
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-row"
104
- });
105
- if (tableNode) {
106
- const [[table, tablePath]] = Editor.nodes(this.editor, {
107
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
108
- });
109
- const [, currentRow] = tableNode;
110
- const path = currentRow;
111
- Transforms.removeNodes(this.editor, {
112
- at: path
113
- });
114
- Transforms.setNodes(this.editor, {
115
- rows: table.rows - 1
116
- }, {
117
- at: tablePath
98
+ try {
99
+ const {
100
+ selection
101
+ } = this.editor;
102
+ if (!!selection && Range.isCollapsed(selection)) {
103
+ const [tableNode] = Editor.nodes(this.editor, {
104
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-row"
118
105
  });
106
+ if (tableNode) {
107
+ const [[table, tablePath]] = Editor.nodes(this.editor, {
108
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
109
+ });
110
+ const [, currentRow] = tableNode;
111
+ const path = currentRow;
112
+ Transforms.removeNodes(this.editor, {
113
+ at: path
114
+ });
115
+ Transforms.setNodes(this.editor, {
116
+ rows: table.rows - 1
117
+ }, {
118
+ at: tablePath
119
+ });
120
+ }
119
121
  }
122
+ } catch (error) {
123
+ console.log("Error", error);
120
124
  }
121
125
  };
122
126
  insertColumn = action => {
@@ -151,34 +155,38 @@ export class TableUtil {
151
155
  }
152
156
  };
153
157
  deleteColumn = () => {
154
- const {
155
- selection
156
- } = this.editor;
157
- if (!!selection && Range.isCollapsed(selection)) {
158
- const [tableNode] = Editor.nodes(this.editor, {
159
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
160
- });
161
- if (tableNode) {
162
- const [[table, tablePath]] = Editor.nodes(this.editor, {
163
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
158
+ try {
159
+ const {
160
+ selection
161
+ } = this.editor;
162
+ if (!!selection && Range.isCollapsed(selection)) {
163
+ const [tableNode] = Editor.nodes(this.editor, {
164
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
164
165
  });
165
- const [, currentCell] = tableNode;
166
- const startPath = currentCell;
166
+ if (tableNode) {
167
+ const [[table, tablePath]] = Editor.nodes(this.editor, {
168
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
169
+ });
170
+ const [, currentCell] = tableNode;
171
+ const startPath = currentCell;
167
172
 
168
- // The last two indices of the path represents the row and column. We need to add one cell to each row starting from the first row
169
- startPath[startPath.length - 2] = 0;
170
- for (let row = 0; row < table.rows; row++) {
171
- Transforms.removeNodes(this.editor, {
172
- at: startPath
173
+ // The last two indices of the path represents the row and column. We need to add one cell to each row starting from the first row
174
+ startPath[startPath.length - 2] = 0;
175
+ for (let row = 0; row < table.rows; row++) {
176
+ Transforms.removeNodes(this.editor, {
177
+ at: startPath
178
+ });
179
+ startPath[startPath.length - 2]++;
180
+ }
181
+ Transforms.setNodes(this.editor, {
182
+ columns: table.columns - 1
183
+ }, {
184
+ at: tablePath
173
185
  });
174
- startPath[startPath.length - 2]++;
175
186
  }
176
- Transforms.setNodes(this.editor, {
177
- columns: table.columns - 1
178
- }, {
179
- at: tablePath
180
- });
181
187
  }
188
+ } catch (error) {
189
+ console.log("Error ", error);
182
190
  }
183
191
  };
184
192
  updateTableStyle = (styleProps, paths) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"
@@ -61,10 +61,10 @@
61
61
  "build": "NODE_OPTIONS='--max_old_space_size=4096' craco build",
62
62
  "test": "craco test --passWithNoTests",
63
63
  "eject": "react-scripts eject",
64
- "storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook dev -p 6006",
64
+ "storybook": "storybook dev -p 6006",
65
65
  "build-storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook build",
66
66
  "publish:npm": "rm -rf dist && mkdir dist && babel src/components -d dist --copy-files",
67
- "publish:local": "rm -rf /Users/agenciflow08/Documents/flozy/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agenciflow08/Documents/flozy/client/node_modules/@flozy/editor/dist --copy-files"
67
+ "publish:local": "rm -rf /Users/agenciflow08/Documents/flozyapp/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agenciflow08/Documents/flozyapp/client/node_modules/@flozy/editor/dist --copy-files"
68
68
  },
69
69
  "eslintConfig": {
70
70
  "extends": [