@flozy/editor 4.0.7 → 4.0.8

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 (53) hide show
  1. package/dist/Editor/ChatEditor.js +21 -25
  2. package/dist/Editor/CommonEditor.js +3 -0
  3. package/dist/Editor/Editor.css +12 -1
  4. package/dist/Editor/Elements/Accordion/Accordion.js +1 -1
  5. package/dist/Editor/Elements/Accordion/AccordionSummary.js +21 -5
  6. package/dist/Editor/Elements/EmbedScript/Code.js +14 -12
  7. package/dist/Editor/Elements/EmbedScript/EmbedScript.js +7 -115
  8. package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +130 -0
  9. package/dist/Editor/Elements/Emoji/EmojiPicker.js +4 -2
  10. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +35 -2
  11. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +8 -2
  12. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +43 -6
  13. package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +4 -0
  14. package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +3 -1
  15. package/dist/Editor/Elements/FreeGrid/styles.js +9 -0
  16. package/dist/Editor/Elements/List/CheckList.js +2 -1
  17. package/dist/Editor/Elements/Table/Table.js +1 -1
  18. package/dist/Editor/Elements/Table/TableCell.js +1 -1
  19. package/dist/Editor/Elements/Table/TableRow.js +2 -1
  20. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +66 -0
  21. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +9 -8
  22. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +8 -4
  23. package/dist/Editor/common/ColorPickerButton.js +12 -4
  24. package/dist/Editor/common/FontLoader/FontLoader.js +68 -0
  25. package/dist/Editor/common/Icon.js +4 -0
  26. package/dist/Editor/common/RnD/ElementOptions/Actions.js +7 -0
  27. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +4 -2
  28. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +47 -0
  29. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +4 -2
  30. package/dist/Editor/common/RnD/ElementSettings/Settings/index.js +3 -1
  31. package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +4 -2
  32. package/dist/Editor/common/RnD/OptionsPopup/style.js +23 -4
  33. package/dist/Editor/common/RnD/index.js +5 -3
  34. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -1
  35. package/dist/Editor/common/StyleBuilder/appHeaderStyle.js +1 -0
  36. package/dist/Editor/common/StyleBuilder/boxStyle.js +31 -0
  37. package/dist/Editor/common/StyleBuilder/buttonStyle.js +1 -0
  38. package/dist/Editor/common/StyleBuilder/embedScriptStyle.js +10 -0
  39. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +15 -9
  40. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +18 -16
  41. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +6 -4
  42. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +19 -3
  43. package/dist/Editor/common/StyleBuilder/formButtonStyle.js +1 -0
  44. package/dist/Editor/common/StyleBuilder/formStyle.js +1 -0
  45. package/dist/Editor/helper/deserialize/index.js +3 -0
  46. package/dist/Editor/helper/index.js +22 -0
  47. package/dist/Editor/helper/theme.js +2 -1
  48. package/dist/Editor/hooks/useMouseMove.js +4 -1
  49. package/dist/Editor/utils/SlateUtilityFunctions.js +4 -10
  50. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +9 -0
  51. package/dist/Editor/utils/embedScript.js +20 -2
  52. package/dist/Editor/utils/mentions.js +2 -0
  53. package/package.json +2 -1
@@ -13,6 +13,7 @@ import { bringItemToFB } from "../../helper";
13
13
  import itemOptions from "./Options/sectionItemOptions";
14
14
  import { formField } from "../../utils/formfield";
15
15
  import Workflow from "../Form/Workflow";
16
+ import EmbedScriptPopup from "../EmbedScript/EmbedScriptPopup";
16
17
  import { jsx as _jsx } from "react/jsx-runtime";
17
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
18
19
  const FreeGridItem = props => {
@@ -48,7 +49,7 @@ const FreeGridItem = props => {
48
49
  selectedElement
49
50
  } = useEditorContext();
50
51
  const arrangeIndex = zIndex === undefined ? path[path.length - 1] : zIndex;
51
- const [openWorkflow, setOpenWorkflow] = useState(false);
52
+ const [popup, setPopup] = useState(null);
52
53
  const onChangeSettings = () => {};
53
54
  const onChange = data => {
54
55
  let updateData = {
@@ -151,8 +152,29 @@ const FreeGridItem = props => {
151
152
  console.log(err, "Add Field Error in Form Builder");
152
153
  }
153
154
  };
154
- const closeWorkflow = () => {
155
- setOpenWorkflow(false);
155
+ const onClose = () => {
156
+ setPopup(null);
157
+ setSelectedElement({
158
+ ...selectedElement,
159
+ enable: 1
160
+ });
161
+ };
162
+ const selectCode = () => {
163
+ try {
164
+ const emsTarget = {
165
+ anchor: {
166
+ path: [...path, 0, 0],
167
+ offset: 0
168
+ },
169
+ focus: {
170
+ path: [...path, 0, 0],
171
+ offset: 0
172
+ }
173
+ };
174
+ Transforms.select(editor, emsTarget);
175
+ } catch (err) {
176
+ console.log(err);
177
+ }
156
178
  };
157
179
  const onWorkflowSave = data => {
158
180
  const updateData = {
@@ -172,11 +194,19 @@ const FreeGridItem = props => {
172
194
  ...selectedElement,
173
195
  enable: 2
174
196
  });
175
- setOpenWorkflow(true);
197
+ setPopup("workflow");
176
198
  break;
177
199
  case "addFormField":
178
200
  onAddFormField();
179
201
  break;
202
+ case "addEmbedScript":
203
+ setSelectedElement({
204
+ ...selectedElement,
205
+ enable: 2
206
+ });
207
+ selectCode();
208
+ setPopup("embedScript");
209
+ break;
180
210
  default:
181
211
  break;
182
212
  }
@@ -224,11 +254,18 @@ const FreeGridItem = props => {
224
254
  ...attributes,
225
255
  className: `fgi_type_${childType}`,
226
256
  children: [children, /*#__PURE__*/_jsx(Workflow, {
227
- openWorkflow: openWorkflow,
257
+ openWorkflow: popup === "workflow",
228
258
  element: element,
229
259
  customWorkflowElement: element?.children?.[0] || null,
230
- closeWorkflow: closeWorkflow,
260
+ closeWorkflow: onClose,
231
261
  onSave: onWorkflowSave
262
+ }), /*#__PURE__*/_jsx(EmbedScriptPopup, {
263
+ open: popup === "embedScript",
264
+ customProps: customProps,
265
+ editor: editor,
266
+ onClose: onClose,
267
+ updatePath: [...path, 0],
268
+ parentPath: [...path]
232
269
  })]
233
270
  })
234
271
  });
@@ -29,6 +29,10 @@ const AddElement = props => {
29
29
  className: "item-wrapper",
30
30
  onClick: handleClick("addTable"),
31
31
  children: "Table"
32
+ }), /*#__PURE__*/_jsx(ListItemButton, {
33
+ className: "item-wrapper",
34
+ onClick: handleClick("addCode"),
35
+ children: "Code"
32
36
  }), /*#__PURE__*/_jsx(ListItemButton, {
33
37
  className: "item-wrapper",
34
38
  onClick: handleClick("addBox"),
@@ -5,6 +5,7 @@ const imageOptions = ["settings", "link", "saveAsTemplate", "close"];
5
5
  const boxOptions = ["settings", "link", "saveAsTemplate", "close"];
6
6
  const appHeaderOptions = ["settings", "saveAsTemplate", "close"];
7
7
  const tableOptions = ["drag", "edit", "settings", "saveAsTemplate", "close"];
8
+ const embedScriptOptions = ["embedScript", "saveAsTemplate", "close"];
8
9
  const sectionOptions = ["addElement", "settings", "moveUp", "moveDown", "saveAsTemplate", "more"];
9
10
  const formOptions = ["drag", "edit", "settings", "addFormField", "workFlow", "saveAsTemplate", "close"];
10
11
  const itemOptions = {
@@ -16,6 +17,7 @@ const itemOptions = {
16
17
  appHeader: appHeaderOptions,
17
18
  form: formOptions,
18
19
  section: sectionOptions,
19
- table: tableOptions
20
+ table: tableOptions,
21
+ embedScript: embedScriptOptions
20
22
  };
21
23
  export default itemOptions;
@@ -160,6 +160,9 @@ const useFreeGridStyles = ({
160
160
  }
161
161
  },
162
162
  "& .fgi_type_appHeader": {
163
+ "& .MuiAppBar-root": {
164
+ zIndex: 100
165
+ },
163
166
  "& .MuiToolbar-root": {
164
167
  paddingLeft: "0px !important",
165
168
  paddingRight: "0px !important",
@@ -188,6 +191,12 @@ const useFreeGridStyles = ({
188
191
  }
189
192
  }
190
193
  },
194
+ "& .fgi_type_embedScript": {
195
+ width: "100%",
196
+ height: "100%",
197
+ backgroundColor: "#FFF",
198
+ overflow: "hidden"
199
+ },
191
200
  /** element toolbar hide */
192
201
  "& .element-toolbar": {
193
202
  display: "none"
@@ -68,7 +68,8 @@ const CheckList = ({
68
68
  style: {
69
69
  flex: 1,
70
70
  opacity: checked ? 1 : 1,
71
- textDecoration: !checked ? "none" : "none"
71
+ textDecoration: !checked ? "none" : "none",
72
+ width: '90%'
72
73
  },
73
74
  className: `checkbox-list content-editable ${isEmpty ? "empty" : ""}`,
74
75
  placeholder: nestedCheckList ? "" : "Todo List",
@@ -184,7 +184,7 @@ const Table = props => {
184
184
  sx: classes.table,
185
185
  style: {
186
186
  background: bgColor,
187
- border: `1px solid ${borderColor}`,
187
+ border: borderColor ? `1px solid ${borderColor}` : "",
188
188
  width: "auto"
189
189
  },
190
190
  children: /*#__PURE__*/_jsx(TableBody, {
@@ -179,7 +179,7 @@ const TableCell = props => {
179
179
  style: {
180
180
  position: "relative",
181
181
  background: bgColor || entireBgColor,
182
- border: `3px solid ${cellBorderColor}`,
182
+ border: cellBorderColor ? `3px solid ${cellBorderColor}` : "",
183
183
  ...(sizeProps || {})
184
184
  },
185
185
  onContextMenu: onRightClick,
@@ -19,11 +19,12 @@ const TableRow = props => {
19
19
  match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
20
20
  });
21
21
  const [tableProps] = tableNode || [{}];
22
+ const rowBorderColor = borderColor || tableProps?.borderColor;
22
23
  return /*#__PURE__*/_jsx("tr", {
23
24
  ...attributes,
24
25
  style: {
25
26
  backgroundColor: bgColor,
26
- border: `1px solid ${borderColor || tableProps?.borderColor}`
27
+ border: rowBorderColor ? `1px solid ${rowBorderColor}` : ""
27
28
  },
28
29
  children: children
29
30
  });
@@ -0,0 +1,66 @@
1
+ import React from "react";
2
+ import { Autocomplete, TextField } from "@mui/material";
3
+ import { activeMark, addMarkData } from "../../utils/SlateUtilityFunctions.js";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const FontFamilyAutocomplete = ({
6
+ editor,
7
+ format,
8
+ options,
9
+ width,
10
+ onChange = () => {},
11
+ val = "",
12
+ webFont = false
13
+ }) => {
14
+ const markValue = activeMark(editor, format);
15
+ const value = !webFont ? markValue : val;
16
+ const changeMarkData = (event, newValue, format) => {
17
+ if (!webFont) {
18
+ event.preventDefault();
19
+ const value = newValue;
20
+ addMarkData(editor, {
21
+ format,
22
+ value
23
+ });
24
+ } else {
25
+ onChange({
26
+ [format]: newValue
27
+ });
28
+ }
29
+ };
30
+ return /*#__PURE__*/_jsx(Autocomplete, {
31
+ size: "small",
32
+ style: {
33
+ fontFamily: `${value || ""}`,
34
+ width: width || "100%",
35
+ height: "36px",
36
+ borderRadius: "10px",
37
+ fontSize: "14px"
38
+ },
39
+ value: value || options?.[0],
40
+ className: "editor-dd",
41
+ onChange: (e, newValue) => changeMarkData(e, newValue, format),
42
+ getOptionLabel: option => {
43
+ return option;
44
+ },
45
+ options: options,
46
+ defaultValue: options?.[0],
47
+ renderOption: (props, option) => {
48
+ return /*#__PURE__*/_jsx("li", {
49
+ ...props,
50
+ style: {
51
+ fontFamily: option
52
+ },
53
+ children: option
54
+ });
55
+ },
56
+ renderInput: params => /*#__PURE__*/_jsx(TextField, {
57
+ sx: {
58
+ "& .MuiInputBase-root.MuiOutlinedInput-root": {
59
+ fontFamily: `${value}`
60
+ }
61
+ },
62
+ ...params
63
+ })
64
+ });
65
+ };
66
+ export default FontFamilyAutocomplete;
@@ -222,7 +222,8 @@ const usePopupStyle = theme => ({
222
222
  fontSize: "14px",
223
223
  marginBottom: "5px",
224
224
  paddingLeft: "5px",
225
- fontWeight: 500
225
+ fontWeight: 500,
226
+ color: theme?.palette?.editor?.textColor || "#000"
226
227
  },
227
228
  typoLabel2: {
228
229
  fontSize: "14px",
@@ -510,16 +511,16 @@ const usePopupStyle = theme => ({
510
511
  }
511
512
  },
512
513
  buttonCardMediaWrpr: {
513
- padding: '5px',
514
+ padding: "5px",
514
515
  position: "relative",
515
516
  margin: "8px",
516
517
  marginBottom: "0px",
517
- '& .img-wrapper': {
518
+ "& .img-wrapper": {
518
519
  "&:hover": {
519
- padding: '0px 2px 0px 2px',
520
- backgroundColor: '#E9F3FE',
521
- border: '1px solid #2563EB40',
522
- borderRadius: '5px',
520
+ padding: "0px 2px 0px 2px",
521
+ backgroundColor: "#E9F3FE",
522
+ border: "1px solid #2563EB40",
523
+ borderRadius: "5px",
523
524
  height: "100%",
524
525
  margin: "0px"
525
526
  // "& .template-card-action": {
@@ -588,10 +589,10 @@ const usePopupStyle = theme => ({
588
589
  "& .MuiPopover-paper": {
589
590
  // minWidth: "130px",
590
591
  border: "1px solid #E4E8EB",
592
+ maxHeight: "140px",
591
593
  background: theme?.palette?.editor?.background,
592
594
  overflowY: "hidden",
593
595
  padding: "6px 12px 6px 0px",
594
- maxHeight: "140px",
595
596
  "@media only screen and (max-width: 600px)": {
596
597
  marginTop: "-40px"
597
598
  }
@@ -12,6 +12,8 @@ import { getBorderColor } from "../../utils/helper";
12
12
  import SelectTypography from "./MiniTextFormat/SelectTypography";
13
13
  import SelectSuperSubscript from "./MiniTextFormat/SelectSuperSubscript";
14
14
  import { ColorResetIcon, TextDefaultStyleIcon } from "../../common/iconListV2";
15
+ import FontFamilyAutocomplete from "../FormatTools/FontFamilyAutocomplete";
16
+ import { useEditorContext } from "../../hooks/useMouseMove";
15
17
  import { jsx as _jsx } from "react/jsx-runtime";
16
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
17
19
  const allTools = toolbarGroups.flat();
@@ -29,7 +31,9 @@ const TextFormat = props => {
29
31
  const [anchorEl, setAnchorEl] = useState(null);
30
32
  const [type, setType] = useState(null);
31
33
  const open = Boolean(anchorEl);
32
- const fontFamily = allTools.find(f => f.format === "fontFamily");
34
+ const {
35
+ fontFamilies
36
+ } = useEditorContext();
33
37
  const fontWeight = allTools.find(f => f.format === "fontWeight");
34
38
  const fontStyle = allTools.filter(f => f.type === "mark" && f.format !== "strikethrough" && f.format !== "superscript" && f.format !== "subscript");
35
39
  const fontAlign = allTools.filter(f => f.format?.indexOf("align") >= 0);
@@ -119,10 +123,10 @@ const TextFormat = props => {
119
123
  }), /*#__PURE__*/_jsx(Grid, {
120
124
  item: true,
121
125
  xs: 12,
122
- sx: classes.textFormatField1,
123
- children: /*#__PURE__*/_jsx(Dropdown, {
126
+ sx: classes.textFormatField,
127
+ children: /*#__PURE__*/_jsx(FontFamilyAutocomplete, {
124
128
  classes: classes,
125
- ...fontFamily,
129
+ ...fontFamilies,
126
130
  editor: editor
127
131
  })
128
132
  })]
@@ -1,4 +1,4 @@
1
- import React, { useState } from "react";
1
+ import React, { useMemo, useState } from "react";
2
2
  import { Grid, Button, Popover } from "@mui/material";
3
3
  import ColorPickerTool from "react-gcolor-picker";
4
4
  import { colors } from "../Elements/Color Picker/defaultColors";
@@ -11,7 +11,8 @@ const ColorPickerButton = props => {
11
11
  onSave,
12
12
  defaultColors = [],
13
13
  classes = {},
14
- recentColors = []
14
+ recentColors = [],
15
+ hideGradient
15
16
  } = props;
16
17
  const [anchorEl, setAnchorEl] = useState(null);
17
18
  const [color, setColor] = useState(value);
@@ -29,6 +30,13 @@ const ColorPickerButton = props => {
29
30
  const handleColorChange = color => {
30
31
  setColor(color);
31
32
  };
33
+ const initialColors = useMemo(() => {
34
+ let colors = [...recentColors, ...defaultColors];
35
+ if (hideGradient) {
36
+ colors = colors.filter(c => c && !c.includes("gradient"));
37
+ }
38
+ return colors;
39
+ }, [recentColors, defaultColors, hideGradient]);
32
40
  return /*#__PURE__*/_jsxs(_Fragment, {
33
41
  children: [/*#__PURE__*/_jsx(Button, {
34
42
  style: {
@@ -61,10 +69,10 @@ const ColorPickerButton = props => {
61
69
  xs: 12,
62
70
  children: [/*#__PURE__*/_jsx("div", {
63
71
  children: /*#__PURE__*/_jsx(ColorPickerTool, {
64
- gradient: true,
72
+ gradient: hideGradient ? false : true,
65
73
  value: color,
66
74
  onChange: handleColorChange,
67
- defaultColors: [...recentColors, ...defaultColors] || []
75
+ defaultColors: initialColors
68
76
  })
69
77
  }), /*#__PURE__*/_jsxs("div", {
70
78
  style: {
@@ -0,0 +1,68 @@
1
+ import { useEffect } from "react";
2
+ import WebFont from "webfontloader";
3
+ import { useEditorContext } from "../../hooks/useMouseMove";
4
+ const FontLoader = props => {
5
+ const {
6
+ otherProps,
7
+ readOnly
8
+ } = props;
9
+ const {
10
+ setFontFamilies
11
+ } = useEditorContext();
12
+ const loadFontsInBatches = (families, batchSize = 5) => {
13
+ let currentIndex = 0;
14
+ function loadNextBatch() {
15
+ if (currentIndex >= families.length) {
16
+ console.log('All fonts have been loaded');
17
+ return;
18
+ }
19
+ const batch = families.slice(currentIndex, currentIndex + batchSize);
20
+ const batchWithWeights = batch.map(font => `${font}:300,400,600,700`);
21
+ WebFont.load({
22
+ google: {
23
+ families: [...batchWithWeights]
24
+ },
25
+ active: () => {
26
+ console.log(`Fonts loaded successfully: ${batch}`);
27
+ currentIndex += batchSize;
28
+ loadNextBatch();
29
+ },
30
+ inactive: () => {
31
+ console.log(`Font loading failed for: ${batch}`);
32
+ }
33
+ });
34
+ }
35
+ loadNextBatch();
36
+ };
37
+ const sanitizeFontFamily = fontFamily => {
38
+ return fontFamily.replace(/\\/g, '').replace(/['"]/g, '');
39
+ };
40
+ useEffect(() => {
41
+ let families = [];
42
+ if (!readOnly) {
43
+ otherProps.services("listGoogleFont", []).then(data => {
44
+ families = data?.data.map(sanitizeFontFamily);
45
+ setFontFamilies({
46
+ id: 1,
47
+ format: "fontFamily",
48
+ type: "fontfamilydropdown",
49
+ options: families || []
50
+ });
51
+ loadFontsInBatches(families);
52
+ }).catch(err => {
53
+ console.log(err);
54
+ });
55
+ } else {
56
+ const elements = Array.from(document.querySelectorAll("*"));
57
+ const fontSet = new Set();
58
+ elements.forEach(element => {
59
+ const computedStyles = window.getComputedStyle(element);
60
+ fontSet.add(sanitizeFontFamily(computedStyles.fontFamily));
61
+ });
62
+ families = Array.from(fontSet);
63
+ loadFontsInBatches(families);
64
+ }
65
+ }, []);
66
+ return null;
67
+ };
68
+ export default FontLoader;
@@ -218,6 +218,7 @@ const iconList = {
218
218
  expandIcon: /*#__PURE__*/_jsx(ExpandIcon, {}),
219
219
  closeIcon: /*#__PURE__*/_jsx(CloseIcon, {}),
220
220
  embedScript: /*#__PURE__*/_jsx(BsCodeSlash, {
221
+ className: "fg-op-ico",
221
222
  size: 20,
222
223
  style: {
223
224
  fill: "#64748B"
@@ -267,6 +268,9 @@ const iconList = {
267
268
  addElement: /*#__PURE__*/_jsx(AddElementIcon, {}),
268
269
  addTemplate: /*#__PURE__*/_jsx(AddTemplateIcon, {})
269
270
  };
271
+ export const icons = {
272
+ ...iconList
273
+ };
270
274
  const Icon = props => {
271
275
  const {
272
276
  icon
@@ -10,6 +10,7 @@ import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward";
10
10
  import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward";
11
11
  import SaveIcon from "@mui/icons-material/Save";
12
12
  import LinkIcon from "./Icons/LinkIcon";
13
+ import CodeIcon from "@mui/icons-material/Code";
13
14
  import { GridAddSectionIcon, WorkflowIcon } from "../../iconslist";
14
15
  const Actions = {
15
16
  ai: {
@@ -92,6 +93,12 @@ const Actions = {
92
93
  Icon: WorkflowIcon,
93
94
  title: "Workflow"
94
95
  },
96
+ embedScript: {
97
+ type: "addEmbedScript",
98
+ Button: IconButton,
99
+ Icon: CodeIcon,
100
+ title: "Embed Code"
101
+ },
95
102
  saveAsTemplate: {
96
103
  type: "saveAsTemplate",
97
104
  Button: IconButton,
@@ -16,7 +16,8 @@ const Settings = props => {
16
16
  onClose,
17
17
  editor,
18
18
  classes,
19
- customProps
19
+ customProps,
20
+ theme
20
21
  } = props;
21
22
  const title = settingsLabel[childType] || "Settings";
22
23
  const Settings = SettingsComponents[childType];
@@ -49,7 +50,8 @@ const Settings = props => {
49
50
  children: Settings ? /*#__PURE__*/_jsx(Settings, {
50
51
  editor: editor,
51
52
  path: path,
52
- customProps: customProps
53
+ customProps: customProps,
54
+ theme: theme
53
55
  }) : null
54
56
  })]
55
57
  })
@@ -0,0 +1,47 @@
1
+ import React from "react";
2
+ import { Transforms, Node } from "slate";
3
+ import { Box } from "@mui/material";
4
+ import { StyleContent } from "../../../StyleBuilder";
5
+ import embedScriptStyle from "../../../StyleBuilder/embedScriptStyle";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const CodeSettings = props => {
8
+ const {
9
+ editor,
10
+ path,
11
+ customProps
12
+ } = props;
13
+ const item_path = path?.split("|").map(m => parseInt(m));
14
+ const element_path = [...item_path, 0];
15
+ const element = Node.get(editor, element_path);
16
+ const onChange = data => {
17
+ const updated_props = {
18
+ ...element,
19
+ ...data,
20
+ field_type: data?.element
21
+ };
22
+ delete updated_props.children;
23
+ Transforms.setNodes(editor, {
24
+ ...updated_props
25
+ }, {
26
+ at: element_path
27
+ });
28
+ };
29
+ const handleClose = () => {
30
+ console.log("close");
31
+ };
32
+ return /*#__PURE__*/_jsx(Box, {
33
+ component: "div",
34
+ className: "item-w",
35
+ children: embedScriptStyle?.map((m, i) => {
36
+ return /*#__PURE__*/_jsx(StyleContent, {
37
+ renderTabs: embedScriptStyle,
38
+ value: m.value,
39
+ element: element,
40
+ onChange: onChange,
41
+ customProps: customProps,
42
+ handleClose: handleClose
43
+ }, `tab_${m.value}_$${i}`);
44
+ })
45
+ });
46
+ };
47
+ export default CodeSettings;
@@ -7,11 +7,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const TextSettings = props => {
8
8
  const {
9
9
  editor,
10
- path
10
+ path,
11
+ theme
11
12
  } = props;
12
13
  const item_path = path.split("|").map(m => parseInt(m));
13
14
  const element_path = [...item_path, 0];
14
- const classes = usePopupStyle();
15
+ const classes = usePopupStyle(theme);
16
+ console.log(theme);
15
17
  useEffect(() => {
16
18
  try {
17
19
  ReactEditor.focus(editor);
@@ -6,6 +6,7 @@ import BoxSettings from "./BoxSettings";
6
6
  import AppHeaderSettings from "./AppHeaderSettings";
7
7
  import FormSettings from "./FormSettings";
8
8
  import TableSettings from "./TableSettings";
9
+ import CodeSettings from "./CodeSettings";
9
10
  const SettingsComponents = {
10
11
  text: TextSettings,
11
12
  button: ButtonSettings,
@@ -14,6 +15,7 @@ const SettingsComponents = {
14
15
  box: BoxSettings,
15
16
  appHeader: AppHeaderSettings,
16
17
  form: FormSettings,
17
- table: TableSettings
18
+ table: TableSettings,
19
+ embedScript: CodeSettings
18
20
  };
19
21
  export default SettingsComponents;
@@ -6,7 +6,8 @@ export const settingsLabel = {
6
6
  box: "Box Settings",
7
7
  appHeader: "App Header Settings",
8
8
  form: "Form Settings",
9
- table: "Table Settings"
9
+ table: "Table Settings",
10
+ embedScript: "Code Settings"
10
11
  };
11
12
  export const ItemTypes = {
12
13
  text: "Text",
@@ -16,5 +17,6 @@ export const ItemTypes = {
16
17
  box: "Box",
17
18
  appHeader: "App Header",
18
19
  form: "Form",
19
- table: "Table"
20
+ table: "Table",
21
+ embedScript: "Code"
20
22
  };
@@ -2,17 +2,27 @@ const useOptionsPopupStyle = () => ({
2
2
  root: {
3
3
  zIndex: 1200,
4
4
  background: "#FFF",
5
- borderRadius: "5px",
5
+ borderRadius: "7px",
6
6
  overflow: "hidden",
7
7
  boxShadow: "1px 1px 3px rgba(0,0,0,0.3)",
8
+ marginRight: "4px !important",
8
9
  "& .papper-root": {
9
- borderTop: "8px solid #1976d2",
10
10
  width: "270px",
11
- boxShadow: "none"
11
+ boxShadow: "none",
12
+ border: "1px solid rgba(228, 232, 235, 1)",
13
+ borderRadius: "7px"
12
14
  },
13
15
  "& .item-list-wrpr": {
14
16
  paddingTop: "0px",
15
- paddingBottom: "0px"
17
+ paddingBottom: "0px",
18
+ padding: "12px 12px",
19
+ "& .MuiListItemButton-root": {
20
+ borderRadius: "7px",
21
+ "&:hover": {
22
+ color: "#000",
23
+ background: "rgba(233, 243, 254, 1)"
24
+ }
25
+ }
16
26
  },
17
27
  "& .item-wrapper": {
18
28
  padding: "12px",
@@ -22,6 +32,15 @@ const useOptionsPopupStyle = () => ({
22
32
  fontWeight: "bold",
23
33
  justifyContent: "space-between",
24
34
  alignItems: "center",
35
+ position: "relative",
36
+ "&:after": {
37
+ position: "absolute",
38
+ width: "100%",
39
+ bottom: 0,
40
+ left: 0,
41
+ content: '" "',
42
+ borderBottom: "1px solid #ccc"
43
+ },
25
44
  "& .MuiIconButton-root": {
26
45
  padding: "4px",
27
46
  "& svg": {