@flozy/editor 5.9.2 → 5.9.3

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 (59) hide show
  1. package/dist/Editor/CommonEditor.js +11 -6
  2. package/dist/Editor/Editor.css +22 -16
  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/Components/Select.js +8 -14
  7. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +5 -1
  8. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +5 -1
  9. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +23 -19
  10. package/dist/Editor/Elements/Form/Form.js +1 -0
  11. package/dist/Editor/Elements/FreeGrid/styles.js +1 -0
  12. package/dist/Editor/Elements/Grid/GridItem.js +1 -2
  13. package/dist/Editor/Elements/Link/Link.js +70 -43
  14. package/dist/Editor/Elements/List/CheckList.js +2 -1
  15. package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
  16. package/dist/Editor/Elements/Search/SearchList.js +8 -1
  17. package/dist/Editor/Elements/SimpleText/index.js +8 -1
  18. package/dist/Editor/Elements/SimpleText/style.js +5 -1
  19. package/dist/Editor/Elements/Table/Table.js +3 -3
  20. package/dist/Editor/Elements/Table/TableCell.js +14 -9
  21. package/dist/Editor/Elements/Title/title.js +13 -1
  22. package/dist/Editor/Elements/Variables/Style.js +28 -2
  23. package/dist/Editor/Elements/Variables/VariableButton.js +17 -4
  24. package/dist/Editor/MiniEditor.js +4 -2
  25. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +37 -28
  26. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +3 -1
  27. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
  28. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +3 -1
  29. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +1 -1
  30. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +9 -3
  31. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +5 -0
  32. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
  33. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
  34. package/dist/Editor/Toolbar/PopupTool/index.js +2 -0
  35. package/dist/Editor/common/FontLoader/FontList.js +3 -11
  36. package/dist/Editor/common/FontLoader/FontLoader.js +72 -53
  37. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
  38. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
  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/common/iconslist.js +1 -2
  46. package/dist/Editor/commonStyle.js +58 -57
  47. package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
  48. package/dist/Editor/helper/index.js +2 -2
  49. package/dist/Editor/helper/theme.js +24 -1
  50. package/dist/Editor/hooks/useMouseMove.js +5 -2
  51. package/dist/Editor/plugins/withLayout.js +1 -1
  52. package/dist/Editor/utils/SlateUtilityFunctions.js +10 -4
  53. package/dist/Editor/utils/button.js +4 -4
  54. package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
  55. package/dist/Editor/utils/draftToSlate.js +3 -2
  56. package/dist/Editor/utils/helper.js +60 -19
  57. package/dist/Editor/utils/pageSettings.js +14 -2
  58. package/dist/Editor/utils/table.js +21 -0
  59. package/package.json +1 -1
@@ -1,9 +1,11 @@
1
1
  import { useEffect, useState } from "react";
2
2
  import WebFont from "webfontloader";
3
- import { Backdrop, CircularProgress } from "@mui/material";
4
3
  import { useEditorContext } from "../../hooks/useMouseMove";
5
- 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";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { Fragment as _Fragment } from "react/jsx-runtime";
7
9
  const FontLoader = props => {
8
10
  const {
9
11
  otherProps,
@@ -12,67 +14,72 @@ const FontLoader = props => {
12
14
  const {
13
15
  setFontFamilies
14
16
  } = useEditorContext();
15
- const [loader, setLoader] = useState(true);
17
+ const [loading, setLoading] = useState(true);
16
18
  const loadFontsInBatches = (families, batchSize = 5, maxRetries = 3) => {
17
19
  let currentIndex = 0;
18
20
  let retryCount = 0;
19
- function loadNextBatch() {
20
- if (currentIndex >= families?.length) {
21
- // console.log("All fonts have been loaded");
22
- setLoader(false);
23
- return;
24
- }
25
- const batch = families?.slice(currentIndex, currentIndex + batchSize);
26
- const batchWithWeights = batch.map(font => `${font}:300,400,600,700`);
27
- WebFont.load({
28
- google: {
29
- families: [...batchWithWeights]
30
- },
31
- classes: false,
32
- timeout: 2000,
33
- active: () => {
34
- // console.log(`Fonts loaded successfully: ${batch}`);
35
- currentIndex += batchSize;
36
- retryCount = 0; // Reset retry count for the next batch
37
- loadNextBatch();
38
- },
39
- inactive: () => {
40
- // console.log(`Font loading failed for: ${batch}`);
41
-
42
- if (retryCount < maxRetries) {
43
- retryCount++;
44
- // console.log(`Retrying batch (${retryCount}/${maxRetries})...`);
45
- // Retry loading the same batch
46
- loadNextBatch();
47
- } else {
48
- console.log(
49
- // `Max retries reached for batch: ${batch}. Moving to the next batch.`
50
- );
21
+ let hideLoaderOn = 30;
22
+ const loadNextBatch = () => {
23
+ try {
24
+ if (currentIndex >= families?.length) {
25
+ // console.log("All fonts have been loaded");
26
+ setLoading(false);
27
+ return;
28
+ }
29
+ const batch = families?.slice(currentIndex, currentIndex + batchSize);
30
+ const batchWithWeights = batch.map(font => `${font}:300,400,600,700`);
31
+ WebFont.load({
32
+ google: {
33
+ families: [...batchWithWeights]
34
+ },
35
+ classes: false,
36
+ timeout: 2000,
37
+ active: () => {
38
+ // console.log(`Fonts loaded successfully: ${batch}`);
51
39
  currentIndex += batchSize;
52
40
  retryCount = 0; // Reset retry count for the next batch
53
41
  loadNextBatch();
42
+ },
43
+ inactive: () => {
44
+ // console.log(`Font loading failed for: ${batch}`);
45
+ if (retryCount < maxRetries) {
46
+ retryCount++;
47
+ // console.log(`Retrying batch (${retryCount}/${maxRetries})...`);
48
+ // Retry loading the same batch
49
+ loadNextBatch();
50
+ } else {
51
+ // console.log(
52
+ // `Max retries reached for batch: ${batch}. Moving to the next batch.`
53
+ // );
54
+ currentIndex += batchSize;
55
+ retryCount = 0;
56
+ loadNextBatch();
57
+ }
54
58
  }
55
- }
56
- });
57
- }
59
+ });
60
+ } catch (err) {
61
+ setLoading(false);
62
+ }
63
+ };
58
64
  loadNextBatch();
59
65
  };
60
66
  useEffect(() => {
61
- let families = [...otherFonts, ...defaultFonts];
67
+ let families = [...googleFontList];
62
68
  if (!readOnly) {
63
69
  otherProps?.services("listGoogleFont", []).then(data => {
64
- families = [...families, ...(data?.data || [])];
65
- const filteredfamilies = families?.filter(font => !font?.includes("Material"));
70
+ families = [...(data?.data || [])];
66
71
  setFontFamilies({
67
72
  id: 1,
68
73
  format: "fontFamily",
69
74
  type: "fontfamilydropdown",
70
- options: filteredfamilies || []
75
+ options: families || []
71
76
  });
72
77
  loadFontsInBatches(families);
73
78
  }).catch(err => {
74
- console.log(err);
79
+ // console.log(err);
80
+ setLoading(false);
75
81
  });
82
+ // setLoading(true);
76
83
  } else {
77
84
  function correctFontArray(fontString) {
78
85
  let fontsArray = fontString.split(",");
@@ -92,20 +99,32 @@ const FontLoader = props => {
92
99
  let families = Array.from(fontSet);
93
100
  families = correctFontArray(families.join(", "));
94
101
  families = families?.map(font => font?.replace(/\"/g, ""));
95
- families = families?.map(font => font?.replace(", sans-serif", "")); //This is temporary fix for patch
102
+ families = families?.map(font => font?.replace(", sans-serif", ""));
96
103
  families = families.filter(font => googleFontList.includes(font));
97
104
  loadFontsInBatches(families);
98
105
  }
106
+
107
+ // Set timeout to hide loader after 5 seconds
108
+ const timeoutId = setTimeout(() => {
109
+ setLoading(false);
110
+ }, 5000);
111
+ return () => clearTimeout(timeoutId);
99
112
  }, []);
100
- return /*#__PURE__*/_jsx(Backdrop, {
101
- open: loader,
102
- sx: {
103
- color: "#fff",
104
- zIndex: 9999 // Ensure it's above other UI elements
105
- },
106
- children: /*#__PURE__*/_jsx(CircularProgress, {
107
- color: "inherit"
108
- })
113
+ return /*#__PURE__*/_jsx(_Fragment, {
114
+ children: loading ? /*#__PURE__*/_jsx(Box, {
115
+ sx: {
116
+ position: "absolute",
117
+ top: 0,
118
+ left: 0,
119
+ right: 0,
120
+ bottom: 0,
121
+ zIndex: 99999,
122
+ display: "flex",
123
+ justifyContent: "center",
124
+ alignItems: "center"
125
+ },
126
+ children: /*#__PURE__*/_jsx(CircularProgress, {})
127
+ }) : null
109
128
  });
110
129
  };
111
130
  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": {
@@ -3,24 +3,35 @@ 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";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
9
  const SwitchViewport = props => {
9
10
  const {
10
11
  breakpoint,
11
- onChange
12
+ onChange,
13
+ show
12
14
  } = props;
13
15
  const classes = useSwitchViewport();
16
+ const {
17
+ setSelectedElement,
18
+ setActiveBreakPoint
19
+ } = useEditorContext();
14
20
  useEffect(() => {
15
- console.log(breakpoint);
21
+ // to reset selection on viewport changes - FS-6589
22
+ setSelectedElement({});
16
23
  }, [breakpoint]);
17
24
  return /*#__PURE__*/_jsxs(Box, {
18
25
  sx: classes.root,
26
+ style: {
27
+ display: show ? "block" : "none"
28
+ },
19
29
  children: [/*#__PURE__*/_jsx(Tooltip, {
20
30
  title: "Desktop View",
21
31
  children: /*#__PURE__*/_jsx(IconButton, {
22
32
  className: `${!breakpoint || breakpoint === "lg" ? "active" : ""}`,
23
33
  onClick: () => {
34
+ setActiveBreakPoint("");
24
35
  onChange("");
25
36
  },
26
37
  children: /*#__PURE__*/_jsx(PersonalVideoIcon, {})
@@ -30,6 +41,7 @@ const SwitchViewport = props => {
30
41
  children: /*#__PURE__*/_jsx(IconButton, {
31
42
  className: `${breakpoint === "xs" ? "active" : ""}`,
32
43
  onClick: () => {
44
+ setActiveBreakPoint("xs");
33
45
  onChange("xs");
34
46
  },
35
47
  children: /*#__PURE__*/_jsx(PhoneIphoneIcon, {})
@@ -73,6 +73,11 @@ const BackgroundImage = props => {
73
73
  children: "REMOVE"
74
74
  }) : /*#__PURE__*/_jsx(Grid, {
75
75
  className: "uploadImageText",
76
+ sx: {
77
+ padding: 0,
78
+ background: `${theme?.palette?.editor?.inputFieldBgColor}`,
79
+ border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
80
+ },
76
81
  children: /*#__PURE__*/_jsxs(Button, {
77
82
  component: "label",
78
83
  variant: "text",
@@ -1,6 +1,7 @@
1
1
  import { Box, Card, Checkbox, FormControlLabel, Grid, Tooltip, Typography } from "@mui/material";
2
2
  import React from "react";
3
3
  import Icon from "../../Icon";
4
+ import { useEditorContext } from "../../../hooks/useMouseMove";
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  import { Fragment as _Fragment } from "react/jsx-runtime";
6
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -15,7 +16,10 @@ const RenderCard = ({
15
16
  return /*#__PURE__*/_jsx(Card, {
16
17
  sx: {
17
18
  position: 'relative',
18
- padding: "10px"
19
+ padding: "10px",
20
+ '& .MuiCheckbox-root svg': {
21
+ fill: 'unset !important'
22
+ }
19
23
  },
20
24
  children: /*#__PURE__*/_jsx(FormControlLabel, {
21
25
  control: /*#__PURE__*/_jsx(Checkbox, {
@@ -81,6 +85,9 @@ const CardsMapping = props => {
81
85
  selectedCard,
82
86
  infoIcon
83
87
  } = data;
88
+ const {
89
+ theme
90
+ } = useEditorContext();
84
91
  const activeCard = value === selectedCard;
85
92
  const handleChange = e => {
86
93
  if (selectedCard === data?.value) {
@@ -99,7 +106,8 @@ const CardsMapping = props => {
99
106
  sx: {
100
107
  marginBottom: "12px",
101
108
  "& .MuiPaper-root": {
102
- border: activeCard ? "1px solid #2563EB" : "1px solid #C8D8FA",
109
+ background: theme?.palette?.editor?.miniToolBarBackground,
110
+ border: activeCard ? "1px solid #2563EB" : `1px solid ${theme?.palette?.editor?.inputFieldBorder}`,
103
111
  borderRadius: "8px",
104
112
  boxShadow: activeCard ? "0px 4px 16px 0px #2563EB40" : "unset"
105
113
  }
@@ -18,6 +18,7 @@ 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";
21
22
  const FieldMap = {
22
23
  text: Text,
23
24
  bannerSpacing: BannerSpacing,
@@ -38,6 +39,7 @@ const FieldMap = {
38
39
  fontSize: FontSize,
39
40
  selectSwitch: SelectSwitch,
40
41
  card: CardsMapping,
41
- metadatamapping: MetaDataMapping
42
+ metadatamapping: MetaDataMapping,
43
+ lineSpacing: LineSpacing
42
44
  };
43
45
  export default FieldMap;
@@ -0,0 +1,79 @@
1
+ import React, { useState } from "react";
2
+ import { Grid, Slider, Typography, Box } from "@mui/material";
3
+ import { getBreakPointsValue } from "../../../helper/theme";
4
+ import useWindowResize from "../../../hooks/useWindowResize";
5
+ import { useEditorContext } from "../../../hooks/useMouseMove";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ const LineSpacing = props => {
9
+ const {
10
+ value: val,
11
+ data,
12
+ onChange
13
+ } = props;
14
+ const {
15
+ theme
16
+ } = useEditorContext();
17
+ const {
18
+ key
19
+ } = data;
20
+ const [size] = useWindowResize();
21
+ const pro_value = getBreakPointsValue(val, size?.device);
22
+ const [value, setValue] = useState(pro_value);
23
+ let breakpointValue = getBreakPointsValue(val, null);
24
+ breakpointValue = typeof breakpointValue['lg'] === 'object' ? breakpointValue['lg'] : breakpointValue;
25
+ useState(() => {
26
+ setValue(pro_value);
27
+ }, [pro_value]);
28
+ const handleChange = e => {
29
+ onChange({
30
+ [key]: {
31
+ ...breakpointValue,
32
+ [size?.device]: e.target.value
33
+ }
34
+ });
35
+ };
36
+ return /*#__PURE__*/_jsxs(Grid, {
37
+ item: true,
38
+ xs: 12,
39
+ children: [/*#__PURE__*/_jsx(Typography, {
40
+ variant: "body1",
41
+ color: "primary",
42
+ style: {
43
+ fontSize: "14px",
44
+ fontWeight: 500
45
+ },
46
+ children: data?.label
47
+ }), /*#__PURE__*/_jsxs(Grid, {
48
+ container: true,
49
+ wrap: "nowrap",
50
+ className: "sld-wrpr",
51
+ children: [/*#__PURE__*/_jsx(Slider, {
52
+ className: "spacingSlider",
53
+ defaultValue: value || 1.43,
54
+ "aria-label": "Default",
55
+ valueLabelDisplay: "auto",
56
+ min: 0.5,
57
+ max: 3.0,
58
+ step: 0.1,
59
+ name: "lineHeight",
60
+ onChange: handleChange
61
+ }), /*#__PURE__*/_jsx(Box, {
62
+ component: "input",
63
+ sx: {
64
+ background: theme?.palette?.editor?.background,
65
+ color: theme?.palette?.editor?.textColor
66
+ },
67
+ name: "lineHeight",
68
+ value: pro_value,
69
+ className: "sliderInput",
70
+ onChange: handleChange,
71
+ type: "number",
72
+ placeholder: "0",
73
+ disabled: true,
74
+ defaultValue: pro_value || 1.43
75
+ })]
76
+ })]
77
+ });
78
+ };
79
+ export default LineSpacing;
@@ -25,6 +25,10 @@ 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"
28
32
  }]
29
33
  }, {
30
34
  tab: "Max Width",
@@ -4,6 +4,7 @@ import { convertBase64 } from "../utils/helper";
4
4
  import { uploadFile } from "../service/fileupload";
5
5
  import Icon from "./Icon";
6
6
  import UploadStyles from "../common/ImageSelector/UploadStyles";
7
+ import { useEditorContext } from "../hooks/useMouseMove";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  import { Fragment as _Fragment } from "react/jsx-runtime";
9
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -18,6 +19,9 @@ const Uploader = props => {
18
19
  const [base64, setBase64] = useState(value?.url);
19
20
  const [fileName, setFileName] = useState("");
20
21
  const [uploading, setUploading] = useState(false);
22
+ const {
23
+ theme
24
+ } = useEditorContext();
21
25
  const handleChange = async e => {
22
26
  const uFile = e.target.files[0];
23
27
  const strImage = await convertBase64(uFile);
@@ -99,6 +103,10 @@ const Uploader = props => {
99
103
  className: "uploadImageSection",
100
104
  children: base64 ? renderThumb() : /*#__PURE__*/_jsx(Grid, {
101
105
  className: "uploadImageText",
106
+ sx: {
107
+ background: `${theme?.palette?.editor?.inputFieldBgColor}`,
108
+ border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
109
+ },
102
110
  children: /*#__PURE__*/_jsxs(Button, {
103
111
  component: "label",
104
112
  variant: "text",
@@ -1654,13 +1654,12 @@ export const CsvIcon = () => /*#__PURE__*/_jsxs("svg", {
1654
1654
  fill: "white"
1655
1655
  })]
1656
1656
  });
1657
- export const CloseIcon = props => /*#__PURE__*/_jsxs("svg", {
1657
+ export const CloseIcon = () => /*#__PURE__*/_jsxs("svg", {
1658
1658
  width: "20",
1659
1659
  height: "20",
1660
1660
  viewBox: "0 0 20 20",
1661
1661
  fill: "none",
1662
1662
  xmlns: "http://www.w3.org/2000/svg",
1663
- ...(props || {}),
1664
1663
  children: [/*#__PURE__*/_jsx("path", {
1665
1664
  d: "M14.1245 5.875L5.87493 14.1246",
1666
1665
  stroke: "#64748B",
@@ -49,15 +49,19 @@ 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
+ padding: "2px"
57
+ },
52
58
  "& p": {
53
59
  marginBottom: "7px",
54
60
  marginTop: "4px"
55
61
  },
56
- "& .MuiPaper-root": {
57
- border: 'unset !important',
58
- borderRadius: '0px',
59
- height: 'fit-content',
60
- padding: '2px'
62
+ "& p": {
63
+ marginBottom: "7px",
64
+ marginTop: "4px"
61
65
  },
62
66
  "& .muiIconsListParent": {
63
67
  "& svg": {
@@ -71,15 +75,12 @@ const useCommonStyle = theme => ({
71
75
  },
72
76
  "&::-webkit-scrollbar-thumb": {
73
77
  background: `${theme?.palette?.editor?.brainPopupScroll} !important`
74
- },
75
- "&::-webkit-scrollbar-track": {
76
- visibility: "hidden"
77
78
  }
78
79
  },
79
80
  "& .MuiGrid-root>.MuiGrid-item": {
80
81
  paddingRight: "0px !important",
81
82
  fontFamily: "Inter, sans-serif",
82
- height: 'fit-content'
83
+ height: "fit-content"
83
84
  },
84
85
  "& .MuiInputBase-root": {
85
86
  borderRadius: "10px",
@@ -140,11 +141,11 @@ const useCommonStyle = theme => ({
140
141
  borderRadius: "10px",
141
142
  width: "46px !important",
142
143
  marginLeft: "10px",
143
- height: '36px !important'
144
+ height: "36px !important"
144
145
  }
145
146
  },
146
- '& .MuiFormHelperText-root': {
147
- margin: '4px 0px 0px 0px',
147
+ "& .MuiFormHelperText-root": {
148
+ margin: "4px 0px 0px 0px",
148
149
  color: theme?.palette?.editor?.closeButtonSvgStroke,
149
150
  fontFamily: "Inter, sans-serif"
150
151
  }
@@ -400,14 +401,14 @@ const useCommonStyle = theme => ({
400
401
  padding: "8px 12px",
401
402
  fontSize: "12px",
402
403
  color: theme?.palette?.editor?.menuOptionTextColor,
403
- fontWeight: '500',
404
+ fontWeight: "500",
404
405
  fontFamily: "Inter, sans-serif",
405
- minHeight: '36px',
406
+ minHeight: "36px",
406
407
  "&:hover": {
407
408
  backgroundColor: theme?.palette?.editor?.menuOptionHoverBackground
408
409
  }
409
410
  },
410
- '& .Mui-selected': {
411
+ "& .Mui-selected": {
411
412
  background: `${theme?.palette?.editor?.menuOptionSelectedOption} !important`
412
413
  },
413
414
  "& .MuiListSubheader-root": {
@@ -416,16 +417,16 @@ const useCommonStyle = theme => ({
416
417
  fontSize: "12px"
417
418
  },
418
419
  "& .MuiPaper-root": {
419
- borderRadius: '8px',
420
- padding: '0px',
420
+ borderRadius: "8px",
421
+ padding: "0px",
421
422
  background: `${theme?.palette?.editor?.textWeightPopUpBackground} !important`
422
423
  },
423
- '& .MuiButtonBase-root': {
424
- margin: '4px',
425
- borderRadius: '6px'
424
+ "& .MuiButtonBase-root": {
425
+ margin: "4px",
426
+ borderRadius: "6px"
426
427
  },
427
- '& .MuiList-root': {
428
- padding: '0px'
428
+ "& .MuiList-root": {
429
+ padding: "0px"
429
430
  }
430
431
  },
431
432
  datePicker: {
@@ -470,27 +471,27 @@ const useCommonStyle = theme => ({
470
471
  }
471
472
  }
472
473
  },
473
- pageSettingPopUpRoot: {
474
- padding: "16px 8px 16px 10px!important",
475
- height: "100%"
476
- },
477
474
  buttonMoreOption: {
478
475
  background: `${theme?.palette?.editor?.aiInputBackground} !important`,
479
476
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
480
- padding: '4px !important',
481
- '& svg': {
482
- width: '18px !important',
483
- height: '18px !important',
484
- '& path': {
477
+ padding: "4px !important",
478
+ "& svg": {
479
+ width: "18px !important",
480
+ height: "18px !important",
481
+ "& path": {
485
482
  stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
486
483
  }
487
484
  }
488
485
  },
486
+ pageSettingPopUpRoot: {
487
+ padding: "16px 8px 16px 10px!important",
488
+ height: "100%"
489
+ },
489
490
  buttonMoreOption2: {
490
491
  background: `${theme?.palette?.editor?.aiInputBackground} !important`,
491
492
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
492
- '& svg': {
493
- '& path': {
493
+ "& svg": {
494
+ "& path": {
494
495
  fill: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
495
496
  }
496
497
  }
@@ -498,11 +499,11 @@ const useCommonStyle = theme => ({
498
499
  buttonMoreOption3: {
499
500
  background: `${theme?.palette?.editor?.aiInputBackground} !important`,
500
501
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
501
- padding: '5px !important',
502
- '& svg': {
503
- width: '16px !important',
504
- height: '16px !important',
505
- '& path': {
502
+ padding: "5px !important",
503
+ "& svg": {
504
+ width: "16px !important",
505
+ height: "16px !important",
506
+ "& path": {
506
507
  stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
507
508
  }
508
509
  }
@@ -510,37 +511,37 @@ const useCommonStyle = theme => ({
510
511
  resizeButton: {
511
512
  background: theme?.palette?.editor?.aiInputBackground,
512
513
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1}`,
513
- padding: '5px !important',
514
- borderRadius: '50% !important',
515
- '& svg': {
516
- width: '18px',
517
- height: '18px',
518
- '& path': {
514
+ padding: "5px !important",
515
+ borderRadius: "50% !important",
516
+ "& svg": {
517
+ width: "18px",
518
+ height: "18px",
519
+ "& path": {
519
520
  fill: `${theme?.palette?.editor?.closeButtonSvgStroke}`
520
521
  }
521
522
  },
522
- '&:hover': {
523
+ "&:hover": {
523
524
  background: theme?.palette?.editor?.aiInputBackground
524
525
  }
525
526
  },
526
527
  gradientFillBtn: {
527
528
  background: `linear-gradient(112.61deg, #2C63ED 19.3%, #8360FD 88.14%) !important`,
528
- textTransform: 'math-auto !important',
529
- color: '#FFFFFF !important',
530
- padding: '0px 12px !important',
531
- height: '32px',
532
- borderRadius: '8px',
533
- fontWeight: '500',
534
- fontSize: '14px'
529
+ textTransform: "math-auto !important",
530
+ color: "#FFFFFF !important",
531
+ padding: "0px 12px !important",
532
+ height: "32px",
533
+ borderRadius: "8px",
534
+ fontWeight: "500",
535
+ fontSize: "14px"
535
536
  },
536
537
  emptyThumbBtn: {
537
538
  background: `${theme?.palette?.editor?.sectionSettingIconHover} !important`,
538
539
  color: `${theme?.palette?.editor?.textColor} !important`,
539
- fontSize: '14px !important',
540
- '& svg': {
541
- width: '20px !important',
542
- height: '20px !important',
543
- '& path': {
540
+ fontSize: "14px !important",
541
+ "& svg": {
542
+ width: "20px !important",
543
+ height: "20px !important",
544
+ "& path": {
544
545
  stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
545
546
  }
546
547
  }
@@ -0,0 +1,28 @@
1
+ export const ensureWrappedVariables = content => {
2
+ return content.map(node => {
3
+ if (node.children) {
4
+ return {
5
+ ...node,
6
+ children: node.children.reduce((result, child, index, arr) => {
7
+ if (child.type === "variables") {
8
+ if (index === 0 || !arr[index - 1].text || arr[index - 1].text.trim() === "") {
9
+ result.push({
10
+ text: ""
11
+ });
12
+ }
13
+ result.push(child);
14
+ if (index === arr.length - 1 || !arr[index + 1]?.text || arr[index + 1]?.text.trim() === "") {
15
+ result.push({
16
+ text: ""
17
+ });
18
+ }
19
+ } else {
20
+ result.push(child);
21
+ }
22
+ return result;
23
+ }, [])
24
+ };
25
+ }
26
+ return node;
27
+ });
28
+ };