@flozy/editor 5.8.5 → 5.8.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 (61) hide show
  1. package/dist/Editor/CommonEditor.js +11 -6
  2. package/dist/Editor/Editor.css +30 -15
  3. package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
  4. package/dist/Editor/Elements/Button/EditorButton.js +3 -1
  5. package/dist/Editor/Elements/DataView/DataView.js +4 -3
  6. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +5 -1
  7. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +5 -1
  8. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +23 -19
  9. package/dist/Editor/Elements/Form/Form.js +1 -0
  10. package/dist/Editor/Elements/FreeGrid/styles.js +1 -0
  11. package/dist/Editor/Elements/Grid/GridItem.js +1 -2
  12. package/dist/Editor/Elements/Link/Link.js +42 -31
  13. package/dist/Editor/Elements/List/CheckList.js +2 -1
  14. package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
  15. package/dist/Editor/Elements/Search/SearchList.js +8 -1
  16. package/dist/Editor/Elements/SimpleText/index.js +8 -1
  17. package/dist/Editor/Elements/SimpleText/style.js +5 -1
  18. package/dist/Editor/Elements/Table/Table.js +3 -3
  19. package/dist/Editor/Elements/Table/TableCell.js +14 -9
  20. package/dist/Editor/Elements/Title/title.js +13 -1
  21. package/dist/Editor/Elements/Variables/Style.js +28 -2
  22. package/dist/Editor/Elements/Variables/VariableButton.js +17 -4
  23. package/dist/Editor/MiniEditor.js +4 -2
  24. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +37 -28
  25. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +3 -1
  26. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
  27. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +3 -1
  28. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +1 -1
  29. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +9 -3
  30. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +5 -0
  31. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
  32. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
  33. package/dist/Editor/Toolbar/PopupTool/index.js +2 -0
  34. package/dist/Editor/common/FontLoader/FontList.js +3 -11
  35. package/dist/Editor/common/FontLoader/FontLoader.js +37 -11
  36. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
  37. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
  38. package/dist/Editor/common/Section/index.js +39 -29
  39. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  40. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  41. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  42. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
  43. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
  44. package/dist/Editor/common/Uploader.js +8 -0
  45. package/dist/Editor/commonStyle.js +58 -57
  46. package/dist/Editor/helper/deserialize/index.js +18 -5
  47. package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
  48. package/dist/Editor/helper/index.js +2 -2
  49. package/dist/Editor/helper/markdown.js +45 -0
  50. package/dist/Editor/helper/theme.js +24 -1
  51. package/dist/Editor/hooks/useMouseMove.js +5 -2
  52. package/dist/Editor/plugins/withHTML.js +8 -1
  53. package/dist/Editor/plugins/withLayout.js +1 -1
  54. package/dist/Editor/utils/SlateUtilityFunctions.js +41 -4
  55. package/dist/Editor/utils/button.js +4 -4
  56. package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
  57. package/dist/Editor/utils/draftToSlate.js +3 -2
  58. package/dist/Editor/utils/helper.js +60 -19
  59. package/dist/Editor/utils/pageSettings.js +14 -2
  60. package/dist/Editor/utils/table.js +21 -0
  61. package/package.json +3 -2
@@ -50,6 +50,7 @@ const TableCell = props => {
50
50
  const {
51
51
  readOnly
52
52
  } = customProps;
53
+ const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
53
54
  const {
54
55
  bgColor,
55
56
  borderColor,
@@ -247,20 +248,24 @@ const TableCell = props => {
247
248
  isDragging: false
248
249
  });
249
250
  };
250
- const tbProps = tableResizing || resizing || over || readOnly ? {
251
- ...commonTdProps,
252
- contentEditable: false
251
+ const eventProps = isMobile ? {
252
+ // mobile events for selection
253
+ onTouchStart: onMouseDownInCell,
254
+ onTouchMove: handleTouchMove,
255
+ onTouchEnd: handleTouchEnd
253
256
  } : {
254
- ...commonTdProps,
255
257
  onMouseEnter: () => onMouseEnter(path),
256
258
  onMouseLeave,
257
259
  onMouseDown: onMouseDownInCell,
258
260
  onMouseUp,
259
- onClick,
260
- // mobile events for selection
261
- onTouchStart: onMouseDownInCell,
262
- onTouchMove: handleTouchMove,
263
- onTouchEnd: handleTouchEnd
261
+ onClick
262
+ };
263
+ const tbProps = tableResizing || resizing || over || readOnly ? {
264
+ ...commonTdProps,
265
+ contentEditable: false
266
+ } : {
267
+ ...commonTdProps,
268
+ ...eventProps
264
269
  };
265
270
  const dndProps = {
266
271
  id: cellId,
@@ -1,12 +1,24 @@
1
1
  import React from "react";
2
+ import { Text } from "slate";
2
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
+ const isEmptyTextNode = node => {
5
+ if (Text.isText(node)) {
6
+ return !node.text.trim();
7
+ }
8
+ return false;
9
+ };
3
10
  const Title = props => {
4
11
  const {
12
+ element,
5
13
  attributes,
6
- children
14
+ children,
15
+ customProps
7
16
  } = props;
17
+ const isEmpty = !customProps?.readOnly && isEmptyTextNode(element?.children[0]) ? "empty" : "";
8
18
  return /*#__PURE__*/_jsx("div", {
9
19
  ...attributes,
20
+ placeholder: "Title",
21
+ className: `content-editable ${isEmpty}`,
10
22
  style: {
11
23
  fontWeight: "bold",
12
24
  fontSize: "20px"
@@ -1,4 +1,4 @@
1
- const VariableStyles = () => ({
1
+ const VariableStyles = theme => ({
2
2
  variablesItem: {
3
3
  color: "#2563EB",
4
4
  background: "#EEEEEE"
@@ -37,8 +37,34 @@ const VariableStyles = () => ({
37
37
  "& .MuiMenuItem-root": {
38
38
  color: "#64748B"
39
39
  },
40
+ "& .MuiPaper-root": {
41
+ borderRadius: '8px',
42
+ backgroundColor: `${theme?.palette?.editor?.miniToolBarBackground} !important`,
43
+ marginTop: '5px',
44
+ "@media only screen and (max-width: 599px)": {
45
+ padding: '10px 0px'
46
+ }
47
+ },
48
+ "& .MuiList-root": {
49
+ padding: '0px'
50
+ },
51
+ "& .MuiButtonBase-root": {
52
+ margin: '6px',
53
+ borderRadius: '8px',
54
+ padding: '6px 14px',
55
+ fontSize: '14px',
56
+ fontWeight: '400',
57
+ color: theme?.palette?.editor?.deletePopUpButtonTextColor,
58
+ "&:hover": {
59
+ background: `${theme?.palette?.editor?.menuOptionHoverBackground} !important`
60
+ },
61
+ "@media only screen and (max-width: 599px)": {
62
+ minHeight: '30px',
63
+ margin: '0px 6px'
64
+ }
65
+ },
40
66
  "& .Mui-selected": {
41
- backgroundColor: "rgba(0, 0, 0, 0.04) !important"
67
+ backgroundColor: 'unset !important'
42
68
  }
43
69
  }
44
70
  });
@@ -3,11 +3,15 @@ import { useSlateStatic } from "slate-react";
3
3
  import { MenuItem, Select } from "@mui/material";
4
4
  import { insertVariables } from "../../utils/variables";
5
5
  import VariableStyles from "./Style";
6
- import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
6
+ import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
7
+ import { useEditorContext } from "../../hooks/useMouseMove";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
10
  const VariableButton = props => {
10
- const classes = VariableStyles();
11
+ const {
12
+ theme
13
+ } = useEditorContext();
14
+ const classes = VariableStyles(theme);
11
15
  const editor = useSlateStatic();
12
16
  const {
13
17
  options
@@ -24,13 +28,14 @@ const VariableButton = props => {
24
28
  value: "",
25
29
  sx: classes.variableBtn,
26
30
  onChange: updateVariable,
27
- IconComponent: () => /*#__PURE__*/_jsx(KeyboardArrowDownIcon, {}),
31
+ IconComponent: () => /*#__PURE__*/_jsx(KeyboardArrowDownRoundedIcon, {}),
28
32
  MenuProps: {
29
33
  sx: classes.variableMenuItem,
30
34
  PaperProps: {
31
35
  style: {
32
36
  maxHeight: 300,
33
- overflowY: "auto"
37
+ overflowY: "auto",
38
+ transformOrigin: 'top left'
34
39
  },
35
40
  sx: {
36
41
  "&::-webkit-scrollbar-track": {
@@ -40,6 +45,14 @@ const VariableButton = props => {
40
45
  borderRadius: "16px"
41
46
  }
42
47
  }
48
+ },
49
+ anchorOrigin: {
50
+ vertical: 'bottom',
51
+ horizontal: 'right'
52
+ },
53
+ transformOrigin: {
54
+ vertical: 'top',
55
+ horizontal: 'right'
43
56
  }
44
57
  },
45
58
  children: [/*#__PURE__*/_jsx(MenuItem, {
@@ -11,6 +11,7 @@ import withCommon from "./hooks/withCommon";
11
11
  import { serializeToText } from "./utils/serializeToText";
12
12
  import "./Editor.css";
13
13
  import { EditorProvider } from "./hooks/useMouseMove";
14
+ import { ensureWrappedVariables } from "./helper/ensureWrappedVariables";
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
17
  const MiniEditor = props => {
@@ -36,7 +37,8 @@ const MiniEditor = props => {
36
37
  needLayout: false
37
38
  }));
38
39
  const [isInteracted, setIsInteracted] = useState(false);
39
- const [value, setValue] = useState(content);
40
+ const updatedContent = ensureWrappedVariables(content);
41
+ const [value, setValue] = useState(ensureWrappedVariables(updatedContent));
40
42
  const [deboundedValue] = useDebounce(value, 500);
41
43
  const isReadOnly = readOnly === "readonly";
42
44
  const customProps = {
@@ -149,7 +151,7 @@ const MiniEditor = props => {
149
151
  theme: theme,
150
152
  children: /*#__PURE__*/_jsxs(Slate, {
151
153
  editor: editor,
152
- initialValue: content,
154
+ initialValue: updatedContent,
153
155
  onChange: onChange,
154
156
  children: [/*#__PURE__*/_jsx(BasicToolbar, {
155
157
  ...props,
@@ -4,6 +4,7 @@ import TemplateCard from "./TemplateCard";
4
4
  import FullViewCard from "./FullViewCard";
5
5
  import ButtonTemplateCard from "./ButtonTemplatesCard";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { Fragment as _Fragment } from "react/jsx-runtime";
7
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
9
  const CATEGORIES_SORT_INDEX = {
9
10
  Brief: 1,
@@ -46,7 +47,7 @@ const ProgressBar = ({
46
47
  alignItems: "center",
47
48
  margin: 0,
48
49
  padding: 0,
49
- height: "50px",
50
+ height: "300px",
50
51
  overflow: "hidden"
51
52
  },
52
53
  children: /*#__PURE__*/_jsx(CircularProgress, {})
@@ -69,41 +70,49 @@ const AddTemplates = props => {
69
70
  const [categories, setCategories] = useState([]);
70
71
  const [category, setCategory] = useState("");
71
72
  const [templates, setTemplates] = useState([]);
72
- const [filteredTemplates, setFilteredTemplates] = useState([]);
73
73
  useEffect(() => {
74
- getTemplatesList();
74
+ getCategoryList();
75
75
  }, []);
76
- const sortCategory = (a, b) => {
77
- return (CATEGORIES_SORT_INDEX[a] || Infinity) - (CATEGORIES_SORT_INDEX[b] || Infinity);
76
+ const getCategoryList = async () => {
77
+ setLoading(true);
78
+ const categoryDB = await services("listCategory");
79
+ if (categoryDB?.data?.Template?.length > 0) {
80
+ setCategories(categoryDB.data.Template);
81
+ setCategory(categoryDB.data.Template[0]);
82
+ getTemplatesList(categoryDB.data.Template[0]);
83
+ }
84
+ setLoading(false);
78
85
  };
79
- const getTemplatesList = async () => {
86
+ const getTemplatesList = async selectedCategory => {
80
87
  setLoading(true);
81
- const result = await services("listTemplates", {});
82
- const tempList = result?.data?.filter(f => f.type === "Template");
83
- const lic = tempList?.reduce((a, b) => {
84
- if (a.indexOf(b.category) < 0) {
85
- a.push(b.category);
86
- }
87
- return a;
88
- }, []).sort(sortCategory);
89
- const ft = tempList?.filter(f => f.category === lic[0]);
90
- setTemplates(tempList);
91
- setCategories(lic);
92
- setCategory(lic[0]);
93
- setFilteredTemplates(ft);
88
+ const result = await services("listTemplates", {
89
+ category: selectedCategory
90
+ });
91
+ setTemplates(result?.data || []);
94
92
  setLoading(false);
95
93
  };
96
94
  const handleChange = (event, newValue) => {
95
+ setTemplates([]);
97
96
  onSearch("");
98
97
  setCategory(newValue);
99
- setFilteredTemplates(templates.filter(f => f.category === newValue));
98
+ getTemplatesList(newValue);
100
99
  };
101
- const onSelectTemplate = card => () => {
100
+ const onSelectTemplate = card => async () => {
102
101
  try {
103
- editor.insertNode(JSON.parse(card.content));
102
+ const {
103
+ data
104
+ } = await services("templateContent", {
105
+ id: card?.id
106
+ });
107
+ const content = data?.content;
108
+ if (content) {
109
+ editor.insertNode(JSON.parse(content));
110
+ } else {
111
+ console.log("No data found");
112
+ }
104
113
  onClose();
105
114
  } catch (err) {
106
- console.log(err);
115
+ console.log("Error inserting template content into editor:", err);
107
116
  }
108
117
  };
109
118
  const filterByTitle = f => {
@@ -173,16 +182,16 @@ const AddTemplates = props => {
173
182
  data: categories,
174
183
  handleChange: handleChange
175
184
  })
176
- }), /*#__PURE__*/_jsxs(Grid, {
185
+ }), /*#__PURE__*/_jsx(Grid, {
177
186
  container: true,
178
187
  spacing: 0,
179
188
  className: `${fullScreen ? "fullscreen" : ""}`,
180
189
  sx: classes.templateCardsWrpr,
181
- children: [/*#__PURE__*/_jsx(ProgressBar, {
190
+ children: loading ? /*#__PURE__*/_jsx(ProgressBar, {
182
191
  loading: loading
183
- }), filteredTemplates.filter(filterByTitle).map(m => {
184
- return renderTemplate(m);
185
- })]
192
+ }) : /*#__PURE__*/_jsx(_Fragment, {
193
+ children: templates.filter(filterByTitle).map(renderTemplate)
194
+ })
186
195
  })]
187
196
  });
188
197
  };
@@ -51,7 +51,8 @@ const alignmentOptions = [{
51
51
  }];
52
52
  function SelectAlignment({
53
53
  editor,
54
- classes
54
+ classes,
55
+ closeMainPopup
55
56
  }) {
56
57
  const selected = useMemo(() => {
57
58
  return alignmentOptions.find(t => isBlockActive(editor, t.value));
@@ -59,6 +60,7 @@ function SelectAlignment({
59
60
  const onChange = (format, option) => {
60
61
  if (option.type === "block") {
61
62
  toggleBlock(editor, format);
63
+ closeMainPopup();
62
64
  }
63
65
  };
64
66
  return /*#__PURE__*/_jsx(CustomSelectTool, {
@@ -59,7 +59,7 @@ function SelectFontSize({
59
59
  size = value;
60
60
  }
61
61
  });
62
- return parseInt(size);
62
+ return isNaN(parseInt(size)) ? 14 : parseInt(size);
63
63
  } catch (err) {
64
64
  return "";
65
65
  }
@@ -68,7 +68,8 @@ const listOptions = [{
68
68
  }];
69
69
  function SelectList({
70
70
  editor,
71
- classes
71
+ classes,
72
+ closeMainPopup
72
73
  }) {
73
74
  const selectedList = useMemo(() => {
74
75
  return listOptions.find(t => isBlockActive(editor, t.value));
@@ -79,6 +80,7 @@ function SelectList({
79
80
  } else if (option.type === "accordion") {
80
81
  insertAccordion(editor);
81
82
  }
83
+ closeMainPopup();
82
84
  };
83
85
  return /*#__PURE__*/_jsx(CustomSelectTool, {
84
86
  options: listOptions,
@@ -125,7 +125,6 @@ function SelectTypography({
125
125
  ...upData
126
126
  }
127
127
  });
128
- closeMainPopup();
129
128
  };
130
129
  const selectedBlock = useMemo(() => {
131
130
  return typographyOptions.find(t => {
@@ -167,6 +166,7 @@ function SelectTypography({
167
166
  const [sizeInNumber] = size.split("px");
168
167
  updateMarkData(Number(sizeInNumber));
169
168
  }
169
+ closeMainPopup();
170
170
  };
171
171
  return /*#__PURE__*/_jsx(CustomSelectTool, {
172
172
  options: typographyOptions,
@@ -14,6 +14,7 @@ import MiniColorPicker from "./MiniColorPicker";
14
14
  import SelectAlignment from "./SelectAlignment";
15
15
  import SelectFontSize from "./SelectFontSize";
16
16
  import InfinityAITool from "./InfinityAITool";
17
+ import { viewSlateSelection } from "../../../utils/helper";
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
18
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
20
  const DEFAULT_COLOR = {
@@ -60,13 +61,15 @@ const MiniTextFormat = props => {
60
61
  className: "verticalLine"
61
62
  }), /*#__PURE__*/_jsx(SelectList, {
62
63
  classes: classes,
63
- editor: editor
64
+ editor: editor,
65
+ closeMainPopup: closeMainPopup
64
66
  }), /*#__PURE__*/_jsx("div", {
65
67
  className: "verticalLine mr-1"
66
68
  }), /*#__PURE__*/_jsx(SelectAlignment, {
67
69
  fontAlign: fontAlign,
68
70
  classes: classes,
69
- editor: editor
71
+ editor: editor,
72
+ closeMainPopup: closeMainPopup
70
73
  }), /*#__PURE__*/_jsx("div", {
71
74
  className: "verticalLine mr-1"
72
75
  }), /*#__PURE__*/_jsx(SelectFontSize, {
@@ -98,7 +101,10 @@ const MiniTextFormat = props => {
98
101
  editor: editor,
99
102
  customProps: customProps
100
103
  }, link.id), /*#__PURE__*/_jsx(IconButton, {
101
- onClick: e => setAnchorEl(document.getElementById("mini-text-editor-wrapper")),
104
+ onClick: e => {
105
+ viewSlateSelection();
106
+ setAnchorEl(document.getElementById("mini-text-editor-wrapper"));
107
+ },
102
108
  className: `textSettingsIcon ${open ? "btnActive" : ""}`,
103
109
  children: /*#__PURE__*/_jsx(TextToolIcon, {})
104
110
  }), /*#__PURE__*/_jsx(Popper, {
@@ -416,6 +416,11 @@ const usePopupStyle = theme => ({
416
416
  "& .MuiOutlinedInput-notchedOutline": {
417
417
  border: `1px solid ${theme?.palette?.editor?.inputFieldBorder} !important`
418
418
  },
419
+ '& .MuiInputBase-root': {
420
+ '& input': {
421
+ border: "none !important"
422
+ }
423
+ },
419
424
  "& svg": {
420
425
  width: "20px",
421
426
  height: "24px"
@@ -47,7 +47,7 @@ const TemplateCard = props => {
47
47
  }), /*#__PURE__*/_jsx(CardMedia, {
48
48
  className: `template-card-media ${fullScreen ? "fullscreen" : ""}`,
49
49
  component: "div",
50
- image: m?.thumbnail,
50
+ image: m?.compressedThum || m?.thumbnail,
51
51
  alt: m?.title,
52
52
  sx: classes.templateCardMedia
53
53
  }), /*#__PURE__*/_jsx(PreviewAndSelect, {
@@ -14,6 +14,8 @@ import SelectSuperSubscript from "./MiniTextFormat/SelectSuperSubscript";
14
14
  import { ColorResetIcon, TextDefaultStyleIcon } from "../../common/iconListV2";
15
15
  import FontFamilyAutocomplete from "../FormatTools/FontFamilyAutocomplete";
16
16
  import { useEditorContext } from "../../hooks/useMouseMove";
17
+ import LineSpacing from "../../common/StyleBuilder/fieldTypes/lineSpacing";
18
+ import { getPageSettings } from "../../utils/pageSettings";
17
19
  import { jsx as _jsx } from "react/jsx-runtime";
18
20
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
21
  const allTools = toolbarGroups.flat();
@@ -31,10 +33,18 @@ const TextFormat = props => {
31
33
  const [anchorEl, setAnchorEl] = useState(null);
32
34
  const [type, setType] = useState(null);
33
35
  const open = Boolean(anchorEl);
36
+ const {
37
+ element: pageSt
38
+ } = getPageSettings(editor) || {};
39
+ const pageSettingLine = pageSt?.pageProps?.lineHeight;
34
40
  const {
35
41
  fontFamilies,
36
42
  theme
37
43
  } = useEditorContext();
44
+ const {
45
+ activeBreakPoint
46
+ } = useEditorContext();
47
+ const breakpoint = activeBreakPoint === "" ? "lg" : activeBreakPoint;
38
48
  const fontWeight = allTools.find(f => f.format === "fontWeight");
39
49
  const fontStyle = allTools.filter(f => f.type === "mark" && f.format !== "strikethrough" && f.format !== "superscript" && f.format !== "subscript");
40
50
  const fontAlign = allTools.filter(f => f.format?.indexOf("align") >= 0);
@@ -51,6 +61,8 @@ const TextFormat = props => {
51
61
  color: "",
52
62
  bgColor: ""
53
63
  };
64
+ let lineSpacingValue = activeMark(editor, 'lineHeight');
65
+ lineSpacingValue = lineSpacingValue?.[breakpoint] !== undefined ? lineSpacingValue : pageSettingLine;
54
66
  const handleColorPicker = type => e => {
55
67
  setType(type);
56
68
  setAnchorEl(e.currentTarget);
@@ -91,6 +103,13 @@ const TextFormat = props => {
91
103
  value
92
104
  });
93
105
  };
106
+ const handleLineSpacing = data => {
107
+ const [[format, value]] = Object.entries(data);
108
+ addMarkData(editor, {
109
+ format,
110
+ value
111
+ });
112
+ };
94
113
  return /*#__PURE__*/_jsxs(Grid, {
95
114
  container: true,
96
115
  sx: classes.textFormatWrapper,
@@ -360,6 +379,32 @@ const TextFormat = props => {
360
379
  xs: 12,
361
380
  sx: classes.dividerGrid,
362
381
  children: /*#__PURE__*/_jsx(Divider, {})
382
+ }), /*#__PURE__*/_jsxs(Grid, {
383
+ item: true,
384
+ xs: 12,
385
+ children: [/*#__PURE__*/_jsx(Typography, {
386
+ variant: "body1",
387
+ color: "primary",
388
+ sx: classes.typoLabel,
389
+ children: "Line Spacing"
390
+ }), /*#__PURE__*/_jsx(Grid, {
391
+ item: true,
392
+ xs: 12,
393
+ className: "typo-icons",
394
+ sx: classes.evenSpace,
395
+ children: /*#__PURE__*/_jsx(LineSpacing, {
396
+ value: lineSpacingValue,
397
+ onChange: handleLineSpacing,
398
+ data: {
399
+ key: 'lineHeight'
400
+ }
401
+ })
402
+ })]
403
+ }), /*#__PURE__*/_jsx(Grid, {
404
+ item: true,
405
+ xs: 12,
406
+ sx: classes.dividerGrid,
407
+ children: /*#__PURE__*/_jsx(Divider, {})
363
408
  }), /*#__PURE__*/_jsx(Grid, {
364
409
  item: true,
365
410
  xs: 12,
@@ -9,6 +9,7 @@ import { useEditorContext } from "../../hooks/useMouseMove";
9
9
  import usePopupStyles from "../PopupTool/PopupToolStyle";
10
10
  import useEditorScroll from "../../hooks/useEditorScroll";
11
11
  import { isCarouselSelected } from "../../helper";
12
+ import { hideSlateSelection } from "../../utils/helper";
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  const PopupTool = props => {
14
15
  const {
@@ -83,6 +84,7 @@ const PopupTool = props => {
83
84
  setAnchorEl(null);
84
85
  } else {
85
86
  updateAnchorEl();
87
+ hideSlateSelection(); // removes slate selection background, when there is no selection
86
88
  }
87
89
  }, [selection]);
88
90
  useEffect(() => {
@@ -1,11 +1,3 @@
1
- export const defaultFonts = [
2
- // "EB Garamond",
3
- "Anton", "DM Serif Text", "Libre Baskerville", "Montserrat", "Open Sans", "Public Sans", "Raleway", "Space Mono", "Great Vibes", "Zeyada", "Allura", "Pinyon Script", "Dancing Script", "Gaegu", "Kite One", "Merriweather"];
4
- export const otherFonts = ["PoppinsRegular", "PoppinsBold", "Monaco", "Qwitcher Grypen", "Bulgarian Garamond", "Redacted Script", "Herr Von Muellerhoff", "Dawning of a New Day", "Coming Soon", "Engagement", "Ingrid Darling", "La Belle Aurore", "Mea Culpa", "The Girl Next Door", "Helvetica", "Georgia", "Times New Roman", "Courier New", "Impact"];
5
- export const googleFontList = ["Roboto", "Noto Sans JP", "Poppins", "Lato", "Inter", "Roboto Condensed", "Roboto Mono", "Oswald", "Noto Sans", "Nunito", "Nunito Sans", "Ubuntu", "Rubik", "Playfair Display", "Noto Sans KR", "Roboto Slab", "PT Sans", "Kanit", "Work Sans", "Lora", "DM Sans", "Mulish", "Quicksand", "Fira Sans", "Noto Sans TC", "Inconsolata", "Barlow", "Manrope", "IBM Plex Sans", "PT Serif", "Karla", "Titillium Web", "Heebo", "Noto Serif", "Nanum Gothic", "Noto Color Emoji", "Agdasima", "Bebas Neue", "Libre Franklin", "Mukta", "Outfit", "Josefin Sans", "Source Code Pro", "Jost", "Space Grotesk", "Hind Siliguri", "Arimo", "Cabin", "Barlow Condensed", "Dosis", "Fira Sans Condensed", "Bitter", "Archivo", "Figtree", "Noto Serif JP", "PT Sans Narrow", "Abel", "Noto Sans SC",
6
- // "Source Sans 3",
7
- "Hind",
8
- // "Exo 2",
9
- "Teko", "Oxygen", "Cairo", "Crimson Text", "Plus Jakarta Sans", "Overpass", "Pacifico", "Prompt", "Red Hat Display", "Varela Round", "Cormorant Garamond", "Assistant", "Comfortaa", "Lexend", "Signika Negative",
10
- // "M PLUS Rounded 1c",
11
- "Fjalla One", "Caveat", "IBM Plex Mono", "Arvo", "Lobster", "Schibsted Grotesk", "Chakra Petch", "Maven Pro", "Sora", "Kalam", "Onest", "Space Grotesk", "Outfit", 'Titillium Web', ...defaultFonts];
1
+ const otherFonts = ["PoppinsRegular", "PoppinsBold", "Qwitcher Grypen", "Bulgarian Garamond", "Redacted Script", "Herr Von Muellerhoff", "Dawning of a New Day", "Coming Soon", "Engagement", "Ingrid Darling", "La Belle Aurore", "Mea Culpa", "The Girl Next Door"];
2
+ const mostUsedGoogleFonts = ["Roboto", "Poppins", "Lato", "Inter", "Nunito", "Ubuntu", "Oswald", "Rubik", "Roboto Slab", "PT Sans", "Work Sans", "Lora", "Mulish", "DM Sans", "Fira Sans", "Quicksand", "Barlow", "Manrope", "IBM Plex Sans", "PT Serif", "Libre Franklin", "Bebas Neue", "Cabin", "Titillium Web", "Heebo", "Noto Serif", "Jost", "Source Code Pro", "Josefin Sans", "Dosis", "Fira Sans Condensed", "Archivo", "Noto Serif JP", "Crimson Text", "Cairo", "Pacifico", "Red Hat Display", "Assistant", "Comfortaa", "Lexend", "Fjalla One", "Caveat", "Arvo", "Lobster", "Schibsted Grotesk", "EB Garamond", "Sora", "Kalam", "Onest", "Space Grotesk", "Outfit", "Plus Jakarta Sans"];
3
+ export const googleFontList = [...mostUsedGoogleFonts, ...otherFonts];
@@ -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,14 +14,20 @@ const FontLoader = props => {
10
14
  const {
11
15
  setFontFamilies
12
16
  } = useEditorContext();
17
+ const [loading, setLoading] = useState(false);
13
18
  const loadFontsInBatches = (families, batchSize = 5, maxRetries = 3) => {
14
19
  let currentIndex = 0;
15
20
  let retryCount = 0;
21
+ let hideLoaderOn = 30;
16
22
  function loadNextBatch() {
17
23
  if (currentIndex >= families?.length) {
18
24
  // console.log("All fonts have been loaded");
25
+ setLoading(false);
19
26
  return;
20
27
  }
28
+ if (currentIndex >= hideLoaderOn) {
29
+ setLoading(false);
30
+ }
21
31
  const batch = families?.slice(currentIndex, currentIndex + batchSize);
22
32
  const batchWithWeights = batch.map(font => `${font}:300,400,600,700`);
23
33
  WebFont.load({
@@ -41,9 +51,9 @@ const FontLoader = props => {
41
51
  // Retry loading the same batch
42
52
  loadNextBatch();
43
53
  } else {
44
- console.log(
45
- // `Max retries reached for batch: ${batch}. Moving to the next batch.`
46
- );
54
+ // console.log(
55
+ // `Max retries reached for batch: ${batch}. Moving to the next batch.`
56
+ // );
47
57
  currentIndex += batchSize;
48
58
  retryCount = 0; // Reset retry count for the next batch
49
59
  loadNextBatch();
@@ -54,21 +64,21 @@ const FontLoader = props => {
54
64
  loadNextBatch();
55
65
  };
56
66
  useEffect(() => {
57
- let families = [...otherFonts, ...defaultFonts];
67
+ let families = [...googleFontList];
58
68
  if (!readOnly) {
59
69
  otherProps?.services("listGoogleFont", []).then(data => {
60
- families = [...families, ...(data?.data || [])];
61
- const filteredfamilies = families?.filter(font => !font?.includes("Material"));
70
+ families = [...(data?.data || [])];
62
71
  setFontFamilies({
63
72
  id: 1,
64
73
  format: "fontFamily",
65
74
  type: "fontfamilydropdown",
66
- options: filteredfamilies || []
75
+ options: families || []
67
76
  });
68
77
  loadFontsInBatches(families);
69
78
  }).catch(err => {
70
- console.log(err);
79
+ // console.log(err);
71
80
  });
81
+ // setLoading(true);
72
82
  } else {
73
83
  function correctFontArray(fontString) {
74
84
  let fontsArray = fontString.split(",");
@@ -90,9 +100,25 @@ const FontLoader = props => {
90
100
  families = families?.map(font => font?.replace(/\"/g, ""));
91
101
  families = families?.map(font => font?.replace(", sans-serif", "")); //This is temporary fix for patch
92
102
  families = families.filter(font => googleFontList.includes(font));
103
+ // setLoading(true);
93
104
  loadFontsInBatches(families);
94
105
  }
95
106
  }, []);
96
- return null;
107
+ return /*#__PURE__*/_jsx(_Fragment, {
108
+ children: loading ? /*#__PURE__*/_jsx(Box, {
109
+ sx: {
110
+ position: 'absolute',
111
+ top: 0,
112
+ left: 0,
113
+ right: 0,
114
+ bottom: 0,
115
+ zIndex: 99999,
116
+ display: 'flex',
117
+ justifyContent: 'center',
118
+ alignItems: 'center'
119
+ },
120
+ children: /*#__PURE__*/_jsx(CircularProgress, {})
121
+ }) : null
122
+ });
97
123
  };
98
124
  export default FontLoader;
@@ -62,6 +62,7 @@ const FormSettings = props => {
62
62
  MuiAccordion: {
63
63
  styleOverrides: {
64
64
  root: {
65
+ background: theme?.palette?.editor?.miniToolBarBackground,
65
66
  "& .MuiAccordionSummary-root": {
66
67
  flexDirection: "row-reverse",
67
68
  "& .MuiSvgIcon-root": {