@flozy/editor 4.8.2 → 4.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/dist/Editor/CommonEditor.js +6 -6
  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/Divider/Divider.js +9 -4
  7. package/dist/Editor/Elements/Embed/EmbedPopup.js +7 -1
  8. package/dist/Editor/Elements/Form/Form.js +38 -2
  9. package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +7 -1
  10. package/dist/Editor/Elements/Form/FormElements/FormDate.js +7 -1
  11. package/dist/Editor/Elements/Form/FormElements/FormEmail.js +7 -1
  12. package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +7 -1
  13. package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +7 -1
  14. package/dist/Editor/Elements/Form/FormElements/FormText.js +7 -1
  15. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +6 -1
  16. package/dist/Editor/Elements/Form/FormPopup.js +12 -9
  17. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +20 -1
  18. package/dist/Editor/Elements/Grid/GridItem.js +7 -2
  19. package/dist/Editor/Elements/Search/SearchAttachment.js +98 -0
  20. package/dist/Editor/Elements/Search/SearchButton.js +111 -0
  21. package/dist/Editor/Elements/Search/SearchList.js +207 -0
  22. package/dist/Editor/Styles/EditorStyles.js +1 -1
  23. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
  24. package/dist/Editor/Toolbar/Toolbar.js +8 -0
  25. package/dist/Editor/Toolbar/toolbarGroups.js +5 -0
  26. package/dist/Editor/assets/svg/BrainIcon.js +37 -0
  27. package/dist/Editor/assets/svg/DocsIcon.js +38 -0
  28. package/dist/Editor/assets/svg/UserIcon.js +23 -0
  29. package/dist/Editor/common/Icon.js +7 -1
  30. package/dist/Editor/common/MentionsPopup/index.js +4 -2
  31. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +0 -1
  32. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -1
  33. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +144 -12
  34. package/dist/Editor/common/RnD/Utils/gridDropItem.js +5 -3
  35. package/dist/Editor/common/Section/index.js +2 -4
  36. package/dist/Editor/common/Shorthands/elements.js +13 -0
  37. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +1 -1
  38. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +5 -2
  39. package/dist/Editor/common/StyleBuilder/formStyle.js +206 -119
  40. package/dist/Editor/common/StyleBuilder/gridItemStyle.js +5 -0
  41. package/dist/Editor/common/StyleBuilder/index.js +123 -10
  42. package/dist/Editor/plugins/withCustomDeleteBackward.js +53 -2
  43. package/dist/Editor/utils/Decorators/highlightSelection.js +22 -0
  44. package/dist/Editor/utils/Decorators/index.js +3 -2
  45. package/dist/Editor/utils/SlateUtilityFunctions.js +14 -0
  46. package/dist/Editor/utils/brains.js +16 -0
  47. package/dist/Editor/utils/font.js +11 -4
  48. package/dist/Editor/utils/formfield.js +8 -4
  49. package/dist/Editor/utils/helper.js +15 -2
  50. package/package.json +1 -1
@@ -22,7 +22,8 @@ const MentionsPopup = /*#__PURE__*/forwardRef((props, ref) => {
22
22
  chars,
23
23
  mentions,
24
24
  setMentions,
25
- type
25
+ type,
26
+ otherProps
26
27
  } = props;
27
28
  const classes = usePopupStyle(theme);
28
29
  const papperRef = useRef(null);
@@ -102,7 +103,8 @@ const MentionsPopup = /*#__PURE__*/forwardRef((props, ref) => {
102
103
  children: char.renderComponent ? char.renderComponent({
103
104
  ref: index === i ? buttonRef : null,
104
105
  selectionTarget: target,
105
- theme: theme
106
+ theme: theme,
107
+ otherProps
106
108
  }) : ListElement ? /*#__PURE__*/_jsx(ListElement, {
107
109
  classes: classes,
108
110
  data: char,
@@ -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();
@@ -7,7 +7,7 @@ import TuneIcon from "@mui/icons-material/Tune";
7
7
  import SectionPopup from "../../Elements/Grid/SectionPopup";
8
8
  import { getBreakPointsValue, getTRBLBreakPoints, groupByBreakpoint } from "../../helper/theme";
9
9
  import DragHandle from "../DnD/DragHandleButton";
10
- import { useEditorContext, useEditorSelection } from "../../hooks/useMouseMove";
10
+ import { useEditorSelection } from "../../hooks/useMouseMove";
11
11
  import SectionStyle from "./styles";
12
12
  import useWindowResize from "../../hooks/useWindowResize";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -16,9 +16,7 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
16
16
  const list_types = ["orderedList", "unorderedList"];
17
17
  const Section = props => {
18
18
  const themeReact = useTheme();
19
- const {
20
- theme
21
- } = useEditorContext();
19
+ const theme = props?.theme;
22
20
  const classes = SectionStyle(themeReact, theme);
23
21
  const {
24
22
  children,
@@ -13,6 +13,7 @@ import { insertDivider } from "../../utils/divider";
13
13
  import { insertFreeGrid } from "../../utils/freegrid";
14
14
  import { Transforms } from "slate";
15
15
  import { insertInfinityAI } from "../../utils/infinityAI";
16
+ import SearchButton from "../../Elements/Search/SearchButton";
16
17
  import { jsx as _jsx } from "react/jsx-runtime";
17
18
  const ELEMENTS_LIST = [{
18
19
  name: "Heading 1",
@@ -149,6 +150,18 @@ const ELEMENTS_LIST = [{
149
150
  ...rest,
150
151
  icoBtnType: "cmd"
151
152
  })
153
+ }, {
154
+ name: "Brain",
155
+ group: "Elements",
156
+ desc: "",
157
+ type: "search",
158
+ renderComponent: rest => /*#__PURE__*/_jsx(SearchButton, {
159
+ ...rest,
160
+ element: {
161
+ name: 'Brain'
162
+ },
163
+ icoBtnType: "cmd"
164
+ })
152
165
  }, {
153
166
  name: "Divider",
154
167
  group: "Elements",
@@ -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",
@@ -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({