@flozy/editor 4.8.0 → 4.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. package/dist/Editor/CommonEditor.js +3 -4
  2. package/dist/Editor/Editor.css +8 -1
  3. package/dist/Editor/Elements/AI/AIInput.js +4 -5
  4. package/dist/Editor/Elements/AI/PopoverAIInput.js +78 -62
  5. package/dist/Editor/Elements/AI/Styles.js +1 -0
  6. package/dist/Editor/Elements/AppHeader/AppHeader.js +12 -5
  7. package/dist/Editor/Elements/Embed/EmbedPopup.js +7 -1
  8. package/dist/Editor/Elements/Emoji/EmojiPicker.js +4 -2
  9. package/dist/Editor/Elements/Form/Form.js +38 -2
  10. package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +7 -1
  11. package/dist/Editor/Elements/Form/FormElements/FormDate.js +7 -1
  12. package/dist/Editor/Elements/Form/FormElements/FormEmail.js +7 -1
  13. package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +7 -1
  14. package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +7 -1
  15. package/dist/Editor/Elements/Form/FormElements/FormText.js +7 -1
  16. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +6 -1
  17. package/dist/Editor/Elements/Form/FormPopup.js +12 -9
  18. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +20 -1
  19. package/dist/Editor/Elements/Grid/GridItem.js +7 -2
  20. package/dist/Editor/Elements/Link/Link.js +0 -2
  21. package/dist/Editor/Styles/EditorStyles.js +1 -1
  22. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
  23. package/dist/Editor/common/FontLoader/FontLoader.js +2 -1
  24. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +0 -1
  25. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -1
  26. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +144 -12
  27. package/dist/Editor/common/RnD/Utils/gridDropItem.js +5 -3
  28. package/dist/Editor/common/RnD/index.js +2 -6
  29. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +1 -1
  30. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +2 -2
  31. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +5 -2
  32. package/dist/Editor/common/StyleBuilder/formStyle.js +206 -119
  33. package/dist/Editor/common/StyleBuilder/gridItemStyle.js +5 -0
  34. package/dist/Editor/common/StyleBuilder/index.js +123 -10
  35. package/dist/Editor/plugins/withCustomDeleteBackward.js +13 -0
  36. package/dist/Editor/utils/Decorators/highlightSelection.js +22 -0
  37. package/dist/Editor/utils/Decorators/index.js +3 -2
  38. package/dist/Editor/utils/SlateUtilityFunctions.js +9 -0
  39. package/dist/Editor/utils/font.js +11 -4
  40. package/dist/Editor/utils/formfield.js +8 -4
  41. package/dist/Editor/utils/helper.js +2 -2
  42. package/package.json +1 -1
@@ -81,7 +81,6 @@ const Link = props => {
81
81
  const btnProps = handleLinkType(urlPath, linkType, true, showInNewTab === "_blank");
82
82
  const navType = getLinkType(linkType, urlPath);
83
83
  const hideOpenLink = navType === "page" || !navType;
84
- console.log("linkType", linkType, navType, hideOpenLink);
85
84
  return selected && focused ? /*#__PURE__*/_jsxs("div", {
86
85
  className: "element-toolbar hr",
87
86
  contentEditable: false,
@@ -117,7 +116,6 @@ const Link = props => {
117
116
  }) : null;
118
117
  };
119
118
  const buttonProps = handleLinkType(urlPath, linkType, readOnly, showInNewTab === "_blank");
120
- console.log("buttonProps===>", buttonProps);
121
119
  return /*#__PURE__*/_jsxs("div", {
122
120
  className: "link",
123
121
  children: [/*#__PURE__*/_jsx(Box, {
@@ -286,7 +286,7 @@ const editorStyles = ({
286
286
  }
287
287
  },
288
288
  "& ::selection": {
289
- color: "black",
289
+ color: "inherit",
290
290
  background: "#EAEBFE"
291
291
  }
292
292
  },
@@ -13,6 +13,7 @@ import PopperHeader from "../PopperHeader";
13
13
  import MiniColorPicker from "./MiniColorPicker";
14
14
  import SelectAlignment from "./SelectAlignment";
15
15
  import SelectFontSize from "./SelectFontSize";
16
+ import InfinityAITool from "./InfinityAITool";
16
17
  import { jsx as _jsx } from "react/jsx-runtime";
17
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
18
19
  const DEFAULT_COLOR = {
@@ -49,7 +50,7 @@ const MiniTextFormat = props => {
49
50
  xs: 12,
50
51
  children: /*#__PURE__*/_jsxs("div", {
51
52
  className: "toolWrapper",
52
- children: [/*#__PURE__*/_jsx(SelectTypography, {
53
+ children: [customProps?.hideTools?.includes("infinityAI") ? null : /*#__PURE__*/_jsx(InfinityAITool, {}), /*#__PURE__*/_jsx(SelectTypography, {
53
54
  classes: classes,
54
55
  editor: editor,
55
56
  closeMainPopup: closeMainPopup
@@ -84,7 +84,8 @@ const FontLoader = props => {
84
84
  });
85
85
  let families = Array.from(fontSet);
86
86
  families = correctFontArray(families.join(", "));
87
- families = families.map(font => font.replace(/\"/g, ""));
87
+ families = families?.map(font => font?.replace(/\"/g, ""));
88
+ families = families?.map(font => font?.replace(", sans-serif", "")); //This is temporary fix for patch
88
89
  loadFontsInBatches(families);
89
90
  }
90
91
  }, []);
@@ -1,5 +1,4 @@
1
1
  import React from "react";
2
- import { Node } from "slate";
3
2
  import { Dialog, DialogContent, DialogTitle, IconButton } from "@mui/material";
4
3
  import SaveAsTemplate from "../../../StyleBuilder/fieldTypes/saveAsTemplate";
5
4
  import { CloseIcon } from "../../../iconslist";
@@ -12,7 +12,7 @@ const Settings = props => {
12
12
  childType,
13
13
  open,
14
14
  anchorEl,
15
- placement,
15
+ // placement,
16
16
  onClose,
17
17
  editor,
18
18
  classes,
@@ -1,10 +1,12 @@
1
1
  import React from "react";
2
2
  import { Transforms, Node } from "slate";
3
- import { Box } from "@mui/material";
3
+ import { Accordion, AccordionDetails, AccordionSummary, Box, createTheme, ThemeProvider, Typography } from "@mui/material";
4
4
  import { StyleContent } from "../../../StyleBuilder";
5
- import formStyle from "../../../StyleBuilder/formStyle";
5
+ import { formStyle } from "../../../StyleBuilder/formStyle";
6
6
  import { ReactEditor } from "slate-react";
7
+ import { ExpandMoreOutlined } from "@mui/icons-material";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
10
  const FormSettings = props => {
9
11
  const {
10
12
  editor,
@@ -14,7 +16,10 @@ const FormSettings = props => {
14
16
  const item_path = path?.split("|").map(m => parseInt(m));
15
17
  const element_path = [...item_path];
16
18
  const element = Node.get(editor, element_path);
17
- const styleMaps = formStyle?.filter(f => !f?.hideOnFGS);
19
+ const styleMaps = formStyle;
20
+ const {
21
+ hideTools
22
+ } = customProps || {};
18
23
  const onChange = data => {
19
24
  const currentPath = ReactEditor.findPath(editor, element);
20
25
  const updateData = {
@@ -26,23 +31,150 @@ const FormSettings = props => {
26
31
  }, {
27
32
  at: [...currentPath, 0]
28
33
  });
34
+ // adding form field style to the current form node
35
+ const currentNode = Node.get(editor, element_path);
36
+ if (currentNode) {
37
+ currentNode?.children[0]?.children?.forEach((item, index) => {
38
+ Transforms.setNodes(editor, {
39
+ bgColor: data?.fieldBgColor ? data?.fieldBgColor : item?.bgColor,
40
+ borderColor: data?.fieldBorderColor ? data?.fieldBorderColor : item?.borderColor,
41
+ borderStyle: data?.fieldBorderStyle ? data?.fieldBorderStyle : item?.borderStyle,
42
+ borderWidth: data?.fieldBorderWidth ? data?.fieldBorderWidth : item?.borderWidth,
43
+ textColor: data?.fieldTextColor ? data?.fieldTextColor : item?.textColor,
44
+ fontFamily: data?.fieldFontFamily ? data?.fieldFontFamily : item?.fontFamily,
45
+ textSize: data?.fieldTextSize ? data?.fieldTextSize : item?.textSize,
46
+ fontWeight: data?.fieldFontWeight ? data?.fieldFontWeight : item?.fontWeight
47
+ }, {
48
+ at: [...currentPath, 0, index]
49
+ });
50
+ });
51
+ }
29
52
  };
30
53
  const handleClose = () => {
31
54
  console.log("close");
32
55
  };
56
+ const muiTheme = createTheme({
57
+ components: {
58
+ MuiAccordion: {
59
+ styleOverrides: {
60
+ root: {
61
+ padding: "0px",
62
+ "&.Mui-expanded": {
63
+ margin: "0"
64
+ }
65
+ }
66
+ },
67
+ defaultProps: {
68
+ elevation: 0
69
+ }
70
+ }
71
+ }
72
+ });
33
73
  return /*#__PURE__*/_jsx(Box, {
34
74
  component: "div",
35
75
  className: "item-w",
36
76
  children: styleMaps?.map((m, i) => {
37
- return /*#__PURE__*/_jsx(StyleContent, {
38
- renderTabs: styleMaps,
39
- value: m.value,
40
- element: element,
41
- customElement: element?.children?.[0] || null,
42
- onChange: onChange,
43
- customProps: customProps,
44
- handleClose: handleClose
45
- }, `tab_${m.value}_$${i}`);
77
+ if (m?.hasChildrenTabs) {
78
+ return /*#__PURE__*/_jsx(ThemeProvider, {
79
+ theme: muiTheme,
80
+ children: /*#__PURE__*/_jsxs(Accordion, {
81
+ defaultExpanded: true,
82
+ children: [/*#__PURE__*/_jsx(AccordionSummary, {
83
+ expandIcon: /*#__PURE__*/_jsx(ExpandMoreOutlined, {}),
84
+ sx: {
85
+ padding: "0px"
86
+ },
87
+ children: /*#__PURE__*/_jsx(Typography, {
88
+ variant: "h3",
89
+ className: "settingsHeader",
90
+ color: "primary",
91
+ style: {
92
+ fontSize: "14px !important",
93
+ fontWeight: "400"
94
+ },
95
+ children: m?.tab
96
+ })
97
+ }), /*#__PURE__*/_jsx(AccordionDetails, {
98
+ sx: {
99
+ padding: "5px"
100
+ },
101
+ children: m?.fields.filter(f => (hideTools || []).indexOf(f.value) === -1).map((field, index) => {
102
+ return /*#__PURE__*/_jsx(ThemeProvider, {
103
+ theme: muiTheme,
104
+ children: /*#__PURE__*/_jsxs(Accordion, {
105
+ defaultExpanded: true,
106
+ children: [/*#__PURE__*/_jsx(AccordionSummary, {
107
+ expandIcon: /*#__PURE__*/_jsx(ExpandMoreOutlined, {}),
108
+ sx: {
109
+ padding: "0px"
110
+ },
111
+ children: /*#__PURE__*/_jsx(Typography, {
112
+ variant: "h3",
113
+ className: "settingsHeader",
114
+ color: "primary",
115
+ style: {
116
+ fontSize: "14px !important",
117
+ fontWeight: "400"
118
+ },
119
+ children: field?.tab
120
+ })
121
+ }), /*#__PURE__*/_jsx(AccordionDetails, {
122
+ sx: {
123
+ padding: "0px"
124
+ },
125
+ children: /*#__PURE__*/_jsx(StyleContent, {
126
+ renderTabs: [field],
127
+ value: field.value,
128
+ element: element,
129
+ onChange: onChange,
130
+ customElement: element?.children?.[0] || null,
131
+ customProps: customProps,
132
+ handleClose: handleClose
133
+ }, `tab_${field.value}_${index}`)
134
+ })]
135
+ }, `accordion_${index}`)
136
+ }, index);
137
+ })
138
+ })]
139
+ }, `accordion_${i}`)
140
+ }, i);
141
+ } else {
142
+ return /*#__PURE__*/_jsx(ThemeProvider, {
143
+ theme: muiTheme,
144
+ children: /*#__PURE__*/_jsxs(Accordion, {
145
+ defaultExpanded: true,
146
+ children: [/*#__PURE__*/_jsx(AccordionSummary, {
147
+ expandIcon: /*#__PURE__*/_jsx(ExpandMoreOutlined, {}),
148
+ sx: {
149
+ padding: "0px"
150
+ },
151
+ children: /*#__PURE__*/_jsx(Typography, {
152
+ variant: "h3",
153
+ className: "settingsHeader",
154
+ color: "primary",
155
+ style: {
156
+ fontSize: "14px !important",
157
+ fontWeight: "400"
158
+ },
159
+ children: m?.tab
160
+ })
161
+ }), /*#__PURE__*/_jsx(AccordionDetails, {
162
+ sx: {
163
+ padding: "0px"
164
+ },
165
+ children: /*#__PURE__*/_jsx(StyleContent, {
166
+ renderTabs: styleMaps,
167
+ value: m.value,
168
+ element: element,
169
+ customElement: element?.children?.[0] || null,
170
+ onChange: onChange,
171
+ customProps: customProps,
172
+ handleClose: handleClose
173
+ }, `tab_${m.value}_$${i}`)
174
+ })]
175
+ }, `accordion_${i}`)
176
+ }, i);
177
+ }
46
178
  })
47
179
  });
48
180
  };
@@ -123,8 +123,8 @@ export function onDropItem(props, parentClass) {
123
123
  dragOver,
124
124
  parentPath,
125
125
  path,
126
- diffX,
127
- x: cx,
126
+ // diffX,
127
+ // x: cx,
128
128
  breakpoint
129
129
  // calX,
130
130
  } = props;
@@ -134,7 +134,9 @@ export function onDropItem(props, parentClass) {
134
134
  let newPath = [];
135
135
  newPath = moveTo;
136
136
  const cCalx = isContainerElement(editor, moveTo, props);
137
- const posX = parseInt(cx - window.innerWidth / 2 + MARGIN_OF[breakpoint] - diffX);
137
+ // const posX = parseInt(
138
+ // cx - window.innerWidth / 2 + MARGIN_OF[breakpoint] - diffX
139
+ // );
138
140
  const toSectionNode = Node.get(editor, newPath);
139
141
  const addToSectionDOM = ReactEditor.toDOMNode(editor, toSectionNode);
140
142
  const rect = addToSectionDOM.getBoundingClientRect();
@@ -171,14 +171,10 @@ const RnD = props => {
171
171
  anchorEl: rndRef?.current
172
172
  });
173
173
  }
174
- focusSelection(editor, {
175
- path
176
- });
174
+ // focusSelection(editor, { path });temporary fix for scroll issue
177
175
  break;
178
176
  case 2:
179
- focusSelection(editor, {
180
- path
181
- });
177
+ // focusSelection(editor, { path });temporary fix for scroll issue
182
178
  setSelectedElement({
183
179
  path: str_path,
184
180
  enable: EDIT_MODES.includes(childType) ? 2 : 1,
@@ -9,7 +9,7 @@ const embedVideoStyle = [{
9
9
  }]
10
10
  }, {
11
11
  tab: "Aspect Ratio",
12
- value: "Aspect Ratio",
12
+ value: "AspectRatio",
13
13
  hideOnFGS: true,
14
14
  fields: [{
15
15
  label: "Aspect Ratio",
@@ -118,14 +118,14 @@ const SaveAsTemplate = props => {
118
118
  children: "Section"
119
119
  })
120
120
  }), /*#__PURE__*/_jsx(MenuItem, {
121
- value: "Templates",
121
+ value: "Template",
122
122
  children: /*#__PURE__*/_jsx(Typography, {
123
123
  variant: "body1",
124
124
  color: "primary",
125
125
  sx: {
126
126
  fontSize: "14px"
127
127
  },
128
- children: "Templates"
128
+ children: "Template"
129
129
  })
130
130
  })]
131
131
  })
@@ -5,6 +5,8 @@ import useWindowResize from "../../../hooks/useWindowResize";
5
5
  import { useEditorContext } from "../../../hooks/useMouseMove";
6
6
  import FontFamilyAutocomplete from "../../../Toolbar/FormatTools/FontFamilyAutocomplete";
7
7
  import { useSlate } from "slate-react";
8
+
9
+ // hideMetaDataOptions -- pass true to hide metadata option in select field
8
10
  import { jsx as _jsx } from "react/jsx-runtime";
9
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
12
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -26,7 +28,8 @@ const TextOptions = props => {
26
28
  options,
27
29
  renderOption,
28
30
  width,
29
- webFont = false
31
+ webFont = false,
32
+ hideMetaDataOptions = false
30
33
  } = data;
31
34
  const {
32
35
  fontFamilies
@@ -35,7 +38,7 @@ const TextOptions = props => {
35
38
  const [size] = useWindowResize();
36
39
  const value = isBreakpoint ? getBreakPointsValue(val, size?.device) : val;
37
40
  const metaDataMappingOptions = metaMappings?.boards || [];
38
- const updatedOption = elementProps?.metadatamapping ? [...options, ...metaDataMappingOptions] : webFont ? fontFamilies?.options : options;
41
+ const updatedOption = !hideMetaDataOptions && elementProps?.metadatamapping ? [...options, ...metaDataMappingOptions] : webFont ? fontFamilies?.options : options;
39
42
  const handleChange = (e, d) => {
40
43
  if (isBreakpoint) {
41
44
  onChange({