@flozy/editor 3.9.6 → 3.9.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.
@@ -830,17 +830,6 @@ blockquote {
830
830
  text-align: center;
831
831
  }
832
832
 
833
- .removeScroll::-webkit-outer-spin-button,
834
- .removeScroll::-webkit-inner-spin-button {
835
- -webkit-appearance: none;
836
- margin: 0;
837
- }
838
-
839
- /* For Firefox */
840
- .removeScroll {
841
- -moz-appearance: textfield;
842
- }
843
-
844
833
  .borderInput:focus-visible {
845
834
  outline: none !important;
846
835
  }
@@ -890,7 +879,7 @@ blockquote {
890
879
  }
891
880
 
892
881
  .sliderInput {
893
- width: 30px;
882
+ width: 66px;
894
883
  padding: 2px 10px;
895
884
  margin-left: 18px;
896
885
  box-shadow: 0px 4px 16px 0px #0000000d;
@@ -7,7 +7,6 @@ import DeleteIcon from "@mui/icons-material/Delete";
7
7
  import { GridSettingsIcon } from "../../common/iconslist";
8
8
  import Icon from "../../common/Icon";
9
9
  import { useEditorSelection } from "../../hooks/useMouseMove";
10
- import ArrowRightIcon from "@mui/icons-material/ArrowRight";
11
10
  import { jsx as _jsx } from "react/jsx-runtime";
12
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
12
  const accordionBtnStyleKeys = {
@@ -161,7 +160,7 @@ const Accordion = props => {
161
160
  children: [/*#__PURE__*/_jsxs("div", {
162
161
  className: "accordion-title",
163
162
  style: {
164
- background: bgColor
163
+ backgroundColor: bgColor
165
164
  },
166
165
  onClick: onToggle,
167
166
  children: [/*#__PURE__*/_jsx(Box, {
@@ -1,7 +1,4 @@
1
1
  import React from "react";
2
- import { getBorderColor, getTextColor } from "../../helper";
3
- import { Box } from "@mui/material";
4
- import { getBreakPointsValue, getTRBLBreakPoints } from "../../helper/theme";
5
2
  import { jsx as _jsx } from "react/jsx-runtime";
6
3
  const AccordionSummary = props => {
7
4
  const {
@@ -12,31 +9,18 @@ const AccordionSummary = props => {
12
9
  const {
13
10
  textColor,
14
11
  bgColor,
15
- borderColor,
16
- borderRadius,
17
- bannerSpacing
12
+ borderColor
18
13
  } = element;
19
- const textStyles = getTextColor(textColor);
20
- const borderStyle = getBorderColor(borderColor);
21
- return /*#__PURE__*/_jsx(Box, {
14
+ return /*#__PURE__*/_jsx("div", {
22
15
  className: `accordion-summary-container`,
23
16
  ...attributes,
24
17
  style: {
25
18
  width: "100%",
26
19
  position: "relative",
27
- background: bgColor,
28
- ...borderStyle
20
+ backgroundColor: bgColor,
21
+ border: `1px solid ${borderColor}`,
22
+ color: textColor
29
23
  },
30
- sx: {
31
- borderRadius: {
32
- ...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
33
- },
34
- padding: {
35
- ...getTRBLBreakPoints(bannerSpacing)
36
- },
37
- '& span[data-slate-string="true"]': textStyles
38
- },
39
- component: "div",
40
24
  children: children
41
25
  });
42
26
  };
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { useEffect, useRef, useState } from "react";
2
2
  import { TextField, IconButton } from "@mui/material";
3
3
  import { addMarkData, activeMark, isBlockActive } from "../../utils/SlateUtilityFunctions.js";
4
4
  import { headingMap, sizeMap } from "../../utils/font.js";
@@ -18,6 +18,11 @@ const TextSize = ({
18
18
  const [size] = useWindowResize();
19
19
  const val = activeMark(editor, format);
20
20
  const value = getBreakPointsValue(val, size?.device);
21
+ const [fontSize, setFontSize] = useState();
22
+ const timerRef = useRef();
23
+ useEffect(() => {
24
+ setFontSize(getSizeVal());
25
+ }, [value]);
21
26
  const updateMarkData = newVal => {
22
27
  let upData = {
23
28
  ...getBreakPointsValue(val),
@@ -39,10 +44,14 @@ const TextSize = ({
39
44
  }
40
45
  });
41
46
  };
42
- const onChangeSize = e => {
43
- let inc = parseInt(e.target.value) || 8;
44
- inc = inc > 200 ? 200 : inc;
45
- updateMarkData(inc || 8);
47
+ const onChangeSize = value => {
48
+ if (value) {
49
+ let inc = parseInt(value);
50
+ inc = inc > 200 ? 200 : inc;
51
+ updateMarkData(inc);
52
+ } else {
53
+ setFontSize(null);
54
+ }
46
55
  };
47
56
  const getSizeVal = () => {
48
57
  try {
@@ -67,11 +76,19 @@ const TextSize = ({
67
76
  const newVal = combinedOldVal - 1 < 0 ? 0 : combinedOldVal - 1;
68
77
  updateMarkData(newVal);
69
78
  };
79
+ const onChange = e => {
80
+ clearTimeout(timerRef.current);
81
+ const value = e.target.value;
82
+ setFontSize(value);
83
+ timerRef.current = setTimeout(() => {
84
+ onChangeSize(value);
85
+ }, 500);
86
+ };
70
87
  return /*#__PURE__*/_jsx(_Fragment, {
71
88
  children: /*#__PURE__*/_jsx(TextField, {
72
89
  sx: classes?.textSize,
73
- value: combinedOldVal,
74
- onChange: onChangeSize,
90
+ value: fontSize,
91
+ onChange: onChange,
75
92
  size: "small",
76
93
  inputProps: {
77
94
  style: {
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState } from "react";
2
2
  import { Popper, Fade, Paper, ClickAwayListener } from "@mui/material";
3
3
  import { Editor, Range } from "slate";
4
- import { useSlate, useFocused } from "slate-react";
4
+ import { useSlate } from "slate-react";
5
5
  import useDrag from "../../hooks/useDrag";
6
6
  import { TableUtil } from "../../utils/table";
7
7
  import useWindowResize from "../../hooks/useWindowResize";
@@ -23,7 +23,6 @@ const PopupTool = props => {
23
23
  const [anchorEl, setAnchorEl] = useState(null);
24
24
  const [open, setOpen] = useState(false);
25
25
  const editor = useSlate();
26
- const inFocus = useFocused();
27
26
  const {
28
27
  selection
29
28
  } = editor;
@@ -47,7 +46,7 @@ const PopupTool = props => {
47
46
  }
48
47
  }, [event, anchorEl]);
49
48
  useEffect(() => {
50
- if (!selection || !inFocus || Range.isCollapsed(selection) || Editor.string(editor, selection) === "") {
49
+ if (!selection || Range.isCollapsed(selection) || Editor.string(editor, selection) === "") {
51
50
  setAnchorEl(null);
52
51
  } else {
53
52
  updateAnchorEl();
@@ -1,4 +1,4 @@
1
- import React, { useMemo, useState } from "react";
1
+ import React, { useState } from "react";
2
2
  import { Grid, Button, Popover } from "@mui/material";
3
3
  import ColorPickerTool from "react-gcolor-picker";
4
4
  import { colors } from "../Elements/Color Picker/defaultColors";
@@ -11,8 +11,7 @@ const ColorPickerButton = props => {
11
11
  onSave,
12
12
  defaultColors = [],
13
13
  classes = {},
14
- recentColors = [],
15
- hideGradient
14
+ recentColors = []
16
15
  } = props;
17
16
  const [anchorEl, setAnchorEl] = useState(null);
18
17
  const [color, setColor] = useState(value);
@@ -30,13 +29,6 @@ const ColorPickerButton = props => {
30
29
  const handleColorChange = color => {
31
30
  setColor(color);
32
31
  };
33
- const initialColors = useMemo(() => {
34
- let colors = [...recentColors, ...defaultColors];
35
- if (hideGradient) {
36
- colors = colors.filter(c => c && !c.includes("gradient"));
37
- }
38
- return colors;
39
- }, [recentColors, defaultColors, hideGradient]);
40
32
  return /*#__PURE__*/_jsxs(_Fragment, {
41
33
  children: [/*#__PURE__*/_jsx(Button, {
42
34
  style: {
@@ -69,10 +61,10 @@ const ColorPickerButton = props => {
69
61
  xs: 12,
70
62
  children: [/*#__PURE__*/_jsx("div", {
71
63
  children: /*#__PURE__*/_jsx(ColorPickerTool, {
72
- gradient: hideGradient ? false : true,
64
+ gradient: true,
73
65
  value: color,
74
66
  onChange: handleColorChange,
75
- defaultColors: initialColors
67
+ defaultColors: [...recentColors, ...defaultColors] || []
76
68
  })
77
69
  }), /*#__PURE__*/_jsxs("div", {
78
70
  style: {
@@ -5,8 +5,7 @@ const accordionTitleBtnStyle = [{
5
5
  label: "Accordion Color",
6
6
  key: "accordionTextColor",
7
7
  type: "color",
8
- needPreview: true,
9
- hideGradient: true
8
+ needPreview: true
10
9
  }, {
11
10
  label: "Accordion Background Color",
12
11
  key: "accordionBgColor",
@@ -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
  }
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "3.9.6",
3
+ "version": "3.9.7",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"
@@ -64,7 +64,7 @@
64
64
  "storybook": "NODE_OPTIONS='--max_old_space_size=4096' 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": [