@flozy/editor 5.6.8 → 5.7.0

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 (39) hide show
  1. package/dist/Editor/CommonEditor.js +10 -15
  2. package/dist/Editor/Editor.css +17 -22
  3. package/dist/Editor/Elements/Button/EditorButton.js +1 -3
  4. package/dist/Editor/Elements/Form/Form.js +0 -1
  5. package/dist/Editor/Elements/FreeGrid/styles.js +0 -1
  6. package/dist/Editor/Elements/List/CheckList.js +1 -2
  7. package/dist/Editor/Elements/Search/SearchAttachment.js +0 -1
  8. package/dist/Editor/Elements/Signature/SignaturePopup.js +1 -3
  9. package/dist/Editor/Elements/SimpleText/index.js +1 -8
  10. package/dist/Editor/Elements/SimpleText/style.js +1 -5
  11. package/dist/Editor/Elements/Table/TableCell.js +24 -28
  12. package/dist/Editor/Elements/Title/title.js +1 -13
  13. package/dist/Editor/Elements/Variables/Style.js +2 -20
  14. package/dist/Editor/Elements/Variables/VariableButton.js +3 -7
  15. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +3 -13
  16. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +0 -5
  17. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
  18. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +0 -45
  19. package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
  20. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +0 -1
  21. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -14
  22. package/dist/Editor/common/RnD/Utils/gridDropItem.js +7 -26
  23. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
  24. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
  25. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
  26. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +0 -4
  27. package/dist/Editor/common/Uploader.js +0 -8
  28. package/dist/Editor/commonStyle.js +10 -9
  29. package/dist/Editor/helper/index.js +2 -2
  30. package/dist/Editor/helper/theme.js +1 -24
  31. package/dist/Editor/hooks/useMouseMove.js +2 -5
  32. package/dist/Editor/plugins/withLayout.js +1 -1
  33. package/dist/Editor/utils/SlateUtilityFunctions.js +1 -8
  34. package/dist/Editor/utils/button.js +4 -4
  35. package/dist/Editor/utils/draftToSlate.js +2 -3
  36. package/dist/Editor/utils/helper.js +23 -27
  37. package/dist/Editor/utils/pageSettings.js +2 -14
  38. package/package.json +1 -1
  39. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
@@ -26,8 +26,8 @@ import editorStyles from "./Styles/EditorStyles";
26
26
  import DragAndDrop from "./common/DnD";
27
27
  import Section from "./common/Section";
28
28
  import decorators from "./utils/Decorators";
29
- import { getBreakpointLineSpacing, getTRBLBreakPoints } from "./helper/theme";
30
- import { getInitialValue, handleInsertLastElement, isFreeGrid, isFreeGridFragment, isRestrictedNode, outsideEditorClickLabel } from "./utils/helper";
29
+ import { getTRBLBreakPoints } from "./helper/theme";
30
+ import { getInitialValue, handleInsertLastElement, isFreeGrid, isFreeGridFragment, isPageSettings, outsideEditorClickLabel } from "./utils/helper";
31
31
  import useWindowResize from "./hooks/useWindowResize";
32
32
  import PopoverAIInput from "./Elements/AI/PopoverAIInput";
33
33
  import RnDCopy from "./common/RnD/RnDCopy";
@@ -96,8 +96,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
96
96
  const editorWrapper = useRef();
97
97
  const mentionsRef = useRef();
98
98
  const convertedContent = draftToSlate({
99
- data: content,
100
- needLayout: otherProps?.needLayout
99
+ data: content
101
100
  });
102
101
  const [value, setValue] = useState(convertedContent);
103
102
  const [isInteracted, setIsInteracted] = useState(false);
@@ -140,8 +139,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
140
139
  pageColor,
141
140
  color: pageTextColor,
142
141
  pageWidth,
143
- maxWidth: pageMaxWidth,
144
- lineHeight
142
+ maxWidth: pageMaxWidth
145
143
  } = pageSt?.pageProps || {
146
144
  bannerSpacing: {
147
145
  left: 0,
@@ -168,11 +166,11 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
168
166
  const debounced = useDebouncedCallback(
169
167
  // function
170
168
  value => {
171
- debouncedValue.current = value;
172
169
  const {
173
170
  value: strVal,
174
171
  ...restVal
175
172
  } = getOnSaveData(value);
173
+ debouncedValue.current = value;
176
174
  onSave(strVal, restVal);
177
175
  },
178
176
  // delay in ms
@@ -183,7 +181,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
183
181
  return {
184
182
  value: JSON.stringify(val),
185
183
  text: text,
186
- title: serializeToText(title?.children) || ""
184
+ title: serializeToText(title?.children) || "Untitled"
187
185
  };
188
186
  };
189
187
  const getPreviewImage = async (needBackground = false, options = {}) => {
@@ -332,7 +330,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
332
330
  onDrawerOpen: onDrawerOpen,
333
331
  ICON_API: "https://assets.agenciflow.com"
334
332
  };
335
- const lineH = getBreakpointLineSpacing(lineHeight, breakpoint);
336
333
  const renderElement = useCallback(props => {
337
334
  return /*#__PURE__*/_jsx(Element, {
338
335
  ...props,
@@ -391,8 +388,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
391
388
  } else if (event.key === "ArrowDown" && otherProps?.tagName !== "Pages") {
392
389
  upDownArrowKeyEvents(event, editor);
393
390
  } else if (event.key === "Backspace") {
394
- const isNodeRestricted = isRestrictedNode(event, editor);
395
- if (isNodeRestricted) {
391
+ const isPageSettingsNode = isPageSettings(event, editor);
392
+ if (isPageSettingsNode) {
396
393
  return;
397
394
  }
398
395
  const {
@@ -535,7 +532,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
535
532
  padding: {
536
533
  ...getTRBLBreakPoints(bannerSpacing)
537
534
  },
538
- lineHeight: lineH,
539
535
  width: !pageWidth || pageWidth === "fixed" ? fixedWidth : fullWidth,
540
536
  height: viewport.h ? `${viewport.h}px` : `100%`,
541
537
  alignSelf: "center",
@@ -543,7 +539,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
543
539
  transition: "all 0.3s",
544
540
  minHeight: "87%",
545
541
  maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto",
546
- paddingTop: hasTopBanner() ? "20px !important" : ""
542
+ paddingTop: hasTopBanner() ? '20px !important' : isMobile ? '10px !important' : ''
547
543
  },
548
544
  "data-info": outsideEditorClickLabel,
549
545
  children: [/*#__PURE__*/_jsx(Editable, {
@@ -597,9 +593,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
597
593
  setIsTextSelected: setIsTextSelected,
598
594
  customProps: customProps,
599
595
  editorWrapper: editorWrapper
600
- }) : null, !readOnly ? /*#__PURE__*/_jsx(SwitchViewport, {
596
+ }) : null, !readOnly && showViewport ? /*#__PURE__*/_jsx(SwitchViewport, {
601
597
  breakpoint: breakpoint,
602
- show: showViewport,
603
598
  onChange: b => onSwitchBreakpoint(b)
604
599
  }) : null]
605
600
  })
@@ -397,12 +397,6 @@ blockquote {
397
397
  padding: 0px 5px 0px 2px !important
398
398
  }
399
399
 
400
- .signatureActionBtnContainer {
401
- display: flex;
402
- align-items: center;
403
- gap: 1rem;
404
- }
405
-
406
400
  .signature-tab {
407
401
  display: flex;
408
402
  align-items: center;
@@ -611,8 +605,8 @@ blockquote {
611
605
  display: block !important;
612
606
  }
613
607
 
614
- .dialog-actions-si .signatureActionBtnContainer {
615
- margin-top: 1.4rem;
608
+ .dialog-actions-si .actionBtn {
609
+ margin-top: 24px;
616
610
  }
617
611
  }
618
612
 
@@ -995,7 +989,7 @@ blockquote {
995
989
 
996
990
  .sliderInput {
997
991
  width: 66px !important;
998
- padding: 2px 0px 2px 4px;
992
+ padding: 2px 10px;
999
993
  margin-left: 18px;
1000
994
  box-shadow: 0px 4px 16px 0px #0000000d;
1001
995
  border: 1px solid #6f6f6f33;
@@ -1263,19 +1257,6 @@ blockquote {
1263
1257
  pointer-events: auto;
1264
1258
  }
1265
1259
 
1266
- @media (max-width: 899px) {
1267
- .MuiPopover-root {
1268
- z-index: 1302 !important;
1269
- }
1270
- canvas {
1271
- max-width: 100% !important;
1272
- }
1273
- }
1274
-
1275
- .settingsHeader {
1276
- font-size: 14px !important;
1277
- font-weight: 500 !important;
1278
- }
1279
1260
  .hideScroll {
1280
1261
  overflow-anchor: none;
1281
1262
  }
@@ -1291,6 +1272,20 @@ blockquote {
1291
1272
  .hideScroll::-webkit-scrollbar-thumb:hover {
1292
1273
  background: none !important;
1293
1274
  }
1275
+ @media (max-width: 899px) {
1276
+ .MuiPopover-root {
1277
+ z-index: 1302 !important;
1278
+ }
1279
+
1280
+ canvas {
1281
+ max-width: 100% !important;
1282
+ }
1283
+ }
1284
+
1285
+ .settingsHeader {
1286
+ font-size: 14px !important;
1287
+ font-weight: 500 !important;
1288
+ }
1294
1289
 
1295
1290
  .custom-scroll::-webkit-scrollbar {
1296
1291
  height: .6rem;
@@ -162,7 +162,6 @@ const EditorButton = props => {
162
162
  display: "inline-flex",
163
163
  color: "rgba(0, 0, 0, 0.54)",
164
164
  marginBottom: "0px !important",
165
- ...classes.buttonMoreOption,
166
165
  ...classes.buttonMoreOption3
167
166
  },
168
167
  ...btnProps,
@@ -265,12 +264,11 @@ const EditorButton = props => {
265
264
  ...btnSp,
266
265
  borderStyle: borderStyle || "solid",
267
266
  color: `${textColor || "#FFFFFF"}`,
268
- fontSize: textSize || "12px",
267
+ fontSize: textSize || "inherit",
269
268
  fontFamily: fontFamily || "PoppinsRegular",
270
269
  display: "inline-flex",
271
270
  alignItems: "center",
272
271
  position: "relative",
273
- lineHeight: 1.43,
274
272
  "& .element-toolbar": {
275
273
  display: "none"
276
274
  },
@@ -402,7 +402,6 @@ const Form = props => {
402
402
  borderStyle: borderStyle || "solid",
403
403
  background: bgColor || "transparent",
404
404
  position: "relative",
405
- lineHeight: 1.43,
406
405
  ...formSX
407
406
  },
408
407
  ref: formEle,
@@ -171,7 +171,6 @@ const useFreeGridStyles = ({
171
171
  height: "100%",
172
172
  "& .signature-container": {
173
173
  height: "100%",
174
- LineHeight: 1.43,
175
174
  "& .signature-btn-container": {
176
175
  height: "100%",
177
176
  display: "flex",
@@ -39,8 +39,7 @@ const CheckList = ({
39
39
  display: "flex",
40
40
  justifyContent: "center",
41
41
  alignItems: "center",
42
- ...(style || {}),
43
- lineHeight: 1.43
42
+ ...(style || {})
44
43
  },
45
44
  children: [/*#__PURE__*/_jsxs("div", {
46
45
  contentEditable: false,
@@ -49,7 +49,6 @@ const SearchAttachment = props => {
49
49
  background: `${theme?.palette?.containers?.slashBrainCardBg} !important`,
50
50
  cursor: 'pointer',
51
51
  margin: '4px 0px',
52
- lineHeight: 1.43,
53
52
  "&.MuiPaper-root.MuiPaper-rounded": {
54
53
  borderRadius: "7px !important",
55
54
  paddingTop: '0px !important'
@@ -512,9 +512,7 @@ const SignaturePopup = props => {
512
512
  })
513
513
  })
514
514
  })]
515
- }) : null, /*#__PURE__*/_jsxs(Box, {
516
- component: "div",
517
- className: "signatureActionBtnContainer",
515
+ }) : null, /*#__PURE__*/_jsxs(_Fragment, {
518
516
  children: [!readOnly ? /*#__PURE__*/_jsx(Button, {
519
517
  onClick: handleClear,
520
518
  className: `secondaryBtn actionBtn deleteBtn deleteButtonSignature`,
@@ -5,7 +5,6 @@ import { getPageSettings } from "../../utils/pageSettings";
5
5
  import { isTextSelected } from "../../utils/helper";
6
6
  import { useEditorContext } from "../../hooks/useMouseMove";
7
7
  import SimpleTextStyle from "./style";
8
- import { getBreakpointLineSpacing } from "../../helper/theme";
9
8
  import { jsx as _jsx } from "react/jsx-runtime";
10
9
  import { Fragment as _Fragment } from "react/jsx-runtime";
11
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -34,14 +33,8 @@ const SimpleText = props => {
34
33
  const {
35
34
  pageColor
36
35
  } = pageSt?.pageProps || {};
37
- const {
38
- activeBreakPoint
39
- } = useEditorContext();
40
- const lineHeight = element?.children[0]?.lineHeight;
41
- const lineH = getBreakpointLineSpacing(lineHeight, activeBreakPoint);
42
36
  const classes = SimpleTextStyle({
43
- pageColor: pageColor || theme?.palette?.editor?.background || "#FFFFFF",
44
- lineHeight: lineH
37
+ pageColor: pageColor || theme?.palette?.editor?.background || "#FFFFFF"
45
38
  });
46
39
  const selected = useSelected();
47
40
  const path = ReactEditor.findPath(editor, element);
@@ -1,12 +1,10 @@
1
1
  import { invertColor } from "../../helper";
2
2
  const SimpleTextStyle = ({
3
- pageColor,
4
- lineHeight
3
+ pageColor
5
4
  }) => ({
6
5
  root: {
7
6
  position: "relative",
8
7
  padding: "0px",
9
- lineHeight: lineHeight,
10
8
  "&.dataView": {
11
9
  "& .placeholder-simple-text": {
12
10
  opacity: 0
@@ -35,8 +33,6 @@ const SimpleTextStyle = ({
35
33
  height: "24px",
36
34
  overflow: "hidden",
37
35
  fontSize: "14px",
38
- display: "inline-flex",
39
- alignItems: "center",
40
36
  "& .bg-pad-sl": {
41
37
  padding: "2px 4px 2px 4px",
42
38
  background: "transparent",
@@ -288,36 +288,32 @@ const TableCell = props => {
288
288
  Transforms.select(editor, selection);
289
289
  };
290
290
  const onRowDrag = () => {
291
- if (rowNode) {
292
- const {
293
- children
294
- } = rowNode[0] || {};
295
- const rowPath = rowNode[1] || [];
296
- const rowStartCell = [...rowPath, 0];
297
- const rowEndCell = [...rowPath, children?.length - 1];
298
- updateTableSelection({
299
- startCellPath: rowStartCell,
300
- endCellPath: rowEndCell,
301
- isDragging: false
302
- });
303
- selectCurrentCell();
304
- }
291
+ const {
292
+ children
293
+ } = rowNode[0] || {};
294
+ const rowPath = rowNode[1] || [];
295
+ const rowStartCell = [...rowPath, 0];
296
+ const rowEndCell = [...rowPath, children?.length - 1];
297
+ updateTableSelection({
298
+ startCellPath: rowStartCell,
299
+ endCellPath: rowEndCell,
300
+ isDragging: false
301
+ });
302
+ selectCurrentCell();
305
303
  };
306
304
  const onColDrag = () => {
307
- if (tableNode) {
308
- const [tableData, tablePath] = tableNode;
309
- const {
310
- rows
311
- } = tableData;
312
- const startColCell = [...tablePath, 0, column];
313
- const endColCell = [...tablePath, rows - 1, column];
314
- updateTableSelection({
315
- startCellPath: startColCell,
316
- endCellPath: endColCell,
317
- isDragging: false
318
- });
319
- selectCurrentCell();
320
- }
305
+ const [tableData, tablePath] = tableNode;
306
+ const {
307
+ rows
308
+ } = tableData;
309
+ const startColCell = [...tablePath, 0, column];
310
+ const endColCell = [...tablePath, rows - 1, column];
311
+ updateTableSelection({
312
+ startCellPath: startColCell,
313
+ endCellPath: endColCell,
314
+ isDragging: false
315
+ });
316
+ selectCurrentCell();
321
317
  };
322
318
  const handleToolAction = (value, option, dragType) => {
323
319
  const isRowDrag = dragType === "row";
@@ -1,24 +1,12 @@
1
1
  import React from "react";
2
- import { Text } from "slate";
3
2
  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
- };
10
3
  const Title = props => {
11
4
  const {
12
- element,
13
5
  attributes,
14
- children,
15
- customProps
6
+ children
16
7
  } = props;
17
- const isEmpty = !customProps?.readOnly && isEmptyTextNode(element?.children[0]) ? "empty" : "";
18
8
  return /*#__PURE__*/_jsx("div", {
19
9
  ...attributes,
20
- placeholder: "Title",
21
- className: `content-editable ${isEmpty}`,
22
10
  style: {
23
11
  fontWeight: "bold",
24
12
  fontSize: "20px"
@@ -1,4 +1,4 @@
1
- const VariableStyles = theme => ({
1
+ const VariableStyles = () => ({
2
2
  variablesItem: {
3
3
  color: "#2563EB",
4
4
  background: "#EEEEEE"
@@ -37,26 +37,8 @@ const VariableStyles = theme => ({
37
37
  "& .MuiMenuItem-root": {
38
38
  color: "#64748B"
39
39
  },
40
- "& .MuiPaper-root": {
41
- borderRadius: '8px',
42
- backgroundColor: `${theme?.palette?.editor?.miniToolBarBackground} !important`
43
- },
44
- "& .MuiList-root": {
45
- padding: '0px'
46
- },
47
- "& .MuiButtonBase-root": {
48
- margin: '6px',
49
- borderRadius: '8px',
50
- padding: '6px 14px',
51
- fontSize: '14px',
52
- fontWeight: '400',
53
- color: theme?.palette?.editor?.deletePopUpButtonTextColor,
54
- "&:hover": {
55
- background: `${theme?.palette?.editor?.menuOptionHoverBackground} !important`
56
- }
57
- },
58
40
  "& .Mui-selected": {
59
- backgroundColor: 'unset !important'
41
+ backgroundColor: "rgba(0, 0, 0, 0.04) !important"
60
42
  }
61
43
  }
62
44
  });
@@ -3,15 +3,11 @@ 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 KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
7
- import { useEditorContext } from "../../hooks/useMouseMove";
6
+ import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
8
7
  import { jsx as _jsx } from "react/jsx-runtime";
9
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
9
  const VariableButton = props => {
11
- const {
12
- theme
13
- } = useEditorContext();
14
- const classes = VariableStyles(theme);
10
+ const classes = VariableStyles();
15
11
  const editor = useSlateStatic();
16
12
  const {
17
13
  options
@@ -28,7 +24,7 @@ const VariableButton = props => {
28
24
  value: "",
29
25
  sx: classes.variableBtn,
30
26
  onChange: updateVariable,
31
- IconComponent: () => /*#__PURE__*/_jsx(KeyboardArrowDownRoundedIcon, {}),
27
+ IconComponent: () => /*#__PURE__*/_jsx(KeyboardArrowDownIcon, {}),
32
28
  MenuProps: {
33
29
  sx: classes.variableMenuItem,
34
30
  PaperProps: {
@@ -98,22 +98,12 @@ const AddTemplates = props => {
98
98
  setCategory(newValue);
99
99
  setFilteredTemplates(templates.filter(f => f.category === newValue));
100
100
  };
101
- const onSelectTemplate = card => async () => {
101
+ const onSelectTemplate = card => () => {
102
102
  try {
103
- const {
104
- data
105
- } = await services("templateContent", {
106
- id: card?.id
107
- });
108
- const content = data?.content;
109
- if (content) {
110
- editor.insertNode(JSON.parse(content));
111
- } else {
112
- console.log("No data found");
113
- }
103
+ editor.insertNode(JSON.parse(card.content));
114
104
  onClose();
115
105
  } catch (err) {
116
- console.log("Error inserting template content into editor:", err);
106
+ console.log(err);
117
107
  }
118
108
  };
119
109
  const filterByTitle = f => {
@@ -416,11 +416,6 @@ 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
- },
424
419
  "& svg": {
425
420
  width: "20px",
426
421
  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?.compressedThum || m?.thumbnail,
50
+ image: m?.thumbnail,
51
51
  alt: m?.title,
52
52
  sx: classes.templateCardMedia
53
53
  }), /*#__PURE__*/_jsx(PreviewAndSelect, {
@@ -14,8 +14,6 @@ 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";
19
17
  import { jsx as _jsx } from "react/jsx-runtime";
20
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
21
19
  const allTools = toolbarGroups.flat();
@@ -33,18 +31,10 @@ const TextFormat = props => {
33
31
  const [anchorEl, setAnchorEl] = useState(null);
34
32
  const [type, setType] = useState(null);
35
33
  const open = Boolean(anchorEl);
36
- const {
37
- element: pageSt
38
- } = getPageSettings(editor) || {};
39
- const pageSettingLine = pageSt?.pageProps?.lineHeight;
40
34
  const {
41
35
  fontFamilies,
42
36
  theme
43
37
  } = useEditorContext();
44
- const {
45
- activeBreakPoint
46
- } = useEditorContext();
47
- const breakpoint = activeBreakPoint === "" ? "lg" : activeBreakPoint;
48
38
  const fontWeight = allTools.find(f => f.format === "fontWeight");
49
39
  const fontStyle = allTools.filter(f => f.type === "mark" && f.format !== "strikethrough" && f.format !== "superscript" && f.format !== "subscript");
50
40
  const fontAlign = allTools.filter(f => f.format?.indexOf("align") >= 0);
@@ -61,8 +51,6 @@ const TextFormat = props => {
61
51
  color: "",
62
52
  bgColor: ""
63
53
  };
64
- let lineSpacingValue = activeMark(editor, 'lineHeight');
65
- lineSpacingValue = lineSpacingValue?.[breakpoint] !== undefined ? lineSpacingValue : pageSettingLine;
66
54
  const handleColorPicker = type => e => {
67
55
  setType(type);
68
56
  setAnchorEl(e.currentTarget);
@@ -103,13 +91,6 @@ const TextFormat = props => {
103
91
  value
104
92
  });
105
93
  };
106
- const handleLineSpacing = data => {
107
- const [[format, value]] = Object.entries(data);
108
- addMarkData(editor, {
109
- format,
110
- value
111
- });
112
- };
113
94
  return /*#__PURE__*/_jsxs(Grid, {
114
95
  container: true,
115
96
  sx: classes.textFormatWrapper,
@@ -379,32 +360,6 @@ const TextFormat = props => {
379
360
  xs: 12,
380
361
  sx: classes.dividerGrid,
381
362
  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, {})
408
363
  }), /*#__PURE__*/_jsx(Grid, {
409
364
  item: true,
410
365
  xs: 12,
@@ -41,9 +41,9 @@ const FontLoader = props => {
41
41
  // Retry loading the same batch
42
42
  loadNextBatch();
43
43
  } else {
44
- // console.log(
45
- // `Max retries reached for batch: ${batch}. Moving to the next batch.`
46
- // );
44
+ console.log(
45
+ // `Max retries reached for batch: ${batch}. Moving to the next batch.`
46
+ );
47
47
  currentIndex += batchSize;
48
48
  retryCount = 0; // Reset retry count for the next batch
49
49
  loadNextBatch();
@@ -67,7 +67,7 @@ const FontLoader = props => {
67
67
  });
68
68
  loadFontsInBatches(families);
69
69
  }).catch(err => {
70
- // console.log(err);
70
+ console.log(err);
71
71
  });
72
72
  } else {
73
73
  function correctFontArray(fontString) {
@@ -62,7 +62,6 @@ const FormSettings = props => {
62
62
  MuiAccordion: {
63
63
  styleOverrides: {
64
64
  root: {
65
- background: theme?.palette?.editor?.miniToolBarBackground,
66
65
  "& .MuiAccordionSummary-root": {
67
66
  flexDirection: "row-reverse",
68
67
  "& .MuiSvgIcon-root": {
@@ -3,35 +3,24 @@ 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";
7
6
  import { jsx as _jsx } from "react/jsx-runtime";
8
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
8
  const SwitchViewport = props => {
10
9
  const {
11
10
  breakpoint,
12
- onChange,
13
- show
11
+ onChange
14
12
  } = props;
15
13
  const classes = useSwitchViewport();
16
- const {
17
- setSelectedElement,
18
- setActiveBreakPoint
19
- } = useEditorContext();
20
14
  useEffect(() => {
21
- // to reset selection on viewport changes - FS-6589
22
- setSelectedElement({});
15
+ console.log(breakpoint);
23
16
  }, [breakpoint]);
24
17
  return /*#__PURE__*/_jsxs(Box, {
25
18
  sx: classes.root,
26
- style: {
27
- display: show ? "block" : "none"
28
- },
29
19
  children: [/*#__PURE__*/_jsx(Tooltip, {
30
20
  title: "Desktop View",
31
21
  children: /*#__PURE__*/_jsx(IconButton, {
32
22
  className: `${!breakpoint || breakpoint === "lg" ? "active" : ""}`,
33
23
  onClick: () => {
34
- setActiveBreakPoint("");
35
24
  onChange("");
36
25
  },
37
26
  children: /*#__PURE__*/_jsx(PersonalVideoIcon, {})
@@ -41,7 +30,6 @@ const SwitchViewport = props => {
41
30
  children: /*#__PURE__*/_jsx(IconButton, {
42
31
  className: `${breakpoint === "xs" ? "active" : ""}`,
43
32
  onClick: () => {
44
- setActiveBreakPoint("xs");
45
33
  onChange("xs");
46
34
  },
47
35
  children: /*#__PURE__*/_jsx(PhoneIphoneIcon, {})
@@ -1,6 +1,5 @@
1
1
  import { Transforms, Node, Path } from "slate";
2
2
  import { ReactEditor } from "slate-react";
3
- import { handleNegativeInteger } from "../../../utils/helper";
4
3
  export const ROW_HEIGHT = 50;
5
4
  const MARGIN_OF = {
6
5
  xs: 160,
@@ -76,7 +75,7 @@ const reRenderChildNodes = (editor, path) => {
76
75
  console.log(err);
77
76
  }
78
77
  };
79
- function isContainerElement(editor, moveTopath, props, appenBp) {
78
+ function isContainerElement(editor, moveTopath, props) {
80
79
  try {
81
80
  const {
82
81
  path,
@@ -92,32 +91,21 @@ function isContainerElement(editor, moveTopath, props, appenBp) {
92
91
  parentNode = Node.get(editor, Path.parent(dragItemPath));
93
92
  }
94
93
  const moveToNode = Node.get(editor, moveTopath);
95
- const leftOfMoveToNode = moveToNode[`left${appenBp}`];
96
94
  if (moveToNode.type === "freegridBox") {
97
95
  if (parentNode.type === "freegridBox") {
98
96
  // same box
99
97
  if (parentPath === dragOver) {
100
98
  return props.calX;
101
99
  } else {
102
- const moveToDom = ReactEditor.toDOMNode(editor, moveToNode);
103
- const {
104
- left
105
- } = moveToDom?.getBoundingClientRect() || {};
106
- const borderLeftWidth = getBorderWidth(moveToDom, "borderLeftWidth");
107
-
108
100
  // for different box
109
- return parseInt(props.x - props.diffX - left - borderLeftWidth);
101
+ return parseInt(props.x - window.innerWidth / 2 + MARGIN_OF[props.breakpoint] - props.diffX - moveToNode.left);
110
102
  }
111
103
  } else {
112
- return props.calX - leftOfMoveToNode;
104
+ return props.calX - moveToNode?.left;
113
105
  }
114
106
  } else if (moveToNode.type === "freegrid") {
115
107
  if (parentNode.type === "freegridBox") {
116
- const boundaryLineEle = document.querySelector(".rnd-guideline-lv");
117
- const {
118
- left
119
- } = boundaryLineEle?.getBoundingClientRect() || {};
120
- return parseInt(props.x - props.diffX - left);
108
+ return parseInt(props.x - window.innerWidth / 2 + MARGIN_OF[props.breakpoint] - props.diffX);
121
109
  } else {
122
110
  return props.calX;
123
111
  }
@@ -145,17 +133,14 @@ export function onDropItem(props, parentClass) {
145
133
  const from = parentPath.split("|").map(m => parseInt(m));
146
134
  let newPath = [];
147
135
  newPath = moveTo;
148
- const appenBp = breakpoint === "lg" ? "" : `_${breakpoint}`;
149
- const cCalx = isContainerElement(editor, moveTo, props, appenBp);
150
-
136
+ const cCalx = isContainerElement(editor, moveTo, props);
151
137
  // const posX = parseInt(
152
138
  // cx - window.innerWidth / 2 + MARGIN_OF[breakpoint] - diffX
153
139
  // );
154
140
  const toSectionNode = Node.get(editor, newPath);
155
141
  const addToSectionDOM = ReactEditor.toDOMNode(editor, toSectionNode);
156
- const borderTopWidth = getBorderWidth(addToSectionDOM, "borderTopWidth");
157
142
  const rect = addToSectionDOM.getBoundingClientRect();
158
- const y = handleNegativeInteger(endPosition.y - startPosition.diffY - rect.top - borderTopWidth);
143
+ const y = endPosition.y - startPosition.diffY - rect.top;
159
144
 
160
145
  // Calculate grid position
161
146
  const row = Math.floor(y / ROW_HEIGHT) + 1;
@@ -165,6 +150,7 @@ export function onDropItem(props, parentClass) {
165
150
 
166
151
  // Update grid area
167
152
  const gridArea = `${row} / 1 / ${row + 1} / 2`;
153
+ const appenBp = breakpoint === "lg" ? "" : `_${breakpoint}`;
168
154
  Transforms.setNodes(editor, {
169
155
  [`gridArea${appenBp}`]: gridArea,
170
156
  [`left${appenBp}`]: cCalx,
@@ -202,9 +188,4 @@ export function onDropItem(props, parentClass) {
202
188
  export function calculateGridArea(y) {
203
189
  const row = Math.floor(y / ROW_HEIGHT) + 1;
204
190
  return `${row} / 1 / ${row + 1} / 2`;
205
- }
206
- export function getBorderWidth(dom, property) {
207
- const styles = getComputedStyle(dom);
208
- const borderWidth = parseFloat(styles[property]);
209
- return borderWidth;
210
191
  }
@@ -73,11 +73,6 @@ 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
- },
81
76
  children: /*#__PURE__*/_jsxs(Button, {
82
77
  component: "label",
83
78
  variant: "text",
@@ -1,7 +1,6 @@
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";
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
5
  import { Fragment as _Fragment } from "react/jsx-runtime";
7
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -16,10 +15,7 @@ const RenderCard = ({
16
15
  return /*#__PURE__*/_jsx(Card, {
17
16
  sx: {
18
17
  position: 'relative',
19
- padding: "10px",
20
- '& .MuiCheckbox-root svg': {
21
- fill: 'unset !important'
22
- }
18
+ padding: "10px"
23
19
  },
24
20
  children: /*#__PURE__*/_jsx(FormControlLabel, {
25
21
  control: /*#__PURE__*/_jsx(Checkbox, {
@@ -85,9 +81,6 @@ const CardsMapping = props => {
85
81
  selectedCard,
86
82
  infoIcon
87
83
  } = data;
88
- const {
89
- theme
90
- } = useEditorContext();
91
84
  const activeCard = value === selectedCard;
92
85
  const handleChange = e => {
93
86
  if (selectedCard === data?.value) {
@@ -106,8 +99,7 @@ const CardsMapping = props => {
106
99
  sx: {
107
100
  marginBottom: "12px",
108
101
  "& .MuiPaper-root": {
109
- background: theme?.palette?.editor?.miniToolBarBackground,
110
- border: activeCard ? "1px solid #2563EB" : `1px solid ${theme?.palette?.editor?.inputFieldBorder}`,
102
+ border: activeCard ? "1px solid #2563EB" : "1px solid #C8D8FA",
111
103
  borderRadius: "8px",
112
104
  boxShadow: activeCard ? "0px 4px 16px 0px #2563EB40" : "unset"
113
105
  }
@@ -18,7 +18,6 @@ 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";
22
21
  const FieldMap = {
23
22
  text: Text,
24
23
  bannerSpacing: BannerSpacing,
@@ -39,7 +38,6 @@ const FieldMap = {
39
38
  fontSize: FontSize,
40
39
  selectSwitch: SelectSwitch,
41
40
  card: CardsMapping,
42
- metadatamapping: MetaDataMapping,
43
- lineSpacing: LineSpacing
41
+ metadatamapping: MetaDataMapping
44
42
  };
45
43
  export default FieldMap;
@@ -25,10 +25,6 @@ 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"
32
28
  }]
33
29
  }, {
34
30
  tab: "Max Width",
@@ -4,7 +4,6 @@ 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";
8
7
  import { jsx as _jsx } from "react/jsx-runtime";
9
8
  import { Fragment as _Fragment } from "react/jsx-runtime";
10
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -19,9 +18,6 @@ const Uploader = props => {
19
18
  const [base64, setBase64] = useState(value?.url);
20
19
  const [fileName, setFileName] = useState("");
21
20
  const [uploading, setUploading] = useState(false);
22
- const {
23
- theme
24
- } = useEditorContext();
25
21
  const handleChange = async e => {
26
22
  const uFile = e.target.files[0];
27
23
  const strImage = await convertBase64(uFile);
@@ -103,10 +99,6 @@ const Uploader = props => {
103
99
  className: "uploadImageSection",
104
100
  children: base64 ? renderThumb() : /*#__PURE__*/_jsx(Grid, {
105
101
  className: "uploadImageText",
106
- sx: {
107
- background: `${theme?.palette?.editor?.inputFieldBgColor}`,
108
- border: `1px solid ${theme?.palette?.editor?.inputFieldBorder}`
109
- },
110
102
  children: /*#__PURE__*/_jsxs(Button, {
111
103
  component: "label",
112
104
  variant: "text",
@@ -49,15 +49,16 @@ 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
- },
57
52
  "& p": {
58
53
  marginBottom: "7px",
59
54
  marginTop: "4px"
60
55
  },
56
+ "& .MuiPaper-root": {
57
+ border: 'unset !important',
58
+ borderRadius: '0px',
59
+ height: 'fit-content',
60
+ padding: '2px'
61
+ },
61
62
  "& .muiIconsListParent": {
62
63
  "& svg": {
63
64
  color: `${theme?.palette?.editor?.svgTextAlignStrokeColor} !important`
@@ -469,6 +470,10 @@ const useCommonStyle = theme => ({
469
470
  }
470
471
  }
471
472
  },
473
+ pageSettingPopUpRoot: {
474
+ padding: "16px 8px 16px 10px!important",
475
+ height: "100%"
476
+ },
472
477
  buttonMoreOption: {
473
478
  background: `${theme?.palette?.editor?.aiInputBackground} !important`,
474
479
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
@@ -481,10 +486,6 @@ const useCommonStyle = theme => ({
481
486
  }
482
487
  }
483
488
  },
484
- pageSettingPopUpRoot: {
485
- padding: "16px 8px 16px 10px!important",
486
- height: "100%"
487
- },
488
489
  buttonMoreOption2: {
489
490
  background: `${theme?.palette?.editor?.aiInputBackground} !important`,
490
491
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
@@ -337,14 +337,14 @@ export const isCarouselSelected = editor => {
337
337
  return false;
338
338
  }
339
339
  const [nodeEntry] = Editor.nodes(editor, {
340
- match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "carousel"
340
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === 'carousel'
341
341
  });
342
342
  if (!nodeEntry) {
343
343
  return false;
344
344
  }
345
345
  const [node] = nodeEntry;
346
346
  const carouselDom = ReactEditor.toDOMNode(editor, node);
347
- const isEdit = carouselDom.classList.contains("carousel_slider_edit");
347
+ const isEdit = carouselDom.classList.contains('carousel_slider_edit');
348
348
  return !isEdit;
349
349
  } catch (err) {
350
350
  console.log(err);
@@ -161,27 +161,4 @@ export const groupByBreakpoint = (styleProps, theme) => {
161
161
  }
162
162
  };
163
163
  };
164
- export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
165
- export const getBreakpointLineSpacing = (value, breakpoint) => {
166
- try {
167
- const values = getBreakPointsValue(value, breakpoint);
168
- const cssVal = BREAKPOINTS_DEVICES.reduce((a, b) => {
169
- if (values[b] || values["lg"]) {
170
- const value = values[b] || values["lg"];
171
- return {
172
- ...a,
173
- [b]: value
174
- };
175
- } else {
176
- return a;
177
- }
178
- }, {});
179
- if (breakpoint) {
180
- return value[breakpoint] || value["lg"] || value;
181
- } else {
182
- return cssVal["lg"];
183
- }
184
- } catch (err) {
185
- // console.log(err);
186
- }
187
- };
164
+ export const getCustomizationValue = value => isNaN(parseInt(value)) ? null : parseInt(value);
@@ -35,7 +35,6 @@ export const EditorProvider = ({
35
35
  path: null
36
36
  });
37
37
  const [fontFamilies, setFontFamilies] = useState({});
38
- const [activeBreakPoint, setActiveBreakPoint] = useState("");
39
38
  useEffect(() => {
40
39
  window.updateSelectedItem = d => {
41
40
  setSelectedElement(d);
@@ -98,10 +97,8 @@ export const EditorProvider = ({
98
97
  setOpenAI,
99
98
  updateDragging,
100
99
  fontFamilies,
101
- setFontFamilies,
102
- activeBreakPoint,
103
- setActiveBreakPoint
104
- }), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop, activeBreakPoint]);
100
+ setFontFamilies
101
+ }), [path, editor?.selection, selectedPath, selectedElement, contextMenu, openAI, popupType, drop]);
105
102
  return /*#__PURE__*/_jsx(EditorContext.Provider, {
106
103
  value: otherValues,
107
104
  children: children
@@ -39,7 +39,7 @@ const withLayout = editor => {
39
39
  const title = {
40
40
  type: "title",
41
41
  children: [{
42
- text: ""
42
+ text: "Untitled"
43
43
  }]
44
44
  };
45
45
  Transforms.insertNodes(editor, title, {
@@ -314,8 +314,7 @@ export const getBlock = props => {
314
314
  borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
315
315
  margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
316
316
  width: element?.bgColor ? "calc(100% - 16px)" : "100%",
317
- borderWidth: element?.color ? "0px 0px 0px 3px" : "0px",
318
- lineHeight: 1.43
317
+ borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
319
318
  },
320
319
  children: children
321
320
  });
@@ -375,9 +374,6 @@ export const getBlock = props => {
375
374
  });
376
375
  case "orderedList":
377
376
  return /*#__PURE__*/_jsx("ol", {
378
- style: {
379
- lineHeight: 1.43
380
- },
381
377
  className: "listItemMargin",
382
378
  type: "1",
383
379
  ...attributes,
@@ -385,9 +381,6 @@ export const getBlock = props => {
385
381
  });
386
382
  case "unorderedList":
387
383
  return /*#__PURE__*/_jsx("ul", {
388
- style: {
389
- lineHeight: 1.43
390
- },
391
384
  className: "listItemMargin",
392
385
  ...attributes,
393
386
  children: children
@@ -20,10 +20,10 @@ export const insertButton = editor => {
20
20
  bottomRight: 30
21
21
  },
22
22
  bannerSpacing: {
23
- left: 24,
24
- top: 10,
25
- right: 24,
26
- bottom: 10
23
+ left: 16,
24
+ top: 8,
25
+ right: 16,
26
+ bottom: 8
27
27
  },
28
28
  ...(windowVar.lastButtonProps || {})
29
29
  };
@@ -82,8 +82,7 @@ const splitInlineStyleRanges = (text, inlineStyleRanges, data) => {
82
82
  };
83
83
  export const draftToSlate = props => {
84
84
  const {
85
- data,
86
- needLayout
85
+ data
87
86
  } = props;
88
87
  if (data?.blocks && data?.blocks?.length > 0) {
89
88
  const converted = data?.blocks?.reduce((a, b) => {
@@ -105,7 +104,7 @@ export const draftToSlate = props => {
105
104
  return data;
106
105
  } else {
107
106
  return [{
108
- type: needLayout ? "title" : "paragraph",
107
+ type: "paragraph",
109
108
  children: [{
110
109
  text: ""
111
110
  }]
@@ -593,9 +593,8 @@ export const getPreviousNode = editor => {
593
593
  return;
594
594
  }
595
595
  };
596
- const isRestricted = node => node?.type === "page-settings" || node?.type === "site-settings" || node?.children?.some(child => child.type === "dataView");
597
- export const isRestrictedNode = (event, editor) => {
598
- let isNodeRestricted = false;
596
+ export const isPageSettings = (event, editor) => {
597
+ let isPageSettingsNode = false;
599
598
  try {
600
599
  const {
601
600
  selection
@@ -608,27 +607,23 @@ export const isRestrictedNode = (event, editor) => {
608
607
  previousNode,
609
608
  previousPath
610
609
  } = getPreviousNode(editor) || {};
611
- if (isRestricted(previousNode)) {
610
+ if (previousNode?.type === "page-settings") {
612
611
  event.preventDefault(); // stops deleting backward
613
612
 
614
613
  // move the cursor to node which is before page-settings node
615
614
  const pathBeforePageSettings = Path.previous(previousPath);
616
615
  const endPath = Editor.end(editor, pathBeforePageSettings);
617
616
  Transforms.select(editor, endPath);
618
- isNodeRestricted = true;
617
+ isPageSettingsNode = true;
619
618
  }
620
619
  }
621
- return isNodeRestricted;
620
+ return isPageSettingsNode;
622
621
  } catch (err) {
623
622
  // if there is no previous node error throws, user reached the starting node and startting position
624
- isNodeRestricted = true;
625
- return isNodeRestricted;
623
+ isPageSettingsNode = true;
624
+ return isPageSettingsNode;
626
625
  }
627
626
  };
628
- export function capitalizeFirstLetter(str) {
629
- if (!str) return str;
630
- return str.charAt(0).toUpperCase() + str.slice(1);
631
- }
632
627
  export const insertLineBreakAtEndOfPath = (editor, path) => {
633
628
  try {
634
629
  const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
@@ -647,13 +642,6 @@ export const insertLineBreakAtEndOfPath = (editor, path) => {
647
642
  console.log(err);
648
643
  }
649
644
  };
650
- export function isHavingSelection(editor) {
651
- try {
652
- return editor?.selection && !Range.isCollapsed(editor.selection);
653
- } catch (err) {
654
- console.log(err);
655
- }
656
- }
657
645
  const omitNodes = ["site-settings", "page-settings"];
658
646
  export function getInitialValue(value = [], readOnly) {
659
647
  if (readOnly === "readonly" && value?.length) {
@@ -682,17 +670,20 @@ export function getInitialValue(value = [], readOnly) {
682
670
  }
683
671
  return value;
684
672
  }
673
+ export function capitalizeFirstLetter(str) {
674
+ if (!str) return str;
675
+ return str.charAt(0).toUpperCase() + str.slice(1);
676
+ }
677
+ export function isHavingSelection(editor) {
678
+ try {
679
+ return editor?.selection && !Range.isCollapsed(editor.selection);
680
+ } catch (err) {
681
+ console.log(err);
682
+ }
683
+ }
685
684
  export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
686
685
  return `${defaultCls} ${selected ? selectedClsName : ""}`;
687
686
  }
688
- export function handleNegativeInteger(val) {
689
- return val < 0 ? 0 : val;
690
- }
691
- export const containsSurrogatePair = text => {
692
- // Match surrogate pairs (high and low surrogate)
693
- const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
694
- return surrogatePairRegex.test(text);
695
- };
696
687
  export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
697
688
  try {
698
689
  const options = {
@@ -706,6 +697,11 @@ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
706
697
  return [];
707
698
  }
708
699
  };
700
+ export const containsSurrogatePair = text => {
701
+ // Match surrogate pairs (high and low surrogate)
702
+ const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
703
+ return surrogatePairRegex.test(text);
704
+ };
709
705
  export const getSlateDom = (editor, range) => {
710
706
  try {
711
707
  const slateDom = ReactEditor.toDOMRange(editor, range);
@@ -9,13 +9,7 @@ export const findPageSettings = editor => {
9
9
  path: null,
10
10
  element: {
11
11
  pageProps: {
12
- pageWidth: "fixed",
13
- "lineHeight": {
14
- "xs": 1.43,
15
- "sm": 1.43,
16
- "md": 1.43,
17
- "lg": 1.43
18
- }
12
+ pageWidth: "fixed"
19
13
  }
20
14
  }
21
15
  };
@@ -40,13 +34,7 @@ export const getPageSettings = editor => {
40
34
  path: null,
41
35
  element: {
42
36
  pageProps: {
43
- pageWidth: "fixed",
44
- "lineHeight": {
45
- "xs": 1.43,
46
- "sm": 1.43,
47
- "md": 1.43,
48
- "lg": 1.43
49
- }
37
+ pageWidth: "fixed"
50
38
  }
51
39
  }
52
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "5.6.8",
3
+ "version": "5.7.0",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"
@@ -1,79 +0,0 @@
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;