@flozy/editor 10.3.2 → 10.3.4

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 (164) hide show
  1. package/dist/Editor/ChatEditor.js +17 -16
  2. package/dist/Editor/CommonEditor.js +131 -16
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +46 -8
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
  6. package/dist/Editor/Elements/Accordion/Accordion.js +30 -7
  7. package/dist/Editor/Elements/Accordion/AccordionSummary.js +1 -23
  8. package/dist/Editor/Elements/AppHeader/AppHeader.js +10 -5
  9. package/dist/Editor/Elements/Button/EditorButton.js +27 -9
  10. package/dist/Editor/Elements/Carousel/CarouselItem.js +2 -1
  11. package/dist/Editor/Elements/Color Picker/ColorButtons.js +61 -14
  12. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  13. package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
  14. package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
  15. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +4 -2
  16. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +30 -28
  17. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +9 -7
  18. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +0 -1
  19. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +8 -4
  20. package/dist/Editor/Elements/Embed/Video.js +1 -1
  21. package/dist/Editor/Elements/Form/Form.js +3 -3
  22. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +0 -1
  23. package/dist/Editor/Elements/Form/FormField.js +3 -2
  24. package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
  25. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +35 -31
  26. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +7 -4
  27. package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
  28. package/dist/Editor/Elements/FreeGrid/helper.js +113 -0
  29. package/dist/Editor/Elements/FreeGrid/styles.js +14 -0
  30. package/dist/Editor/Elements/Grid/Grid.js +14 -2
  31. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  32. package/dist/Editor/Elements/Signature/Signature.css +2 -1
  33. package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +18 -5
  34. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +16 -3
  35. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  36. package/dist/Editor/Elements/Table/DragButton.js +0 -1
  37. package/dist/Editor/Elements/Table/Draggable.js +6 -2
  38. package/dist/Editor/Elements/Table/Styles.js +7 -0
  39. package/dist/Editor/Elements/Table/Table.js +3 -3
  40. package/dist/Editor/Elements/Table/TableCell.js +24 -5
  41. package/dist/Editor/Elements/Title/title.js +6 -6
  42. package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
  43. package/dist/Editor/MiniEditor.js +2 -1
  44. package/dist/Editor/Styles/EditorStyles.js +5 -5
  45. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
  46. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
  47. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  48. package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
  49. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
  50. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +4 -2
  51. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
  52. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
  53. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +7 -4
  54. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
  55. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +72 -12
  56. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +58 -10
  57. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
  58. package/dist/Editor/Toolbar/PopupTool/index.js +1 -1
  59. package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
  60. package/dist/Editor/assets/svg/BackIcon.js +18 -0
  61. package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
  62. package/dist/Editor/common/Checkbox/index.js +46 -0
  63. package/dist/Editor/common/Checkbox/styles.js +45 -0
  64. package/dist/Editor/common/ColorPickerButton.js +41 -16
  65. package/dist/Editor/common/CustomColorPicker/index.js +130 -0
  66. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  67. package/dist/Editor/common/CustomDialog2/index.js +94 -0
  68. package/dist/Editor/common/CustomDialog2/style.js +67 -0
  69. package/dist/Editor/common/CustomSelect.js +43 -0
  70. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  71. package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
  72. package/dist/Editor/common/Icon.js +28 -0
  73. package/dist/Editor/common/ImageSelector/ImageSelector.js +2 -2
  74. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  75. package/dist/Editor/common/LinkSettings/NavComponents.js +45 -65
  76. package/dist/Editor/common/LinkSettings/index.js +13 -26
  77. package/dist/Editor/common/LinkSettings/navOptions.js +2 -2
  78. package/dist/Editor/common/LinkSettings/style.js +164 -244
  79. package/dist/Editor/common/RadioGroup/index.js +48 -0
  80. package/dist/Editor/common/RadioGroup/styles.js +29 -0
  81. package/dist/Editor/common/RnD/ElementOptions/Actions.js +4 -5
  82. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
  83. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +4 -3
  84. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  85. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  86. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  87. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  88. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
  89. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +3 -2
  90. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  91. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +3 -1
  92. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +3 -2
  93. package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -1
  94. package/dist/Editor/common/RnD/OptionsPopup/style.js +0 -1
  95. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -2
  96. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  97. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  98. package/dist/Editor/common/RnD/Utils/gridDropItem.js +28 -19
  99. package/dist/Editor/common/RnD/Utils/index.js +3 -1
  100. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +42 -58
  101. package/dist/Editor/common/RnD/VirtualElement/helper.js +321 -131
  102. package/dist/Editor/common/RnD/VirtualElement/styles.js +16 -0
  103. package/dist/Editor/common/RnD/index.js +26 -12
  104. package/dist/Editor/common/Select/index.js +44 -7
  105. package/dist/Editor/common/Select/styles.js +30 -2
  106. package/dist/Editor/common/Shorthands/elements.js +54 -0
  107. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -2
  108. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +12 -9
  109. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  110. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -0
  111. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  112. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
  113. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  114. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +16 -8
  115. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +36 -10
  116. package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +115 -0
  117. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +16 -7
  118. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  119. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
  120. package/dist/Editor/common/SwipeableDrawer/style.js +14 -12
  121. package/dist/Editor/common/Uploader.js +16 -0
  122. package/dist/Editor/common/iconListV2.js +76 -0
  123. package/dist/Editor/common/iconslist.js +21 -0
  124. package/dist/Editor/commonStyle.js +116 -61
  125. package/dist/Editor/helper/index.js +4 -0
  126. package/dist/Editor/helper/textIndeces.js +58 -0
  127. package/dist/Editor/helper/theme.js +203 -2
  128. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  129. package/dist/Editor/hooks/useMouseMove.js +9 -3
  130. package/dist/Editor/hooks/useTable.js +5 -4
  131. package/dist/Editor/hooks/useThemeValues.js +63 -0
  132. package/dist/Editor/plugins/withEmbeds.js +1 -1
  133. package/dist/Editor/plugins/withHTML.js +3 -1
  134. package/dist/Editor/plugins/withTable.js +1 -1
  135. package/dist/Editor/theme/ThemeList.js +50 -173
  136. package/dist/Editor/theme/index.js +149 -0
  137. package/dist/Editor/themeSettings/ActiveTheme.js +82 -0
  138. package/dist/Editor/themeSettings/buttons/index.js +300 -0
  139. package/dist/Editor/themeSettings/buttons/style.js +23 -0
  140. package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
  141. package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
  142. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  143. package/dist/Editor/themeSettings/fonts/index.js +240 -0
  144. package/dist/Editor/themeSettings/fonts/style.js +62 -0
  145. package/dist/Editor/themeSettings/icons.js +60 -0
  146. package/dist/Editor/themeSettings/index.js +380 -0
  147. package/dist/Editor/themeSettings/style.js +299 -0
  148. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  149. package/dist/Editor/themeSettingsAI/index.js +355 -0
  150. package/dist/Editor/themeSettingsAI/saveTheme.js +202 -0
  151. package/dist/Editor/themeSettingsAI/style.js +332 -0
  152. package/dist/Editor/utils/SlateUtilityFunctions.js +161 -37
  153. package/dist/Editor/utils/accordion.js +14 -4
  154. package/dist/Editor/utils/button.js +1 -17
  155. package/dist/Editor/utils/customHooks/useTableResize.js +49 -9
  156. package/dist/Editor/utils/draftToSlate.js +3 -2
  157. package/dist/Editor/utils/events.js +50 -6
  158. package/dist/Editor/utils/font.js +40 -37
  159. package/dist/Editor/utils/formfield.js +1 -0
  160. package/dist/Editor/utils/helper.js +188 -26
  161. package/dist/Editor/utils/insertAppHeader.js +1 -1
  162. package/dist/Editor/utils/signature.js +2 -9
  163. package/dist/Editor/utils/updateFormName.js +22 -0
  164. package/package.json +4 -4
@@ -2,8 +2,11 @@ import { useMemo } from "react";
2
2
  import { activeMark, addMarkData, isBlockActive, toggleBlock } from "../../../utils/SlateUtilityFunctions";
3
3
  import CustomSelectTool from "./CustomSelectTool";
4
4
  import useWindowResize from "../../../hooks/useWindowResize";
5
- import { BREAKPOINTS_DEVICES, getBreakPointsValue } from "../../../helper/theme";
5
+ import { BREAKPOINTS_DEVICES, getBreakPointsValue, isTextCustomized as isCustomized, textThemeFields as themeFields } from "../../../helper/theme";
6
6
  import { sizeMap } from "../../../utils/font";
7
+ import { Editor } from "slate";
8
+ import { useEditorTheme } from "../../../hooks/useEditorTheme";
9
+ import { MenuItem, Select } from "@mui/material";
7
10
  import { jsx as _jsx } from "react/jsx-runtime";
8
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
12
  function Label({
@@ -18,26 +21,29 @@ function Label({
18
21
  });
19
22
  }
20
23
  function DisplayHeaderLabel({
21
- type
24
+ type,
25
+ isCustomized,
26
+ isPara = false
22
27
  }) {
23
28
  return /*#__PURE__*/_jsxs("div", {
24
- children: ["H", /*#__PURE__*/_jsx("sub", {
29
+ children: [isCustomized ? "*" : "", isPara ? "P" : "H", /*#__PURE__*/_jsx("sub", {
25
30
  children: type
26
31
  })]
27
32
  });
28
33
  }
29
- function getTypographyOptions(translation) {
30
- return [{
34
+ function getTypographyOptions(isCustomized, translation) {
35
+ const typographyOptions = [{
31
36
  id: 11,
32
37
  format: "headingOne",
33
38
  type: "block",
34
39
  title: /*#__PURE__*/_jsx(Label, {
35
40
  label: "H1",
36
- type: "Header",
41
+ type: "Heading",
37
42
  translation: translation
38
43
  }),
39
44
  label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
40
- type: 1
45
+ type: 1,
46
+ isCustomized: isCustomized
41
47
  }),
42
48
  group: "typography",
43
49
  value: "headingOne"
@@ -47,11 +53,12 @@ function getTypographyOptions(translation) {
47
53
  type: "block",
48
54
  title: /*#__PURE__*/_jsx(Label, {
49
55
  label: "H2",
50
- type: "Header",
56
+ type: "Heading",
51
57
  translation: translation
52
58
  }),
53
59
  label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
54
- type: 2
60
+ type: 2,
61
+ isCustomized: isCustomized
55
62
  }),
56
63
  group: "typography",
57
64
  value: "headingTwo"
@@ -61,63 +68,156 @@ function getTypographyOptions(translation) {
61
68
  type: "block",
62
69
  title: /*#__PURE__*/_jsx(Label, {
63
70
  label: "H3",
64
- type: "Header",
71
+ type: "Heading",
65
72
  translation: translation
66
73
  }),
67
74
  label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
68
- type: 3
75
+ type: 3,
76
+ isCustomized: isCustomized
69
77
  }),
70
78
  group: "typography",
71
79
  value: "headingThree"
72
80
  }, {
73
- id: 14,
74
- format: "fontSize",
75
- type: "mark",
81
+ id: 17,
82
+ format: "headingFour",
83
+ type: "block",
76
84
  title: /*#__PURE__*/_jsx(Label, {
77
- label: "L",
78
- type: "Large",
85
+ label: "H4",
86
+ type: "Heading",
79
87
  translation: translation
80
88
  }),
81
- label: "L",
89
+ label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
90
+ type: 4,
91
+ isCustomized: isCustomized
92
+ }),
82
93
  group: "typography",
83
- value: "huge"
94
+ value: "headingFour"
84
95
  }, {
85
- id: 15,
86
- format: "fontSize",
87
- type: "mark",
96
+ id: 18,
97
+ format: "headingFive",
98
+ type: "block",
88
99
  title: /*#__PURE__*/_jsx(Label, {
89
- label: "M",
90
- type: "Medium",
100
+ label: "H5",
101
+ type: "Heading",
91
102
  translation: translation
92
103
  }),
93
- label: "M",
104
+ label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
105
+ type: 5,
106
+ isCustomized: isCustomized
107
+ }),
94
108
  group: "typography",
95
- value: "medium"
109
+ value: "headingFive"
96
110
  }, {
97
- id: 16,
98
- format: "fontSize",
99
- type: "mark",
111
+ id: 19,
112
+ format: "headingSix",
113
+ type: "block",
100
114
  title: /*#__PURE__*/_jsx(Label, {
101
- label: "S",
102
- type: "Small",
115
+ label: "H6",
116
+ type: "Heading",
103
117
  translation: translation
104
118
  }),
105
- label: "S",
119
+ label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
120
+ type: 6,
121
+ isCustomized: isCustomized
122
+ }),
106
123
  group: "typography",
107
- value: "small"
108
- }];
124
+ value: "headingSix"
125
+ }, {
126
+ id: 20,
127
+ format: "paragraphOne",
128
+ type: "block",
129
+ title: /*#__PURE__*/_jsx(Label, {
130
+ label: "P1",
131
+ type: "Paragraph",
132
+ translation: translation
133
+ }),
134
+ label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
135
+ type: 1,
136
+ isCustomized: isCustomized,
137
+ isPara: true
138
+ }),
139
+ group: "typography",
140
+ value: "paragraphOne"
141
+ }, {
142
+ id: 21,
143
+ format: "paragraphTwo",
144
+ type: "block",
145
+ title: /*#__PURE__*/_jsx(Label, {
146
+ label: "P2",
147
+ type: "Paragraph",
148
+ translation: translation
149
+ }),
150
+ label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
151
+ type: 2,
152
+ isCustomized: isCustomized,
153
+ isPara: true
154
+ }),
155
+ group: "typography",
156
+ value: "paragraphTwo"
157
+ }, {
158
+ id: 22,
159
+ format: "paragraphThree",
160
+ type: "block",
161
+ title: /*#__PURE__*/_jsx(Label, {
162
+ label: "P3",
163
+ type: "Paragraph",
164
+ translation: translation
165
+ }),
166
+ label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
167
+ type: 3,
168
+ isCustomized: isCustomized,
169
+ isPara: true
170
+ }),
171
+ group: "typography",
172
+ value: "paragraphThree"
173
+ }
174
+ // {
175
+ // id: 14,
176
+ // format: "fontSize",
177
+ // type: "mark",
178
+ // title: <Label label="L" type="Large" />,
179
+ // label: "L",
180
+ // group: "typography",
181
+ // value: "huge",
182
+ // },
183
+ // {
184
+ // id: 15,
185
+ // format: "fontSize",
186
+ // type: "mark",
187
+ // title: <Label label="M" type="Medium" />,
188
+ // label: "M",
189
+ // group: "typography",
190
+ // value: "medium",
191
+ // },
192
+ // {
193
+ // id: 16,
194
+ // format: "fontSize",
195
+ // type: "mark",
196
+ // title: <Label label="S" type="Small" />,
197
+ // label: "S",
198
+ // group: "typography",
199
+ // value: "small",
200
+ // },
201
+ ];
202
+
203
+ return typographyOptions;
109
204
  }
110
205
  function SelectTypography({
111
206
  editor,
112
207
  classes,
113
208
  closeMainPopup,
209
+ type,
114
210
  customProps
115
211
  }) {
116
212
  const [size] = useWindowResize();
213
+ const {
214
+ theme
215
+ } = useEditorTheme();
117
216
  const {
118
217
  translation
119
218
  } = customProps;
120
- const typographyOptions = getTypographyOptions(translation);
219
+ const isTextCustomized = theme?.id ? isCustomized(editor) : false;
220
+ const typographyOptions = getTypographyOptions(isTextCustomized, translation);
121
221
  const updateMarkData = newVal => {
122
222
  const val = activeMark(editor, "fontSize");
123
223
  let upData = {
@@ -139,7 +239,10 @@ function SelectTypography({
139
239
  ...upData
140
240
  }
141
241
  });
242
+
243
+ // closeMainPopup();
142
244
  };
245
+
143
246
  const selectedBlock = useMemo(() => {
144
247
  return typographyOptions.find(t => {
145
248
  if (t.type === "block") {
@@ -161,15 +264,13 @@ function SelectTypography({
161
264
  });
162
265
  }, [typographyOptions, activeMark, isBlockActive, editor]);
163
266
  const onChange = (format, option) => {
164
- // add/reset block elements
165
- toggleBlock(editor, format);
166
267
  if (option.type === "block") {
167
- // reset old font size
168
- // let updatedValue = !selectedBlock ? {} : { xs: "16px", sm: "16px", md: "16px", lg: "16px" }
169
- addMarkData(editor, {
170
- format: "fontSize",
171
- value: {}
268
+ themeFields.forEach(field => {
269
+ Editor.removeMark(editor, field);
172
270
  });
271
+
272
+ // add/reset block elements
273
+ toggleBlock(editor, format);
173
274
  } else if (option.type === "mark") {
174
275
  const size = sizeMap[option.value] || "";
175
276
  const [sizeInNumber] = size.split("px");
@@ -177,11 +278,35 @@ function SelectTypography({
177
278
  }
178
279
  closeMainPopup();
179
280
  };
281
+ const typographyValue = selectedBlock?.value || "headingOne";
282
+ if (type === "fullWidth") {
283
+ return /*#__PURE__*/_jsx(Select, {
284
+ value: typographyValue,
285
+ className: "editor-dd",
286
+ onChange: e => {
287
+ const {
288
+ value
289
+ } = e.target;
290
+ const option = typographyOptions?.find(o => o.value === value);
291
+ onChange(value, option);
292
+ },
293
+ style: {
294
+ width: "100%",
295
+ height: "36px",
296
+ borderRadius: "10px",
297
+ fontSize: "14px"
298
+ },
299
+ children: typographyOptions.map((item, index) => /*#__PURE__*/_jsxs(MenuItem, {
300
+ value: item.value,
301
+ children: [item.title, " ", isTextCustomized && item.value === typographyValue ? " *" : ""]
302
+ }, index))
303
+ });
304
+ }
180
305
  return /*#__PURE__*/_jsx(CustomSelectTool, {
181
306
  options: typographyOptions,
182
307
  editor: editor,
183
308
  onChange: onChange,
184
- value: selectedBlock?.value || "headingOne",
309
+ value: typographyValue,
185
310
  classes: classes
186
311
  });
187
312
  }
@@ -1,4 +1,4 @@
1
- import { Fade, Grid, IconButton, Paper, Popper } from "@mui/material";
1
+ import { Fade, Grid, IconButton, Paper, Popper, useTheme } from "@mui/material";
2
2
  import SelectTypography from "./SelectTypography";
3
3
  import SelectList from "./SelectList";
4
4
  import { toolbarGroups } from "../../toolbarGroups";
@@ -14,7 +14,7 @@ import MiniColorPicker from "./MiniColorPicker";
14
14
  import SelectAlignment from "./SelectAlignment";
15
15
  import SelectFontSize from "./SelectFontSize";
16
16
  import InfinityAITool from "./InfinityAITool";
17
- import { viewSlateSelection } from "../../../utils/helper";
17
+ import { getSelectedElementColor, viewSlateSelection } from "../../../utils/helper";
18
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
20
20
  const DEFAULT_COLOR = {
@@ -35,11 +35,12 @@ const MiniTextFormat = props => {
35
35
  const open = Boolean(anchorEl);
36
36
  const id = open ? "popup-edit-tool" : "";
37
37
  const [size] = useWindowResize();
38
+ const theme = useTheme();
38
39
  const removeFontStyles = ["superscript", "subscript"];
39
40
  const fontStyle = allTools.filter(f => f.type === "mark" && !removeFontStyles.includes(f.format));
40
41
  const link = allTools.find(f => f.format?.indexOf("link") >= 0);
41
42
  const fontAlign = allTools.filter(f => f.format?.indexOf("align") >= 0);
42
- const activeColor = activeMark(editor, textColorFormat) || DEFAULT_COLOR[textColorFormat];
43
+ const activeColor = getSelectedElementColor(editor, textColorFormat, theme);
43
44
  const activeBg = activeMark(editor, textBgFormat) || DEFAULT_COLOR[textBgFormat];
44
45
  return /*#__PURE__*/_jsx(Grid, {
45
46
  container: true,
@@ -57,6 +58,7 @@ const MiniTextFormat = props => {
57
58
  classes: classes,
58
59
  editor: editor,
59
60
  closeMainPopup: closeMainPopup,
61
+ type: "miniToolBar",
60
62
  customProps: customProps
61
63
  }), /*#__PURE__*/_jsx("div", {
62
64
  className: "verticalLine"
@@ -92,7 +94,8 @@ const MiniTextFormat = props => {
92
94
  activeColor: activeColor,
93
95
  id: "11_cc",
94
96
  editor: editor,
95
- customProps: customProps
97
+ customProps: customProps,
98
+ type: "textColor"
96
99
  }), /*#__PURE__*/_jsx(MiniColorPicker, {
97
100
  format: textBgFormat,
98
101
  classes: classes,
@@ -50,7 +50,8 @@ const PopperHeader = props => {
50
50
  padding: 2,
51
51
  className: "headerContainer",
52
52
  style: {
53
- paddingTop: "5px"
53
+ paddingTop: "5px",
54
+ paddingBottom: "0px"
54
55
  },
55
56
  children: /*#__PURE__*/_jsxs(Grid, {
56
57
  item: true,
@@ -98,6 +98,9 @@ const usePopupStyle = theme => ({
98
98
  }
99
99
  }
100
100
  },
101
+ "& .MuiDivider-root": {
102
+ border: `0.5px solid ${theme?.palette?.editor?.deviderBgColor}`
103
+ },
101
104
  "@media only screen and (max-width: 599px)": {
102
105
  // margin: "10px !important",
103
106
  background: "unset",
@@ -111,6 +114,7 @@ const usePopupStyle = theme => ({
111
114
  width: "323px",
112
115
  maxWidth: "100%",
113
116
  overflowX: "hidden !important",
117
+ marginTop: "6px",
114
118
  // 30% of window height
115
119
  maxHeight: `${window.innerHeight * 0.45}px`,
116
120
  overflow: "auto",
@@ -130,7 +134,7 @@ const usePopupStyle = theme => ({
130
134
  },
131
135
  "& .accordionIcon": {
132
136
  "& p": {
133
- textAlign: 'left'
137
+ textAlign: "left"
134
138
  }
135
139
  }
136
140
  },
@@ -304,6 +308,21 @@ const usePopupStyle = theme => ({
304
308
  paddingRight: "0px !important"
305
309
  }
306
310
  },
311
+ textFormatContainer: {
312
+ ".saveThemeBtnsWrapper": {
313
+ position: "sticky",
314
+ bottom: "0px",
315
+ right: "0px",
316
+ boxShadow: `0px -3px 16px 0px ${theme?.palette?.editor?.cardShadow}`,
317
+ padding: "10px",
318
+ borderRadius: "8px 8px 19px 19px",
319
+ display: "flex",
320
+ justifyContent: "end",
321
+ alignItems: "center",
322
+ gap: "8px",
323
+ background: theme?.palette?.editor?.miniToolBarBackground
324
+ }
325
+ },
307
326
  textFormatLabel: {
308
327
  display: "flex",
309
328
  alignItems: "center",
@@ -335,9 +354,10 @@ const usePopupStyle = theme => ({
335
354
  borderBottom: `1px solid ${theme?.palette?.editor?.deviderBgColor} !important`
336
355
  },
337
356
  textFormatField: {
338
- marginBottom: "8px",
339
- marginTop: "8px"
357
+ marginBottom: "8px"
358
+ // marginTop: "8px",
340
359
  },
360
+
341
361
  textFormatField1: {
342
362
  marginBottom: "16px",
343
363
  marginTop: "10px"
@@ -416,6 +436,11 @@ const usePopupStyle = theme => ({
416
436
  "& .MuiOutlinedInput-notchedOutline": {
417
437
  border: `1px solid ${theme?.palette?.editor?.inputFieldBorder} !important`
418
438
  },
439
+ "& .MuiInputBase-root": {
440
+ "& input": {
441
+ border: "none !important"
442
+ }
443
+ },
419
444
  "& svg": {
420
445
  width: "20px",
421
446
  height: "24px"
@@ -424,9 +449,6 @@ const usePopupStyle = theme => ({
424
449
  fontFamilyListOptions: {
425
450
  "& .MuiAutocomplete-listbox": {
426
451
  padding: "0px",
427
- // "&::-webkit-scrollbar-thumb": {
428
- // background: `none !important`,
429
- // },
430
452
  "&::-webkit-scrollbar-thumb": {
431
453
  background: `${theme?.palette?.editor?.brainPopupScroll} !important`
432
454
  },
@@ -437,8 +459,8 @@ const usePopupStyle = theme => ({
437
459
  margin: "5px",
438
460
  borderRadius: "8px",
439
461
  color: theme?.palette?.editor?.menuOptionTextColor,
440
- fontSize: '14px',
441
- padding: '8px 12px',
462
+ fontSize: "14px",
463
+ padding: "8px 12px",
442
464
  '&[aria-selected="true"]': {
443
465
  backgroundColor: `${theme?.palette?.editor?.menuOptionSelectedOption} !important`
444
466
  }
@@ -537,7 +559,7 @@ const usePopupStyle = theme => ({
537
559
  }
538
560
  },
539
561
  alignItems: "flexStart",
540
- justifyContent: "center",
562
+ // justifyContent: "center",
541
563
  flexDirection: "row",
542
564
  "&:hover": {
543
565
  background: "unset"
@@ -786,8 +808,13 @@ const usePopupStyle = theme => ({
786
808
  padding: "0px"
787
809
  },
788
810
  defaultBtn: {
789
- color: "#0F172A",
790
- textTransform: "none"
811
+ color: "#2563EB !important",
812
+ textTransform: "none",
813
+ textDecoration: "underline",
814
+ "&.Mui-disabled": {
815
+ color: "#A0AEC0 !important",
816
+ textDecoration: "none"
817
+ }
791
818
  },
792
819
  templateCardBtnGrp: {
793
820
  display: "none",
@@ -864,7 +891,7 @@ const usePopupStyle = theme => ({
864
891
  margin: "30px",
865
892
  "& .MuiPaper-root": {
866
893
  overflow: "auto",
867
- backgroundColor: theme?.palette?.editor?.background,
894
+ backgroundColor: theme?.palette?.editor?.miniToolBarBackground,
868
895
  borderRadius: "14px !important",
869
896
  border: `1px solid ${theme?.palette?.editor?.inputFieldBorder} !important`,
870
897
  minWidth: "fit-content",
@@ -1138,6 +1165,39 @@ const usePopupStyle = theme => ({
1138
1165
  "& fieldset": {
1139
1166
  border: "none !important"
1140
1167
  }
1168
+ },
1169
+ customCheckBox: {
1170
+ marginTop: "4px",
1171
+ padding: "0px",
1172
+ "& .MuiCheckbox-root": {
1173
+ padding: "8px 8px 8px 10px",
1174
+ "&:hover": {
1175
+ background: "unset !important"
1176
+ }
1177
+ },
1178
+ "& button": {
1179
+ width: "14px !important",
1180
+ height: "14px !important",
1181
+ borderRadius: "3px",
1182
+ border: `1px solid ${theme?.palette?.editor?.buttonBorder3}`,
1183
+ padding: "0px",
1184
+ "& svg": {
1185
+ width: "10px",
1186
+ height: "10px"
1187
+ }
1188
+ },
1189
+ "& .checkedIcon": {
1190
+ background: "#2563EB",
1191
+ borderColor: "#2563EB"
1192
+ },
1193
+ "& .unCheckedIcon": {
1194
+ background: theme?.palette?.editor?.checkedIconBg
1195
+ },
1196
+ "& p": {
1197
+ margin: "0px !important",
1198
+ color: theme?.palette?.editor?.tv_text,
1199
+ fontSize: "13px"
1200
+ }
1141
1201
  }
1142
1202
  });
1143
1203
  export default usePopupStyle;
@@ -10,6 +10,8 @@ import { AllColors } from "../../Elements/Color Picker/ColorButtons";
10
10
  import { fontFamilyMap } from "../../utils/font";
11
11
  import { getBorderColor } from "../../utils/helper";
12
12
  import SelectTypography from "./MiniTextFormat/SelectTypography";
13
+ import { isTextCustomized, saveToTheme } from "../../helper/theme";
14
+ import { useEditorTheme } from "../../hooks/useEditorTheme";
13
15
  import SelectSuperSubscript from "./MiniTextFormat/SelectSuperSubscript";
14
16
  import { ColorResetIcon, TextDefaultStyleIcon } from "../../common/iconListV2";
15
17
  import FontFamilyAutocomplete from "../FormatTools/FontFamilyAutocomplete";
@@ -43,7 +45,7 @@ const TextFormat = props => {
43
45
  const pageSettingLine = pageSt?.pageProps?.lineHeight;
44
46
  const {
45
47
  fontFamilies,
46
- theme
48
+ theme: appTheme
47
49
  } = useEditorContext();
48
50
  const breakpoint = getDevice(window.innerWidth);
49
51
  const fontWeight = allTools.find(f => f.format === "fontWeight");
@@ -62,6 +64,11 @@ const TextFormat = props => {
62
64
  color: "",
63
65
  bgColor: ""
64
66
  };
67
+ const {
68
+ theme,
69
+ updateTheme
70
+ } = useEditorTheme();
71
+ const customized = isTextCustomized(editor);
65
72
  let lineSpacingValue = activeMark(editor, "lineHeight");
66
73
  lineSpacingValue = lineSpacingValue?.[breakpoint] !== undefined ? lineSpacingValue : pageSettingLine;
67
74
  const handleColorPicker = type => e => {
@@ -116,6 +123,51 @@ const TextFormat = props => {
116
123
  sx: classes.textFormatWrapper,
117
124
  className: "text-formatter-popup",
118
125
  children: [/*#__PURE__*/_jsxs(Grid, {
126
+ item: true,
127
+ xs: 12,
128
+ children: [/*#__PURE__*/_jsxs(Grid, {
129
+ container: true,
130
+ justifyContent: "space-between",
131
+ alignItems: "center",
132
+ children: [/*#__PURE__*/_jsx(Grid, {
133
+ item: true,
134
+ children: /*#__PURE__*/_jsx(Typography, {
135
+ variant: "body1",
136
+ color: "primary",
137
+ sx: classes.typoLabel,
138
+ children: "Style"
139
+ })
140
+ }), /*#__PURE__*/_jsx(Grid, {
141
+ item: true,
142
+ children: theme?.id ? /*#__PURE__*/_jsx(Button, {
143
+ sx: classes.defaultBtn,
144
+ onClick: () => {
145
+ const {
146
+ field,
147
+ theme
148
+ } = saveToTheme(editor) || {};
149
+ updateTheme(theme, {
150
+ action: "ELEMENT_PROPS_CHANGE",
151
+ fieldName: field
152
+ });
153
+ },
154
+ disabled: !customized,
155
+ children: "Save to theme"
156
+ }) : null
157
+ })]
158
+ }), /*#__PURE__*/_jsx(Grid, {
159
+ item: true,
160
+ xs: 12,
161
+ sx: classes.textFormatField,
162
+ children: /*#__PURE__*/_jsx(SelectTypography, {
163
+ editor: editor,
164
+ classes: classes,
165
+ closeMainPopup: closeMainPopup,
166
+ type: "fullWidth",
167
+ customProps: customProps
168
+ })
169
+ })]
170
+ }), /*#__PURE__*/_jsxs(Grid, {
119
171
  item: true,
120
172
  xs: 12,
121
173
  children: [/*#__PURE__*/_jsxs(Grid, {
@@ -242,7 +294,8 @@ const TextFormat = props => {
242
294
  rounded: true,
243
295
  title: translation("textColor"),
244
296
  id: "11_cc",
245
- classes: classes
297
+ classes: classes,
298
+ type: "textColor"
246
299
  }, "11_cc")
247
300
  })]
248
301
  }), /*#__PURE__*/_jsxs(Grid, {
@@ -268,7 +321,7 @@ const TextFormat = props => {
268
321
  children: /*#__PURE__*/_jsx(Button, {
269
322
  sx: classes.defaultBtn2,
270
323
  startIcon: /*#__PURE__*/_jsx(ColorResetIcon, {
271
- stroke: theme?.palette?.type === "dark" ? "#505359" : "#A2B0B9"
324
+ stroke: appTheme?.palette?.type === "dark" ? "#505359" : "#A2B0B9"
272
325
  }),
273
326
  onClick: handleDefault({
274
327
  format: "bgColor"
@@ -358,12 +411,7 @@ const TextFormat = props => {
358
411
  xs: 12,
359
412
  className: "typo-icons",
360
413
  sx: classes.evenSpace,
361
- children: [/*#__PURE__*/_jsx(SelectTypography, {
362
- classes: classes,
363
- editor: editor,
364
- closeMainPopup: closeMainPopup || onClose,
365
- customProps: customProps
366
- }), fontStyle?.map((m, i) => {
414
+ children: [fontStyle?.map((m, i) => {
367
415
  return /*#__PURE__*/_jsx(MarkButton, {
368
416
  editor: editor,
369
417
  ...m,
@@ -402,7 +450,7 @@ const TextFormat = props => {
402
450
  value: lineSpacingValue,
403
451
  onChange: handleLineSpacing,
404
452
  data: {
405
- key: 'lineHeight'
453
+ key: "lineHeight"
406
454
  }
407
455
  })
408
456
  })]