@flozy/editor 5.9.1 → 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 (61) hide show
  1. package/dist/Editor/CommonEditor.js +22 -15
  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 +13 -11
  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 +31 -37
  35. package/dist/Editor/common/FontLoader/FontList.js +3 -11
  36. package/dist/Editor/common/FontLoader/FontLoader.js +75 -43
  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/Section/index.js +78 -97
  40. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  41. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  42. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  43. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
  44. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
  45. package/dist/Editor/common/Uploader.js +8 -0
  46. package/dist/Editor/common/iconslist.js +1 -2
  47. package/dist/Editor/commonStyle.js +58 -57
  48. package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
  49. package/dist/Editor/helper/index.js +2 -2
  50. package/dist/Editor/helper/theme.js +24 -1
  51. package/dist/Editor/hooks/useEditorScroll.js +1 -1
  52. package/dist/Editor/hooks/useMouseMove.js +5 -2
  53. package/dist/Editor/plugins/withLayout.js +1 -1
  54. package/dist/Editor/utils/SlateUtilityFunctions.js +15 -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 +2 -2
@@ -1,5 +1,5 @@
1
- import React, { useCallback, useEffect, useState } from "react";
2
- import { Popper, Fade, Paper, ClickAwayListener } from "@mui/material";
1
+ import React, { useEffect, useState } from "react";
2
+ import { Popper, Paper, ClickAwayListener } from "@mui/material";
3
3
  import { Editor, Range, Transforms } from "slate";
4
4
  import { ReactEditor, useSlate } from "slate-react";
5
5
  import useDrag from "../../hooks/useDrag";
@@ -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 {
@@ -20,7 +21,8 @@ const PopupTool = props => {
20
21
  const classes = usePopupStyles(theme);
21
22
  const {
22
23
  setPopupType,
23
- openAI
24
+ openAI,
25
+ selectedElement
24
26
  } = useEditorContext();
25
27
  const [anchorEl, setAnchorEl] = useState(null);
26
28
  const [open, setOpen] = useState(false);
@@ -31,13 +33,10 @@ const PopupTool = props => {
31
33
  const [event] = useDrag(anchorEl);
32
34
  const id = open ? "popup-edit-tool" : "";
33
35
  const [size] = useWindowResize();
34
- const {
35
- selectedElement
36
- } = useEditorContext();
37
- const updateAnchorEl = useCallback(() => {
36
+ const updateAnchorEl = isScroll => {
38
37
  try {
39
38
  const isHavingSelection = selection && !Range.isCollapsed(selection);
40
- if (isHavingSelection) {
39
+ if (isHavingSelection && event === "end") {
41
40
  const domRange = ReactEditor.toDOMRange(editor, editor.selection);
42
41
  const editorContainer = document.querySelector("#slate-wrapper-scroll-container")?.getBoundingClientRect();
43
42
  const rect = domRange.getBoundingClientRect();
@@ -46,16 +45,21 @@ const PopupTool = props => {
46
45
  rect.y = -500; // hide the popper
47
46
  }
48
47
 
49
- setAnchorEl({
50
- clientWidth: rect.width,
51
- clientHeight: rect.height,
52
- getBoundingClientRect: () => rect
53
- });
48
+ // Create a dummy anchor element to match Popper's requirements
49
+ const anchor = document.createElement("div");
50
+ anchor.style.position = "absolute";
51
+ anchor.style.top = `${rect.top + window.scrollY}px`;
52
+ anchor.style.left = `${rect.left + window.scrollX}px`;
53
+ document.body.appendChild(anchor);
54
+ if (!anchorEl || isScroll === "scroll") {
55
+ setAnchorEl(anchor);
56
+ setOpen(true);
57
+ }
54
58
  }
55
59
  } catch (err) {
56
60
  console.log(err);
57
61
  }
58
- }, [selection]);
62
+ };
59
63
  useEditorScroll(editorWrapper, updateAnchorEl);
60
64
  useEffect(() => {
61
65
  const userStoppedSelection = size?.device === "xs" ? true : event === "end"; // for mobile, when user starts the selection, we are gonna show the popup tool
@@ -79,17 +83,13 @@ const PopupTool = props => {
79
83
  }
80
84
  }, [event, anchorEl]);
81
85
  useEffect(() => {
82
- if (!selection || Range.isCollapsed(selection) || Editor.string(editor, selection) === "") {
86
+ if (!selection || Range.isCollapsed(selection) || Editor.string(editor, selection) === "" || selectedElement?.enable === 1) {
83
87
  setAnchorEl(null);
84
88
  } else {
85
89
  updateAnchorEl();
90
+ hideSlateSelection(); // removes slate selection background, when there is no selection
86
91
  }
87
- }, [selection]);
88
- useEffect(() => {
89
- if (selectedElement?.enable === 1) {
90
- setAnchorEl(null);
91
- }
92
- }, [selection, selectedElement?.path, selectedElement?.enable]);
92
+ }, [selection, event, selectedElement?.enable]);
93
93
  const handleClose = () => {
94
94
  // setAnchorEl(null);
95
95
  setOpen(false);
@@ -115,24 +115,18 @@ const PopupTool = props => {
115
115
  id: id,
116
116
  open: open,
117
117
  anchorEl: anchorEl,
118
- transition: true,
119
118
  sx: classes.popupWrapper,
120
119
  placement: "top-start",
121
- children: ({
122
- TransitionProps
123
- }) => /*#__PURE__*/_jsx(Fade, {
124
- ...TransitionProps,
125
- children: /*#__PURE__*/_jsx(Paper, {
126
- style: {
127
- borderRadius: "6px",
128
- border: "1px solid #8360FD"
129
- },
130
- children: /*#__PURE__*/_jsx(MiniTextFormat, {
131
- editor: editor,
132
- classes: classes,
133
- closeMainPopup: handleClose,
134
- customProps: customProps
135
- })
120
+ children: /*#__PURE__*/_jsx(Paper, {
121
+ style: {
122
+ borderRadius: "6px",
123
+ border: "1px solid #8360FD"
124
+ },
125
+ children: /*#__PURE__*/_jsx(MiniTextFormat, {
126
+ editor: editor,
127
+ classes: classes,
128
+ closeMainPopup: handleClose,
129
+ customProps: customProps
136
130
  })
137
131
  })
138
132
  })
@@ -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,65 +14,72 @@ const FontLoader = props => {
10
14
  const {
11
15
  setFontFamilies
12
16
  } = useEditorContext();
17
+ const [loading, setLoading] = useState(true);
13
18
  const loadFontsInBatches = (families, batchSize = 5, maxRetries = 3) => {
14
19
  let currentIndex = 0;
15
20
  let retryCount = 0;
16
- function loadNextBatch() {
17
- if (currentIndex >= families?.length) {
18
- // console.log("All fonts have been loaded");
19
- return;
20
- }
21
- const batch = families?.slice(currentIndex, currentIndex + batchSize);
22
- const batchWithWeights = batch.map(font => `${font}:300,400,600,700`);
23
- WebFont.load({
24
- google: {
25
- families: [...batchWithWeights]
26
- },
27
- classes: false,
28
- timeout: 2000,
29
- active: () => {
30
- // console.log(`Fonts loaded successfully: ${batch}`);
31
- currentIndex += batchSize;
32
- retryCount = 0; // Reset retry count for the next batch
33
- loadNextBatch();
34
- },
35
- inactive: () => {
36
- // console.log(`Font loading failed for: ${batch}`);
37
-
38
- if (retryCount < maxRetries) {
39
- retryCount++;
40
- // console.log(`Retrying batch (${retryCount}/${maxRetries})...`);
41
- // Retry loading the same batch
42
- loadNextBatch();
43
- } else {
44
- console.log(
45
- // `Max retries reached for batch: ${batch}. Moving to the next batch.`
46
- );
21
+ 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}`);
47
39
  currentIndex += batchSize;
48
40
  retryCount = 0; // Reset retry count for the next batch
49
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
+ }
50
58
  }
51
- }
52
- });
53
- }
59
+ });
60
+ } catch (err) {
61
+ setLoading(false);
62
+ }
63
+ };
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);
80
+ setLoading(false);
71
81
  });
82
+ // setLoading(true);
72
83
  } else {
73
84
  function correctFontArray(fontString) {
74
85
  let fontsArray = fontString.split(",");
@@ -88,11 +99,32 @@ const FontLoader = props => {
88
99
  let families = Array.from(fontSet);
89
100
  families = correctFontArray(families.join(", "));
90
101
  families = families?.map(font => font?.replace(/\"/g, ""));
91
- families = families?.map(font => font?.replace(", sans-serif", "")); //This is temporary fix for patch
102
+ families = families?.map(font => font?.replace(", sans-serif", ""));
92
103
  families = families.filter(font => googleFontList.includes(font));
93
104
  loadFontsInBatches(families);
94
105
  }
106
+
107
+ // Set timeout to hide loader after 5 seconds
108
+ const timeoutId = setTimeout(() => {
109
+ setLoading(false);
110
+ }, 5000);
111
+ return () => clearTimeout(timeoutId);
95
112
  }, []);
96
- return null;
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
128
+ });
97
129
  };
98
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, {})
@@ -2,18 +2,44 @@ import React, { useRef, useState } from "react";
2
2
  import { useTheme } from "@mui/material";
3
3
  import { Transforms } from "slate";
4
4
  import { ReactEditor, useSlateStatic } from "slate-react";
5
- import { Box, IconButton, Popper, Tooltip } from "@mui/material";
5
+ import { Box, IconButton, Tooltip } from "@mui/material";
6
6
  import SectionPopup from "../../Elements/Grid/SectionPopup";
7
7
  import { getBreakPointsValue, getTRBLBreakPoints, groupByBreakpoint } from "../../helper/theme";
8
- import DragHandle from "../DnD/DragHandleButton";
9
- import { useEditorSelection } from "../../hooks/useMouseMove";
8
+ // import DragHandle from "../DnD/DragHandleButton";
9
+ // import { useEditorSelection } from "../../hooks/useMouseMove";
10
10
  import SectionStyle from "./styles";
11
11
  import useWindowResize from "../../hooks/useWindowResize";
12
12
  import { SectionSettingIcon } from "../iconListV2";
13
+
14
+ // const list_types = ["orderedList", "unorderedList"];
13
15
  import { jsx as _jsx } from "react/jsx-runtime";
14
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
- import { Fragment as _Fragment } from "react/jsx-runtime";
16
- const list_types = ["orderedList", "unorderedList"];
17
+ const Toolbar = ({
18
+ readOnly,
19
+ showTool,
20
+ onSettings,
21
+ isSectionFullWidth
22
+ }) => {
23
+ return !readOnly && !showTool ? /*#__PURE__*/_jsx(Box, {
24
+ component: "div",
25
+ className: `element-toolbar no-border-button hr section-tw sectionIcon`,
26
+ contentEditable: false,
27
+ sx: {
28
+ left: isSectionFullWidth ? "0px" : "-28px",
29
+ top: isSectionFullWidth ? "-28px" : "1px",
30
+ "&:hover": {
31
+ backgroundColor: "rgba(0,0,0,0.5)"
32
+ }
33
+ },
34
+ children: /*#__PURE__*/_jsx(Tooltip, {
35
+ title: "Section Settings",
36
+ children: /*#__PURE__*/_jsx(IconButton, {
37
+ onClick: onSettings,
38
+ children: /*#__PURE__*/_jsx(SectionSettingIcon, {})
39
+ })
40
+ })
41
+ }) : null;
42
+ };
17
43
  const Section = props => {
18
44
  const themeReact = useTheme();
19
45
  const theme = props?.theme;
@@ -27,7 +53,8 @@ const Section = props => {
27
53
  readOnly
28
54
  } = customProps;
29
55
  const editor = useSlateStatic();
30
- const [showTool] = useEditorSelection(editor);
56
+ // const [isHovering, setIsHovering] = useState(false);
57
+ const [size] = useWindowResize();
31
58
  const [openSetttings, setOpenSettings] = useState(false);
32
59
  const {
33
60
  sectionBgColor,
@@ -44,67 +71,11 @@ const Section = props => {
44
71
  } = sectionAlignment || {};
45
72
  const path = ReactEditor.findPath(editor, element);
46
73
  const anchorEl = useRef(null);
47
- const popperEl = useRef(null);
48
- const [size] = useWindowResize();
74
+ // const popperEl = useRef(null);
75
+ // const [showTool] = useEditorSelection(editor);
49
76
  const isSectionFullWidth = sectionGridSize && sectionGridSize[size?.device] >= 12;
50
- const [isHovering, setIsHovering] = useState(false);
51
- const onMouseEnter = () => {
52
- setIsHovering(true);
53
- };
54
- const onMouseLeave = () => {
55
- setIsHovering(false);
56
- };
57
- const onSettings = () => {
58
- setOpenSettings(true);
59
- };
60
- const Toolbar = ({
61
- fromPopper
62
- }) => {
63
- return !readOnly && !showTool ? /*#__PURE__*/_jsx(Box, {
64
- component: "div",
65
- className: `element-toolbar no-border-button hr section-tw sectionIcon`,
66
- contentEditable: false,
67
- style: fromPopper ? {
68
- position: "unset",
69
- marginLeft: "28px",
70
- paddingTop: "4px",
71
- marginRight: "10px",
72
- height: "100%"
73
- } : {
74
- left: "-28px",
75
- top: "1px"
76
- },
77
- children: /*#__PURE__*/_jsx(Tooltip, {
78
- title: "Section Settings",
79
- children: /*#__PURE__*/_jsx(IconButton, {
80
- onClick: onSettings,
81
- children: /*#__PURE__*/_jsx(SectionSettingIcon, {})
82
- })
83
- })
84
- }) : null;
85
- };
86
- const onSave = data => {
87
- const updateData = {
88
- ...data
89
- };
90
- delete updateData.children;
91
- Transforms.setNodes(editor, {
92
- ...updateData
93
- }, {
94
- at: path
95
- });
96
- onClose();
97
- };
98
- const onClose = () => {
99
- setOpenSettings(false);
100
- };
101
- const onDelete = () => {
102
- Transforms.removeNodes(editor, {
103
- at: path
104
- });
105
- };
106
- const isFreeGrid = element?.children?.find(f => f.type === "freegrid");
107
- const needHover = element?.children?.find(f => f.type === "grid" && !list_types.includes(element.type)) ? "" : "";
77
+ const isFreeGrid = element?.children[0]?.type === "freegrid";
78
+ const needHover = false;
108
79
  let tempProps = {};
109
80
  if (element?.type === "temp") {
110
81
  tempProps = {
@@ -128,6 +99,38 @@ const Section = props => {
128
99
  ...getBreakPointsValue(sectionGridSize || 8, null, "overrideGridSize", true)
129
100
  }
130
101
  }, themeReact);
102
+
103
+ // const onMouseEnter = () => {
104
+ // setIsHovering(true);
105
+ // };
106
+
107
+ // const onMouseLeave = () => {
108
+ // setIsHovering(false);
109
+ // };
110
+
111
+ const onSettings = () => {
112
+ setOpenSettings(true);
113
+ };
114
+ const onSave = data => {
115
+ const updateData = {
116
+ ...data
117
+ };
118
+ delete updateData.children;
119
+ Transforms.setNodes(editor, {
120
+ ...updateData
121
+ }, {
122
+ at: path
123
+ });
124
+ onClose();
125
+ };
126
+ const onClose = () => {
127
+ setOpenSettings(false);
128
+ };
129
+ const onDelete = () => {
130
+ Transforms.removeNodes(editor, {
131
+ at: path
132
+ });
133
+ };
131
134
  return path.length === 1 && !isFreeGrid ? /*#__PURE__*/_jsxs(Box, {
132
135
  component: "div",
133
136
  className: `ed-section-wrapper ${readOnly ? "" : "hselect"} ${needHover} is-${element?.type}`,
@@ -142,9 +145,10 @@ const Section = props => {
142
145
  flexDirection: flexDirection || "column",
143
146
  alignItems: horizantal,
144
147
  justifyContent: vertical
145
- },
146
- onMouseEnter: onMouseEnter,
147
- onMouseLeave: onMouseLeave,
148
+ }
149
+ // onMouseEnter={onMouseEnter}
150
+ // onMouseLeave={onMouseLeave}
151
+ ,
148
152
  children: [/*#__PURE__*/_jsxs(Box, {
149
153
  className: "ed-section-inner",
150
154
  sx: {
@@ -152,34 +156,11 @@ const Section = props => {
152
156
  ...edInnerSp
153
157
  },
154
158
  ref: anchorEl,
155
- children: [isHovering && isSectionFullWidth ? /*#__PURE__*/_jsx(Popper, {
156
- open: isHovering && isSectionFullWidth,
157
- anchorEl: anchorEl?.current,
158
- placement: "top-start",
159
- sx: {
160
- zIndex: 9999
161
- },
162
- disablePortal: true,
163
- ref: popperEl,
164
- className: "sectionPopper",
165
- children: /*#__PURE__*/_jsxs(Box, {
166
- sx: {
167
- bgcolor: "background.paper",
168
- height: "30px",
169
- position: "relative",
170
- background: theme?.palette?.type === 'dark' ? theme?.palette?.editor?.miniToolBarBackground : '#F6F6F6'
171
- },
172
- children: [!readOnly && !showTool ? /*#__PURE__*/_jsx(DragHandle, {
173
- ...props,
174
- fromPopper: true
175
- }) : null, /*#__PURE__*/_jsx(Toolbar, {
176
- fromPopper: true
177
- })]
178
- })
179
- }) : /*#__PURE__*/_jsxs(_Fragment, {
180
- children: [!readOnly && !showTool ? /*#__PURE__*/_jsx(DragHandle, {
181
- ...props
182
- }) : null, /*#__PURE__*/_jsx(Toolbar, {})]
159
+ children: [/*#__PURE__*/_jsx(Toolbar, {
160
+ isSectionFullWidth: isSectionFullWidth,
161
+ readOnly: readOnly,
162
+ showTool: false,
163
+ onSettings: onSettings
183
164
  }), children]
184
165
  }), openSetttings ? /*#__PURE__*/_jsx(SectionPopup, {
185
166
  element: {
@@ -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;