@flozy/editor 5.9.0 → 5.9.1

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 +15 -22
  2. package/dist/Editor/Editor.css +16 -22
  3. package/dist/Editor/Elements/AI/PopoverAIInput.js +12 -2
  4. package/dist/Editor/Elements/Button/EditorButton.js +1 -3
  5. package/dist/Editor/Elements/DataView/DataView.js +3 -4
  6. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +14 -8
  7. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +1 -5
  8. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +1 -5
  9. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +19 -23
  10. package/dist/Editor/Elements/Form/Form.js +0 -1
  11. package/dist/Editor/Elements/FreeGrid/styles.js +0 -1
  12. package/dist/Editor/Elements/Grid/GridItem.js +2 -1
  13. package/dist/Editor/Elements/Link/Link.js +43 -70
  14. package/dist/Editor/Elements/List/CheckList.js +1 -2
  15. package/dist/Editor/Elements/Search/SearchAttachment.js +0 -1
  16. package/dist/Editor/Elements/Search/SearchList.js +1 -8
  17. package/dist/Editor/Elements/SimpleText/index.js +11 -13
  18. package/dist/Editor/Elements/SimpleText/style.js +1 -5
  19. package/dist/Editor/Elements/Table/Table.js +3 -3
  20. package/dist/Editor/Elements/Table/TableCell.js +9 -14
  21. package/dist/Editor/Elements/Title/title.js +1 -13
  22. package/dist/Editor/Elements/Variables/Style.js +2 -28
  23. package/dist/Editor/Elements/Variables/VariableButton.js +4 -17
  24. package/dist/Editor/MiniEditor.js +2 -4
  25. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +28 -37
  26. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +1 -3
  27. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
  28. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +1 -3
  29. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +1 -1
  30. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +3 -9
  31. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +0 -5
  32. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
  33. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +0 -45
  34. package/dist/Editor/Toolbar/PopupTool/index.js +31 -30
  35. package/dist/Editor/common/FontLoader/FontList.js +11 -3
  36. package/dist/Editor/common/FontLoader/FontLoader.js +11 -28
  37. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +0 -1
  38. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -14
  39. package/dist/Editor/common/Section/index.js +97 -78
  40. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
  41. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
  42. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
  43. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +0 -4
  44. package/dist/Editor/common/Uploader.js +0 -8
  45. package/dist/Editor/common/iconslist.js +2 -1
  46. package/dist/Editor/commonStyle.js +57 -58
  47. package/dist/Editor/helper/index.js +2 -2
  48. package/dist/Editor/helper/theme.js +1 -24
  49. package/dist/Editor/hooks/useEditorScroll.js +1 -1
  50. package/dist/Editor/hooks/useMouseMove.js +2 -5
  51. package/dist/Editor/plugins/withLayout.js +1 -1
  52. package/dist/Editor/utils/SlateUtilityFunctions.js +4 -15
  53. package/dist/Editor/utils/button.js +4 -4
  54. package/dist/Editor/utils/customHooks/useTableResize.js +1 -2
  55. package/dist/Editor/utils/draftToSlate.js +2 -3
  56. package/dist/Editor/utils/helper.js +19 -60
  57. package/dist/Editor/utils/pageSettings.js +2 -14
  58. package/dist/Editor/utils/table.js +0 -21
  59. package/package.json +2 -2
  60. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
  61. package/dist/Editor/helper/ensureWrappedVariables.js +0 -28
@@ -49,19 +49,15 @@ 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
- },
58
52
  "& p": {
59
53
  marginBottom: "7px",
60
54
  marginTop: "4px"
61
55
  },
62
- "& p": {
63
- marginBottom: "7px",
64
- marginTop: "4px"
56
+ "& .MuiPaper-root": {
57
+ border: 'unset !important',
58
+ borderRadius: '0px',
59
+ height: 'fit-content',
60
+ padding: '2px'
65
61
  },
66
62
  "& .muiIconsListParent": {
67
63
  "& svg": {
@@ -75,12 +71,15 @@ const useCommonStyle = theme => ({
75
71
  },
76
72
  "&::-webkit-scrollbar-thumb": {
77
73
  background: `${theme?.palette?.editor?.brainPopupScroll} !important`
74
+ },
75
+ "&::-webkit-scrollbar-track": {
76
+ visibility: "hidden"
78
77
  }
79
78
  },
80
79
  "& .MuiGrid-root>.MuiGrid-item": {
81
80
  paddingRight: "0px !important",
82
81
  fontFamily: "Inter, sans-serif",
83
- height: "fit-content"
82
+ height: 'fit-content'
84
83
  },
85
84
  "& .MuiInputBase-root": {
86
85
  borderRadius: "10px",
@@ -141,11 +140,11 @@ const useCommonStyle = theme => ({
141
140
  borderRadius: "10px",
142
141
  width: "46px !important",
143
142
  marginLeft: "10px",
144
- height: "36px !important"
143
+ height: '36px !important'
145
144
  }
146
145
  },
147
- "& .MuiFormHelperText-root": {
148
- margin: "4px 0px 0px 0px",
146
+ '& .MuiFormHelperText-root': {
147
+ margin: '4px 0px 0px 0px',
149
148
  color: theme?.palette?.editor?.closeButtonSvgStroke,
150
149
  fontFamily: "Inter, sans-serif"
151
150
  }
@@ -401,14 +400,14 @@ const useCommonStyle = theme => ({
401
400
  padding: "8px 12px",
402
401
  fontSize: "12px",
403
402
  color: theme?.palette?.editor?.menuOptionTextColor,
404
- fontWeight: "500",
403
+ fontWeight: '500',
405
404
  fontFamily: "Inter, sans-serif",
406
- minHeight: "36px",
405
+ minHeight: '36px',
407
406
  "&:hover": {
408
407
  backgroundColor: theme?.palette?.editor?.menuOptionHoverBackground
409
408
  }
410
409
  },
411
- "& .Mui-selected": {
410
+ '& .Mui-selected': {
412
411
  background: `${theme?.palette?.editor?.menuOptionSelectedOption} !important`
413
412
  },
414
413
  "& .MuiListSubheader-root": {
@@ -417,16 +416,16 @@ const useCommonStyle = theme => ({
417
416
  fontSize: "12px"
418
417
  },
419
418
  "& .MuiPaper-root": {
420
- borderRadius: "8px",
421
- padding: "0px",
419
+ borderRadius: '8px',
420
+ padding: '0px',
422
421
  background: `${theme?.palette?.editor?.textWeightPopUpBackground} !important`
423
422
  },
424
- "& .MuiButtonBase-root": {
425
- margin: "4px",
426
- borderRadius: "6px"
423
+ '& .MuiButtonBase-root': {
424
+ margin: '4px',
425
+ borderRadius: '6px'
427
426
  },
428
- "& .MuiList-root": {
429
- padding: "0px"
427
+ '& .MuiList-root': {
428
+ padding: '0px'
430
429
  }
431
430
  },
432
431
  datePicker: {
@@ -471,27 +470,27 @@ const useCommonStyle = theme => ({
471
470
  }
472
471
  }
473
472
  },
473
+ pageSettingPopUpRoot: {
474
+ padding: "16px 8px 16px 10px!important",
475
+ height: "100%"
476
+ },
474
477
  buttonMoreOption: {
475
478
  background: `${theme?.palette?.editor?.aiInputBackground} !important`,
476
479
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
477
- padding: "4px !important",
478
- "& svg": {
479
- width: "18px !important",
480
- height: "18px !important",
481
- "& path": {
480
+ padding: '4px !important',
481
+ '& svg': {
482
+ width: '18px !important',
483
+ height: '18px !important',
484
+ '& path': {
482
485
  stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
483
486
  }
484
487
  }
485
488
  },
486
- pageSettingPopUpRoot: {
487
- padding: "16px 8px 16px 10px!important",
488
- height: "100%"
489
- },
490
489
  buttonMoreOption2: {
491
490
  background: `${theme?.palette?.editor?.aiInputBackground} !important`,
492
491
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
493
- "& svg": {
494
- "& path": {
492
+ '& svg': {
493
+ '& path': {
495
494
  fill: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
496
495
  }
497
496
  }
@@ -499,11 +498,11 @@ const useCommonStyle = theme => ({
499
498
  buttonMoreOption3: {
500
499
  background: `${theme?.palette?.editor?.aiInputBackground} !important`,
501
500
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1} !important`,
502
- padding: "5px !important",
503
- "& svg": {
504
- width: "16px !important",
505
- height: "16px !important",
506
- "& path": {
501
+ padding: '5px !important',
502
+ '& svg': {
503
+ width: '16px !important',
504
+ height: '16px !important',
505
+ '& path': {
507
506
  stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
508
507
  }
509
508
  }
@@ -511,37 +510,37 @@ const useCommonStyle = theme => ({
511
510
  resizeButton: {
512
511
  background: theme?.palette?.editor?.aiInputBackground,
513
512
  border: `1px solid ${theme?.palette?.editor?.buttonBorder1}`,
514
- padding: "5px !important",
515
- borderRadius: "50% !important",
516
- "& svg": {
517
- width: "18px",
518
- height: "18px",
519
- "& path": {
513
+ padding: '5px !important',
514
+ borderRadius: '50% !important',
515
+ '& svg': {
516
+ width: '18px',
517
+ height: '18px',
518
+ '& path': {
520
519
  fill: `${theme?.palette?.editor?.closeButtonSvgStroke}`
521
520
  }
522
521
  },
523
- "&:hover": {
522
+ '&:hover': {
524
523
  background: theme?.palette?.editor?.aiInputBackground
525
524
  }
526
525
  },
527
526
  gradientFillBtn: {
528
527
  background: `linear-gradient(112.61deg, #2C63ED 19.3%, #8360FD 88.14%) !important`,
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"
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'
536
535
  },
537
536
  emptyThumbBtn: {
538
537
  background: `${theme?.palette?.editor?.sectionSettingIconHover} !important`,
539
538
  color: `${theme?.palette?.editor?.textColor} !important`,
540
- fontSize: "14px !important",
541
- "& svg": {
542
- width: "20px !important",
543
- height: "20px !important",
544
- "& path": {
539
+ fontSize: '14px !important',
540
+ '& svg': {
541
+ width: '20px !important',
542
+ height: '20px !important',
543
+ '& path': {
545
544
  stroke: `${theme?.palette?.editor?.closeButtonSvgStroke} !important`
546
545
  }
547
546
  }
@@ -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);
@@ -5,7 +5,7 @@ function useEditorScroll(editorWrapper = {
5
5
  useEffect(() => {
6
6
  const handleScroll = () => {
7
7
  if (editorWrapper.current) {
8
- callback("scroll");
8
+ callback();
9
9
  }
10
10
  };
11
11
  const currentEditorWrapper = editorWrapper.current;
@@ -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, {
@@ -173,9 +173,10 @@ export const getMarked = (leaf, children, theme) => {
173
173
  if (leaf.highlight) {
174
174
  children = /*#__PURE__*/_jsx("span", {
175
175
  style: {
176
- color: "inherit",
177
- background: "var(--slate-highlight-bg)"
176
+ color: "inherit"
178
177
  },
178
+ className: "slate-highlight" // while opening AI, we will use this element to highlight the selection. (PopoverAIInput.js)
179
+ ,
179
180
  children: children
180
181
  });
181
182
  }
@@ -337,8 +338,7 @@ export const getBlock = props => {
337
338
  borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
338
339
  margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
339
340
  width: element?.bgColor ? "calc(100% - 16px)" : "100%",
340
- borderWidth: element?.color ? "0px 0px 0px 3px" : "0px",
341
- lineHeight: 1.43
341
+ borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
342
342
  },
343
343
  children: children
344
344
  });
@@ -398,9 +398,6 @@ export const getBlock = props => {
398
398
  });
399
399
  case "orderedList":
400
400
  return /*#__PURE__*/_jsx("ol", {
401
- style: {
402
- lineHeight: 1.43
403
- },
404
401
  className: "listItemMargin",
405
402
  type: "1",
406
403
  ...attributes,
@@ -408,9 +405,6 @@ export const getBlock = props => {
408
405
  });
409
406
  case "unorderedList":
410
407
  return /*#__PURE__*/_jsx("ul", {
411
- style: {
412
- lineHeight: 1.43
413
- },
414
408
  className: "listItemMargin",
415
409
  ...attributes,
416
410
  children: children
@@ -620,11 +614,6 @@ export const getBlock = props => {
620
614
  children: children
621
615
  });
622
616
  default:
623
- // return (
624
- // <span {...attributes} {...element.attr}>
625
- // {children}
626
- // </span>
627
- // );
628
617
  return /*#__PURE__*/_jsx(SimpleText, {
629
618
  ...props,
630
619
  isEmpty: isEmpty
@@ -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
  };
@@ -43,8 +43,7 @@ const useTableResize = ({
43
43
  minWidth
44
44
  } = minMaxProps || {};
45
45
  setSize(currentSize => {
46
- const width = currentSize?.width || parentDOM?.clientWidth;
47
- const calcWidth = width + e.movementX;
46
+ const calcWidth = currentSize?.width + e.movementX;
48
47
  return {
49
48
  width: minWidth && calcWidth < minWidth ? minWidth : calcWidth,
50
49
  height: currentSize.height + e.movementY,
@@ -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
  }]
@@ -625,10 +625,6 @@ export const isRestrictedNode = (event, editor) => {
625
625
  return isNodeRestricted;
626
626
  }
627
627
  };
628
- export function capitalizeFirstLetter(str) {
629
- if (!str) return str;
630
- return str.charAt(0).toUpperCase() + str.slice(1);
631
- }
632
628
  export const insertLineBreakAtEndOfPath = (editor, path) => {
633
629
  try {
634
630
  const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
@@ -647,13 +643,6 @@ export const insertLineBreakAtEndOfPath = (editor, path) => {
647
643
  console.log(err);
648
644
  }
649
645
  };
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
646
  const omitNodes = ["site-settings", "page-settings"];
658
647
  export function getInitialValue(value = [], readOnly) {
659
648
  if (readOnly === "readonly" && value?.length) {
@@ -684,17 +673,20 @@ export function getInitialValue(value = [], readOnly) {
684
673
  }
685
674
  return value;
686
675
  }
676
+ export function capitalizeFirstLetter(str) {
677
+ if (!str) return str;
678
+ return str.charAt(0).toUpperCase() + str.slice(1);
679
+ }
680
+ export function isHavingSelection(editor) {
681
+ try {
682
+ return editor?.selection && !Range.isCollapsed(editor.selection);
683
+ } catch (err) {
684
+ console.log(err);
685
+ }
686
+ }
687
687
  export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
688
688
  return `${defaultCls} ${selected ? selectedClsName : ""}`;
689
689
  }
690
- export function handleNegativeInteger(val) {
691
- return val < 0 ? 0 : val;
692
- }
693
- export const containsSurrogatePair = text => {
694
- // Match surrogate pairs (high and low surrogate)
695
- const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
696
- return surrogatePairRegex.test(text);
697
- };
698
690
  export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
699
691
  try {
700
692
  const options = {
@@ -708,6 +700,11 @@ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
708
700
  return [];
709
701
  }
710
702
  };
703
+ export const containsSurrogatePair = text => {
704
+ // Match surrogate pairs (high and low surrogate)
705
+ const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
706
+ return surrogatePairRegex.test(text);
707
+ };
711
708
  export const getSlateDom = (editor, range) => {
712
709
  try {
713
710
  const slateDom = ReactEditor.toDOMRange(editor, range);
@@ -716,44 +713,6 @@ export const getSlateDom = (editor, range) => {
716
713
  console.log(err);
717
714
  }
718
715
  };
719
-
720
- // The inputs inside the dynamic table lose focus after calling `setNodes` on the first `onChange` event.
721
- // To replicate this issue, insert some paragraph nodes above the dynamic table, then type something in the title.
722
- // After typing the first word, the input loses focus.
723
- export const focusDynamicTableInput = e => {
724
- setTimeout(() => {
725
- const input = document.getElementById(e.target.id);
726
- if (input) {
727
- // Check if the input is not already focused
728
- if (document.activeElement !== input) {
729
- const length = input.value.length;
730
- // Focus on the input
731
- input.focus();
732
-
733
- // number input not supports selection
734
- if (e.target.type !== "number") {
735
- // Set the cursor to the end
736
- input.setSelectionRange(length, length);
737
- }
738
- }
739
- }
740
- }, 0);
741
- };
742
- export const clearWindowSelection = () => {
743
- const selection = window.getSelection();
744
- if (selection) {
745
- selection.removeAllRanges(); // Clears the selection
746
- }
747
- };
748
-
749
- export const viewSlateSelection = () => {
750
- // if ai is opened, remove the window selection class and open then slate selection, To resolve: focussing on the ai input removes window selection automatically
751
- clearWindowSelection();
752
- const selectionBg = "rgba(35, 131, 226, 0.35)";
753
- const root = document.documentElement;
754
- root.style.setProperty("--slate-highlight-bg", selectionBg);
755
- };
756
- export const hideSlateSelection = () => {
757
- const root = document.documentElement;
758
- root.style.setProperty("--slate-highlight-bg", "none");
759
- };
716
+ export function handleNegativeInteger(val) {
717
+ return val < 0 ? 0 : val;
718
+ }
@@ -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
  };
@@ -753,25 +753,4 @@ export const clearCellText = (editor, currentCellPath) => {
753
753
  } catch (err) {
754
754
  console.log(err);
755
755
  }
756
- };
757
- export const getTableColumns = element => {
758
- const {
759
- columns,
760
- children
761
- } = element || {};
762
- if (columns) {
763
- return columns;
764
- }
765
- const firstRow = children?.length ? children[0] : {};
766
- return firstRow?.children?.length || 0;
767
- };
768
- export const getTableRows = element => {
769
- const {
770
- rows,
771
- children
772
- } = element || {};
773
- if (rows) {
774
- return rows;
775
- }
776
- return children?.length || 0;
777
756
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "5.9.0",
3
+ "version": "5.9.1",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"
@@ -69,7 +69,7 @@
69
69
  "storybook": "storybook dev -p 6006",
70
70
  "build-storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook build",
71
71
  "publish:npm": "rm -rf dist && mkdir dist && babel src/components -d dist --copy-files",
72
- "publish:local": "rm -rf /Users/agmac03/flozy/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agmac03/flozy/client/node_modules/@flozy/editor/dist --copy-files"
72
+ "publish:local": "rm -rf /Users/agmac30/Documents/CODE_BASE/flozy/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agmac30/Documents/CODE_BASE/flozy/client/node_modules/@flozy/editor/dist --copy-files"
73
73
  },
74
74
  "eslintConfig": {
75
75
  "extends": [
@@ -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;