@flozy/editor 5.9.0 → 5.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/Editor/CommonEditor.js +6 -11
  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 +1 -8
  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 +2 -9
  35. package/dist/Editor/common/FontLoader/FontList.js +11 -3
  36. package/dist/Editor/common/FontLoader/FontLoader.js +10 -14
  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/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
  40. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
  41. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
  42. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +0 -4
  43. package/dist/Editor/common/Uploader.js +0 -8
  44. package/dist/Editor/common/iconslist.js +2 -1
  45. package/dist/Editor/commonStyle.js +57 -58
  46. package/dist/Editor/helper/index.js +2 -2
  47. package/dist/Editor/helper/theme.js +1 -24
  48. package/dist/Editor/hooks/useMouseMove.js +2 -5
  49. package/dist/Editor/plugins/withLayout.js +1 -1
  50. package/dist/Editor/utils/SlateUtilityFunctions.js +4 -10
  51. package/dist/Editor/utils/button.js +4 -4
  52. package/dist/Editor/utils/customHooks/useTableResize.js +1 -2
  53. package/dist/Editor/utils/draftToSlate.js +2 -3
  54. package/dist/Editor/utils/helper.js +19 -60
  55. package/dist/Editor/utils/pageSettings.js +2 -14
  56. package/dist/Editor/utils/table.js +0 -21
  57. package/package.json +1 -1
  58. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
  59. package/dist/Editor/helper/ensureWrappedVariables.js +0 -28
@@ -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.2",
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;
@@ -1,28 +0,0 @@
1
- export const ensureWrappedVariables = content => {
2
- return content.map(node => {
3
- if (node.children) {
4
- return {
5
- ...node,
6
- children: node.children.reduce((result, child, index, arr) => {
7
- if (child.type === "variables") {
8
- if (index === 0 || !arr[index - 1].text || arr[index - 1].text.trim() === "") {
9
- result.push({
10
- text: ""
11
- });
12
- }
13
- result.push(child);
14
- if (index === arr.length - 1 || !arr[index + 1]?.text || arr[index + 1]?.text.trim() === "") {
15
- result.push({
16
- text: ""
17
- });
18
- }
19
- } else {
20
- result.push(child);
21
- }
22
- return result;
23
- }, [])
24
- };
25
- }
26
- return node;
27
- });
28
- };