@flozy/editor 3.3.1 → 3.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/dist/Editor/CommonEditor.js +6 -2
  2. package/dist/Editor/Elements/AI/AIInput.js +157 -0
  3. package/dist/Editor/Elements/AI/CustomSelect.js +101 -0
  4. package/dist/Editor/Elements/AI/PopoverAIInput.js +235 -0
  5. package/dist/Editor/Elements/AI/Styles.js +149 -0
  6. package/dist/Editor/Elements/AI/helper.js +145 -0
  7. package/dist/Editor/Elements/Form/Form.js +33 -4
  8. package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +54 -0
  9. package/dist/Editor/Elements/Form/FormElements/FormDate.js +55 -0
  10. package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +54 -0
  11. package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +54 -0
  12. package/dist/Editor/Elements/Form/FormElements/index.js +9 -1
  13. package/dist/Editor/Elements/Form/FormElements/validations.js +3 -3
  14. package/dist/Editor/Elements/Form/FormField.js +12 -3
  15. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -3
  16. package/dist/Editor/Elements/Link/LinkButton.js +8 -6
  17. package/dist/Editor/Styles/EditorStyles.js +4 -0
  18. package/dist/Editor/Toolbar/Basic/index.js +9 -6
  19. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/InfinityAITool.js +24 -0
  20. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -2
  21. package/dist/Editor/Toolbar/PopupTool/index.js +11 -7
  22. package/dist/Editor/assets/svg/AIIcons.js +438 -0
  23. package/dist/Editor/common/Icon.js +33 -2
  24. package/dist/Editor/common/LinkSettings/index.js +0 -1
  25. package/dist/Editor/common/MentionsPopup/index.js +7 -0
  26. package/dist/Editor/common/Shorthands/elements.js +12 -0
  27. package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -10
  28. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +117 -0
  29. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +7 -1
  30. package/dist/Editor/common/StyleBuilder/fieldTypes/metaDataMapping.js +41 -0
  31. package/dist/Editor/common/StyleBuilder/fieldTypes/selectSwitch.js +101 -0
  32. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +44 -17
  33. package/dist/Editor/common/StyleBuilder/formStyle.js +25 -0
  34. package/dist/Editor/common/StyleBuilder/textOptionsStyles.js +43 -0
  35. package/dist/Editor/common/SwipeableDrawer/index.js +1 -1
  36. package/dist/Editor/common/WaveLoading/index.js +18 -0
  37. package/dist/Editor/common/WaveLoading/style.css +38 -0
  38. package/dist/Editor/common/iconslist.js +541 -0
  39. package/dist/Editor/hooks/useClickOutside.js +35 -0
  40. package/dist/Editor/hooks/useMouseMove.js +4 -2
  41. package/dist/Editor/utils/form.js +2 -1
  42. package/dist/Editor/utils/helper.js +1 -1
  43. package/dist/Editor/utils/infinityAI.js +23 -0
  44. package/package.json +1 -1
@@ -0,0 +1,145 @@
1
+ import { ActionItemsIcon, BookIcon, CheckIcon,
2
+ // ClarifyIcon,
3
+ CloseIcon, DeleteIcon,
4
+ // EditIcon,
5
+ MakeShorterIcon, SummarizeIcon, TextAlignLeftIcon, ToneIcon, TranslateIcon, TryAgainIcon } from "../../assets/svg/AIIcons";
6
+ export const MODES = {
7
+ default: 0,
8
+ translate: 1,
9
+ summarize: 2,
10
+ actionItems: 3,
11
+ grammatical: 4,
12
+ rephraseTone: 5,
13
+ longer: 6,
14
+ shorter: 7
15
+ };
16
+
17
+ // const improveWriting = {
18
+ // label: "Improve writing",
19
+ // value: "improve_writing",
20
+ // Icon: EditIcon,
21
+ // replace: true,
22
+ // };
23
+
24
+ const commonOptions = [{
25
+ label: "Make longer",
26
+ value: "make_longer",
27
+ Icon: TextAlignLeftIcon,
28
+ replace: false,
29
+ mode: MODES.longer
30
+ }, {
31
+ label: "Make shorter",
32
+ value: "make_shorter",
33
+ Icon: MakeShorterIcon,
34
+ replace: false,
35
+ mode: MODES.shorter
36
+ }
37
+ // {
38
+ // label: "Continue writing",
39
+ // value: "continue_writing",
40
+ // Icon: EditIcon,
41
+ // replace: false,
42
+ // },
43
+ ];
44
+
45
+ export const newContentOptions = [{
46
+ group: "",
47
+ groupLabel: "",
48
+ options: [
49
+ // improveWriting,
50
+ ...commonOptions.map(o => ({
51
+ ...o,
52
+ replace: true
53
+ })), {
54
+ label: "Close",
55
+ value: "close",
56
+ Icon: CloseIcon,
57
+ replace: true
58
+ }]
59
+ }];
60
+ const languages = ["English", "Korean", "Chinese", "Japanese", "Russian", "French", "Portuguese", "German", "Italian", "Dutch", "Indonesian"];
61
+ const translateOptions = [{
62
+ options: languages.map(l => ({
63
+ label: l,
64
+ value: l,
65
+ replace: false,
66
+ mode: MODES.translate
67
+ }))
68
+ }];
69
+ const tones = ["Professional", "Casual", "Straightforward", "Friendly"];
70
+ const toneOptions = [{
71
+ options: tones.map(t => ({
72
+ label: t,
73
+ value: t,
74
+ replace: false,
75
+ mode: MODES.rephraseTone
76
+ }))
77
+ }];
78
+ export const editContentOptions = [{
79
+ group: "",
80
+ groupLabel: "Regenerate page",
81
+ options: [{
82
+ label: "Translate",
83
+ value: "translate",
84
+ Icon: TranslateIcon,
85
+ options: translateOptions,
86
+ replace: false
87
+ }, {
88
+ label: "Summarize",
89
+ value: "summarize",
90
+ Icon: SummarizeIcon,
91
+ replace: false,
92
+ mode: MODES.summarize
93
+ },
94
+ // {
95
+ // label: "Clarify this",
96
+ // value: "clarify",
97
+ // Icon: ClarifyIcon,
98
+ // replace: false,
99
+ // },
100
+ {
101
+ label: "Find action items",
102
+ value: "action_items",
103
+ Icon: ActionItemsIcon,
104
+ replace: false,
105
+ mode: MODES.actionItems
106
+ }]
107
+ }, {
108
+ group: "",
109
+ groupLabel: "Edit or review page",
110
+ options: [{
111
+ label: "Fix spelling & grammar",
112
+ value: "spelling_&_grammar",
113
+ Icon: BookIcon,
114
+ replace: false,
115
+ mode: MODES.grammatical
116
+ },
117
+ // { ...improveWriting, replace: false },
118
+ ...commonOptions, {
119
+ label: "Change tone",
120
+ value: "change_tone",
121
+ Icon: ToneIcon,
122
+ options: toneOptions,
123
+ replace: false
124
+ }]
125
+ }];
126
+ export const generatedContentOptions = [{
127
+ group: "",
128
+ groupLabel: "",
129
+ options: [{
130
+ label: "Replace selection",
131
+ value: "replace_selection",
132
+ Icon: CheckIcon,
133
+ replace: true
134
+ }, ...commonOptions, {
135
+ label: "Try again",
136
+ value: "try_again",
137
+ Icon: TryAgainIcon,
138
+ replace: false
139
+ }, {
140
+ label: "Delete",
141
+ value: "close",
142
+ Icon: DeleteIcon,
143
+ replace: false
144
+ }]
145
+ }];
@@ -24,6 +24,7 @@ const Form = props => {
24
24
  } = props;
25
25
  const {
26
26
  readOnly,
27
+ site_id,
27
28
  page_id,
28
29
  onFormSubmit
29
30
  } = customProps;
@@ -65,6 +66,13 @@ const Form = props => {
65
66
  const getFieldProps = (key = "", val = "") => {
66
67
  return element?.children?.find(obj => obj && obj[key] === val);
67
68
  };
69
+ const getFieldData = (key, type, field_type) => {
70
+ return element?.children?.filter(obj => obj && obj?.hasOwnProperty(key) && obj?.type === type && obj?.[key]?.includes(field_type));
71
+ };
72
+ const isMetaDataKey = (data, key) => {
73
+ let metaData = data?.find(meta => meta?.key === key);
74
+ return metaData;
75
+ };
68
76
  const handleSubmit = async (event, test = false) => {
69
77
  if (event) {
70
78
  event.preventDefault();
@@ -74,26 +82,45 @@ const Form = props => {
74
82
  setLoading(true);
75
83
  let response = {};
76
84
  let user_email = "";
85
+ let meta_data = [];
77
86
  const validations = [];
87
+ let metaFieldDataBoards = getFieldData('element_metadatakey', "form-field", "board");
78
88
  for (let pair of formData.entries()) {
79
89
  const emailObject = getFieldProps("element", "email");
80
90
  if (emailObject?.name === pair[0]) {
81
91
  user_email = pair[1];
82
92
  }
93
+ const isMetaKey = isMetaDataKey(metaFieldDataBoards, pair[0]);
94
+ if (isMetaKey) {
95
+ meta_data.push({
96
+ [isMetaKey?.element_metadatakey]: pair[1],
97
+ type: "board",
98
+ metadatamapping: element?.metadatamapping
99
+ });
100
+ }
83
101
  const fieldData = getFieldProps("name", pair[0]);
84
102
  let rule = [];
85
103
  if (fieldData?.required) {
86
104
  rule.push(`isRequired`);
87
105
  }
88
- if (fieldData?.field_type === "email") {
106
+ if (fieldData?.element === "email") {
89
107
  rule.push(`isEmail`);
90
108
  }
91
- if (fieldData?.required || fieldData?.field_type === "email") {
109
+ if (fieldData?.required || fieldData?.element === "email") {
92
110
  validations.push({
93
111
  name: pair[0],
94
112
  value: pair[1],
95
113
  field_type: fieldData?.field_type,
96
- rules: rule && rule
114
+ rules: rule?.length > 0 && rule
115
+ });
116
+ }
117
+ if (isMetaKey?.isrequired) {
118
+ rule.push(`isRequired`);
119
+ validations.push({
120
+ name: pair[0],
121
+ value: pair[1],
122
+ field_type: isMetaKey?.placeholder,
123
+ rules: rule?.length > 0 && rule
97
124
  });
98
125
  }
99
126
  response = {
@@ -103,6 +130,7 @@ const Form = props => {
103
130
  }
104
131
  let params = {
105
132
  page_id: page_id,
133
+ site_id: site_id,
106
134
  form_id: `${formName}`,
107
135
  response: {
108
136
  ...response
@@ -112,7 +140,8 @@ const Form = props => {
112
140
  email: element?.email,
113
141
  form_workflow: element?.workflow,
114
142
  save_response: element?.saveResponse
115
- }
143
+ },
144
+ meta_data: meta_data
116
145
  };
117
146
  const isValidForm = validations.length !== 0 && validation(validations);
118
147
  if (isValidForm) {
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ import { Box } from "@mui/material";
3
+ import { getTRBLBreakPoints, getBreakPointsValue } from "../../../helper/theme";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const FormCheckbox = props => {
6
+ const {
7
+ fieldProps
8
+ } = props;
9
+ const {
10
+ bannerSpacing,
11
+ height,
12
+ borderRadius,
13
+ borderStyle,
14
+ borderWidth,
15
+ borderColor,
16
+ textColor,
17
+ bgColor,
18
+ lockSpacing,
19
+ ...rest
20
+ } = fieldProps;
21
+ const onChange = e => {
22
+ e.preventDefault();
23
+ };
24
+ return /*#__PURE__*/_jsx("div", {
25
+ style: {
26
+ width: "100%",
27
+ display: "flex"
28
+ },
29
+ contentEditable: false,
30
+ children: /*#__PURE__*/_jsx(Box, {
31
+ component: "input",
32
+ ...rest,
33
+ type: "checkbox",
34
+ onChange: onChange,
35
+ sx: {
36
+ width: "100%",
37
+ border: `1px solid ${borderColor || "#FFF"}`,
38
+ padding: {
39
+ ...getTRBLBreakPoints(bannerSpacing)
40
+ },
41
+ height: height || "auto",
42
+ borderColor: borderColor || "transparent",
43
+ borderWidth: borderWidth || "1px",
44
+ borderRadius: {
45
+ ...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
46
+ },
47
+ borderStyle: borderStyle || "solid",
48
+ color: textColor || "#000",
49
+ background: bgColor || "transparent"
50
+ }
51
+ })
52
+ });
53
+ };
54
+ export default FormCheckbox;
@@ -0,0 +1,55 @@
1
+ import React from "react";
2
+ import { Box } from "@mui/material";
3
+ import { getTRBLBreakPoints, getBreakPointsValue } from "../../../helper/theme";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const FormDate = props => {
6
+ const {
7
+ fieldProps
8
+ } = props;
9
+ const {
10
+ bannerSpacing,
11
+ height,
12
+ borderRadius,
13
+ borderStyle,
14
+ borderWidth,
15
+ borderColor,
16
+ textColor,
17
+ bgColor,
18
+ lockSpacing,
19
+ ...rest
20
+ } = fieldProps;
21
+ const onChange = e => {
22
+ e.preventDefault();
23
+ };
24
+ return /*#__PURE__*/_jsx("div", {
25
+ style: {
26
+ width: "100%",
27
+ display: "flex"
28
+ },
29
+ contentEditable: false,
30
+ children: /*#__PURE__*/_jsx(Box, {
31
+ component: "input",
32
+ ...rest,
33
+ type: "date",
34
+ onChange: onChange,
35
+ sx: {
36
+ width: "100%",
37
+ border: `1px solid ${borderColor || "#FFF"}`,
38
+ padding: {
39
+ ...getTRBLBreakPoints(bannerSpacing)
40
+ },
41
+ height: height || "auto",
42
+ borderColor: borderColor || "transparent",
43
+ borderWidth: borderWidth || "1px",
44
+ borderRadius: {
45
+ ...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
46
+ },
47
+ borderStyle: borderStyle || "solid",
48
+ color: textColor || "#000",
49
+ background: bgColor || "transparent",
50
+ paddingRight: '85px !important'
51
+ }
52
+ })
53
+ });
54
+ };
55
+ export default FormDate;
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ import { Box } from "@mui/material";
3
+ import { getTRBLBreakPoints, getBreakPointsValue } from "../../../helper/theme";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const FormNumbers = props => {
6
+ const {
7
+ fieldProps
8
+ } = props;
9
+ const {
10
+ bannerSpacing,
11
+ height,
12
+ borderRadius,
13
+ borderStyle,
14
+ borderWidth,
15
+ borderColor,
16
+ textColor,
17
+ bgColor,
18
+ lockSpacing,
19
+ ...rest
20
+ } = fieldProps;
21
+ const onChange = e => {
22
+ e.preventDefault();
23
+ };
24
+ return /*#__PURE__*/_jsx("div", {
25
+ style: {
26
+ width: "100%",
27
+ display: "flex"
28
+ },
29
+ contentEditable: false,
30
+ children: /*#__PURE__*/_jsx(Box, {
31
+ component: "input",
32
+ ...rest,
33
+ type: "number",
34
+ onChange: onChange,
35
+ sx: {
36
+ width: "100%",
37
+ border: `1px solid ${borderColor || "#FFF"}`,
38
+ padding: {
39
+ ...getTRBLBreakPoints(bannerSpacing)
40
+ },
41
+ height: height || "auto",
42
+ borderColor: borderColor || "transparent",
43
+ borderWidth: borderWidth || "1px",
44
+ borderRadius: {
45
+ ...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
46
+ },
47
+ borderStyle: borderStyle || "solid",
48
+ color: textColor || "#000",
49
+ background: bgColor || "transparent"
50
+ }
51
+ })
52
+ });
53
+ };
54
+ export default FormNumbers;
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ import { Box } from "@mui/material";
3
+ import { getTRBLBreakPoints, getBreakPointsValue } from "../../../helper/theme";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const FormRadioButton = props => {
6
+ const {
7
+ fieldProps
8
+ } = props;
9
+ const {
10
+ bannerSpacing,
11
+ height,
12
+ borderRadius,
13
+ borderStyle,
14
+ borderWidth,
15
+ borderColor,
16
+ textColor,
17
+ bgColor,
18
+ lockSpacing,
19
+ ...rest
20
+ } = fieldProps;
21
+ const onChange = e => {
22
+ e.preventDefault();
23
+ };
24
+ return /*#__PURE__*/_jsx("div", {
25
+ style: {
26
+ width: "100%",
27
+ display: "flex"
28
+ },
29
+ contentEditable: false,
30
+ children: /*#__PURE__*/_jsx(Box, {
31
+ component: "input",
32
+ ...rest,
33
+ type: "radio",
34
+ onChange: onChange,
35
+ sx: {
36
+ width: "100%",
37
+ border: `1px solid ${borderColor || "#FFF"}`,
38
+ padding: {
39
+ ...getTRBLBreakPoints(bannerSpacing)
40
+ },
41
+ height: height || "auto",
42
+ borderColor: borderColor || "transparent",
43
+ borderWidth: borderWidth || "1px",
44
+ borderRadius: {
45
+ ...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
46
+ },
47
+ borderStyle: borderStyle || "solid",
48
+ color: textColor || "#000",
49
+ background: bgColor || "transparent"
50
+ }
51
+ })
52
+ });
53
+ };
54
+ export default FormRadioButton;
@@ -1,9 +1,17 @@
1
1
  import FormEmail from "./FormEmail";
2
2
  import FormText from "./FormText";
3
3
  import FormTextArea from "./FormTextArea";
4
+ import FormNumbers from "./FormNumbers";
5
+ import FormDate from "./FormDate";
6
+ import FormCheckbox from "./FormCheckbox";
7
+ import FormRadioButton from "./FormRadioButton";
4
8
  const FormElements = {
5
9
  text: FormText,
6
10
  textArea: FormTextArea,
7
- email: FormEmail
11
+ email: FormEmail,
12
+ numbers: FormNumbers,
13
+ date: FormDate,
14
+ checkbox: FormCheckbox,
15
+ radioButton: FormRadioButton
8
16
  };
9
17
  export default FormElements;
@@ -8,8 +8,8 @@ export const validationMethods = {
8
8
  return "Enter valid email address";
9
9
  }
10
10
  },
11
- isRequired: value => {
12
- return value === '' ? "Required fields should not be empty" : "";
11
+ isRequired: (value, field_type = "") => {
12
+ return value === '' ? `${field_type ? field_type : "Required"} fields should not be empty` : "";
13
13
  }
14
14
  };
15
15
  export const validation = fields => {
@@ -17,7 +17,7 @@ export const validation = fields => {
17
17
  let filedValue = [];
18
18
  fields.map(field => {
19
19
  let val = field.rules.map(vm => {
20
- return validationMethods[vm](field["value"]);
20
+ return validationMethods[vm](field["value"], field["field_type"]);
21
21
  });
22
22
  return filedValue.push(...val);
23
23
  });
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from "react";
2
- import { Transforms } from "slate";
2
+ import { Transforms, Node } from "slate";
3
3
  import { useSlateStatic, ReactEditor } from "slate-react";
4
4
  import { IconButton, Tooltip, Grid } from "@mui/material";
5
5
  import DeleteIcon from "@mui/icons-material/Delete";
@@ -25,9 +25,18 @@ const FormField = props => {
25
25
  children,
26
26
  ...elementProps
27
27
  } = element;
28
- const FormElement = FormElements[elementType];
28
+ const et = elementType?.split(':');
29
+ const FormElement = FormElements[et[0]];
29
30
  const editor = useSlateStatic();
30
31
  const path = ReactEditor.findPath(editor, element);
32
+ const formPath = path.slice(0, path.length - 1);
33
+ const {
34
+ metadatamapping
35
+ } = Node?.get(editor, formPath) || {};
36
+ const updatedElement = {
37
+ ...element,
38
+ metadatamapping
39
+ };
31
40
  const [openSetttings, setOpenSettings] = useState(false);
32
41
  const onSettings = () => {
33
42
  setOpenSettings(true);
@@ -95,7 +104,7 @@ const FormField = props => {
95
104
  children: [!readOnly && /*#__PURE__*/_jsx(FieldToolbar, {}), /*#__PURE__*/_jsx(FormElement, {
96
105
  fieldProps: elementProps
97
106
  }), openSetttings ? /*#__PURE__*/_jsx(FieldPopup, {
98
- element: element,
107
+ element: updatedElement,
99
108
  onSave: onSave,
100
109
  onClose: onClose,
101
110
  customProps: customProps
@@ -71,11 +71,11 @@ const FormWorkflow = props => {
71
71
  children: [/*#__PURE__*/_jsx(Grid, {
72
72
  item: true,
73
73
  sx: classes.radioBtn,
74
- children: /*#__PURE__*/_jsx(RadioGroup, {
74
+ children: /*#__PURE__*/_jsxs(RadioGroup, {
75
75
  name: "set timing",
76
76
  value: schedule,
77
77
  defaultValue: 1,
78
- children: /*#__PURE__*/_jsx(FormControlLabel, {
78
+ children: [/*#__PURE__*/_jsx(FormControlLabel, {
79
79
  value: "immediately",
80
80
  label: "Immediately",
81
81
  onChange: () => {
@@ -84,7 +84,16 @@ const FormWorkflow = props => {
84
84
  control: /*#__PURE__*/_jsx(Radio, {
85
85
  size: "small"
86
86
  })
87
- })
87
+ }), /*#__PURE__*/_jsx(FormControlLabel, {
88
+ value: "after",
89
+ label: "After",
90
+ onChange: () => {
91
+ setSchedule("after");
92
+ },
93
+ control: /*#__PURE__*/_jsx(Radio, {
94
+ size: "small"
95
+ })
96
+ })]
88
97
  })
89
98
  }), schedule === "after" && /*#__PURE__*/_jsx(Grid, {
90
99
  item: true,
@@ -37,12 +37,14 @@ const LinkButton = props => {
37
37
  };
38
38
  const toggleLink = () => {
39
39
  setSelection(editor.selection);
40
- setLinkData({
41
- name: Editor.string(editor, editor.selection),
42
- url: blockProps?.href || "",
43
- showInNewTab: true
44
- });
45
- setShowInput(true);
40
+ if (editor.selection) {
41
+ setLinkData({
42
+ name: Editor.string(editor, editor.selection),
43
+ url: blockProps?.href || "",
44
+ showInNewTab: true
45
+ });
46
+ setShowInput(true);
47
+ }
46
48
  };
47
49
  const handleInputChange = ({
48
50
  target
@@ -266,6 +266,10 @@ const editorStyles = ({
266
266
  padding: "0px"
267
267
  }
268
268
  }
269
+ },
270
+ cardsTypo: {
271
+ color: theme?.palette?.editor?.textColor,
272
+ fontSize: '14px !important'
269
273
  }
270
274
  });
271
275
  export default editorStyles;
@@ -9,6 +9,7 @@ import ColorPickerButton from "../../common/ColorPickerButton";
9
9
  import { colors } from "../../Elements/Color Picker/defaultColors";
10
10
  import VariableButton from "../../Elements/Variables/VariableButton";
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { Fragment as _Fragment } from "react/jsx-runtime";
12
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
14
  const allTools = toolbarGroups.flat();
14
15
  const BasicToolbar = props => {
@@ -66,12 +67,14 @@ const BasicToolbar = props => {
66
67
  item: true,
67
68
  children: /*#__PURE__*/_jsx(Tooltip, {
68
69
  title: "Font Color",
69
- children: /*#__PURE__*/_jsx(ColorPickerButton, {
70
- value: activeColor || "#0000",
71
- onSave: color => {
72
- handleTextColor(color);
73
- },
74
- defaultColors: colors
70
+ children: /*#__PURE__*/_jsx(_Fragment, {
71
+ children: /*#__PURE__*/_jsx(ColorPickerButton, {
72
+ value: activeColor || "#0000",
73
+ onSave: color => {
74
+ handleTextColor(color);
75
+ },
76
+ defaultColors: colors
77
+ })
75
78
  })
76
79
  })
77
80
  })]
@@ -0,0 +1,24 @@
1
+ import { Box, IconButton } from "@mui/material";
2
+ import Icon from "../../../common/Icon";
3
+ import { useEditorContext } from "../../../hooks/useMouseMove";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ function InfinityAITool() {
6
+ const {
7
+ setOpenAI
8
+ } = useEditorContext();
9
+ return /*#__PURE__*/_jsx(Box, {
10
+ component: "div",
11
+ children: /*#__PURE__*/_jsx(IconButton, {
12
+ onClick: () => {
13
+ const text = window.getSelection().toString().trim();
14
+ if (text) {
15
+ setOpenAI("fromToolBar");
16
+ }
17
+ },
18
+ children: /*#__PURE__*/_jsx(Icon, {
19
+ icon: "infinityIcon"
20
+ })
21
+ })
22
+ });
23
+ }
24
+ export default InfinityAITool;
@@ -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 = {
@@ -26,7 +27,8 @@ const MiniTextFormat = props => {
26
27
  const {
27
28
  classes,
28
29
  editor,
29
- closeMainPopup
30
+ closeMainPopup,
31
+ customProps
30
32
  } = props;
31
33
  const [anchorEl, setAnchorEl] = useState(null);
32
34
  const open = Boolean(anchorEl);
@@ -48,7 +50,7 @@ const MiniTextFormat = props => {
48
50
  xs: 12,
49
51
  children: /*#__PURE__*/_jsxs("div", {
50
52
  className: "toolWrapper",
51
- children: [/*#__PURE__*/_jsx(SelectTypography, {
53
+ children: [customProps?.hideTools?.includes("infinityAI") ? null : /*#__PURE__*/_jsx(InfinityAITool, {}), /*#__PURE__*/_jsx(SelectTypography, {
52
54
  classes: classes,
53
55
  editor: editor,
54
56
  closeMainPopup: closeMainPopup