@flozy/editor 10.8.9 → 10.9.1

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 (152) hide show
  1. package/dist/Editor/ChatEditor.js +17 -16
  2. package/dist/Editor/CommonEditor.js +138 -27
  3. package/dist/Editor/DialogWrapper.js +31 -25
  4. package/dist/Editor/Editor.css +39 -11
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
  6. package/dist/Editor/Elements/AI/Styles.js +1 -0
  7. package/dist/Editor/Elements/Accordion/Accordion.js +28 -22
  8. package/dist/Editor/Elements/Accordion/AccordionButton.js +12 -3
  9. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  10. package/dist/Editor/Elements/Attachments/AttachmentStyles.js +16 -0
  11. package/dist/Editor/Elements/Attachments/Attachments.js +153 -11
  12. package/dist/Editor/Elements/Attachments/AttachmentsButton.js +8 -3
  13. package/dist/Editor/Elements/Button/EditorButton.js +23 -7
  14. package/dist/Editor/Elements/Color Picker/ColorButtons.js +61 -14
  15. package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
  16. package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
  17. package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
  18. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +134 -55
  19. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SelectV1.js +7 -8
  20. package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +8 -3
  21. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +1 -1
  22. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +1 -1
  23. package/dist/Editor/Elements/Embed/Embed.js +36 -43
  24. package/dist/Editor/Elements/Embed/Image.js +236 -23
  25. package/dist/Editor/Elements/Embed/Video.js +246 -15
  26. package/dist/Editor/Elements/Form/FormField.js +1 -1
  27. package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
  28. package/dist/Editor/Elements/Form/Workflow/constant.js +25 -1
  29. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +39 -33
  30. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +7 -4
  31. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -0
  32. package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
  33. package/dist/Editor/Elements/FreeGrid/helper.js +115 -0
  34. package/dist/Editor/Elements/FreeGrid/styles.js +9 -0
  35. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  36. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +2 -1
  37. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  38. package/dist/Editor/Elements/Table/Table.js +3 -3
  39. package/dist/Editor/Elements/Title/title.js +6 -6
  40. package/dist/Editor/Elements/TopBanner/TopBanner.js +4 -2
  41. package/dist/Editor/Elements/TopBanner/TopBannerButton.js +5 -3
  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 +20 -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 +33 -29
  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 +23 -23
  52. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +25 -7
  53. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
  54. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +24 -8
  55. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
  56. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +70 -10
  57. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +73 -14
  58. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
  59. package/dist/Editor/Toolbar/PopupTool/index.js +5 -2
  60. package/dist/Editor/Toolbar/toolbarGroups.js +56 -10
  61. package/dist/Editor/assets/svg/BackIcon.js +18 -0
  62. package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
  63. package/dist/Editor/common/ColorPickerButton.js +38 -16
  64. package/dist/Editor/common/CustomColorPicker/index.js +130 -0
  65. package/dist/Editor/common/CustomColorPicker/style.js +53 -0
  66. package/dist/Editor/common/CustomDialog2/index.js +94 -0
  67. package/dist/Editor/common/CustomDialog2/style.js +67 -0
  68. package/dist/Editor/common/CustomSelect.js +43 -0
  69. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  70. package/dist/Editor/common/FontLoader/FontLoader.js +4 -0
  71. package/dist/Editor/common/Icon.js +28 -0
  72. package/dist/Editor/common/ImageSelector/ImageSelector.js +45 -7
  73. package/dist/Editor/common/ImageSelector/Options/Upload.js +26 -11
  74. package/dist/Editor/common/ImageSelector/Styles.js +3 -9
  75. package/dist/Editor/common/LinkSettings/NavComponents.js +6 -2
  76. package/dist/Editor/common/MentionsPopup/index.js +9 -1
  77. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
  78. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
  79. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
  80. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
  81. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
  82. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
  83. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +20 -7
  84. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
  85. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +9 -1
  86. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +20 -7
  87. package/dist/Editor/common/RnD/GuideLines/styles.js +1 -1
  88. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -2
  89. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
  90. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
  91. package/dist/Editor/common/RnD/Utils/gridDropItem.js +28 -18
  92. package/dist/Editor/common/RnD/Utils/index.js +3 -1
  93. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +45 -58
  94. package/dist/Editor/common/RnD/VirtualElement/helper.js +320 -130
  95. package/dist/Editor/common/RnD/VirtualElement/styles.js +22 -0
  96. package/dist/Editor/common/RnD/index.js +48 -13
  97. package/dist/Editor/common/Shorthands/elements.js +62 -4
  98. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
  99. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -0
  100. package/dist/Editor/common/StyleBuilder/fieldStyle.js +1 -0
  101. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +15 -2
  102. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
  103. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
  104. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +16 -8
  105. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +36 -10
  106. package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +115 -0
  107. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +16 -7
  108. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  109. package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +2 -0
  110. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
  111. package/dist/Editor/common/StyleBuilder/index.js +8 -4
  112. package/dist/Editor/common/Uploader.js +125 -17
  113. package/dist/Editor/common/UploaderWithProgress.js +183 -0
  114. package/dist/Editor/common/iconslist.js +21 -0
  115. package/dist/Editor/commonStyle.js +107 -64
  116. package/dist/Editor/helper/index.js +10 -2
  117. package/dist/Editor/helper/textIndeces.js +58 -0
  118. package/dist/Editor/helper/theme.js +203 -2
  119. package/dist/Editor/hooks/useEditorTheme.js +153 -0
  120. package/dist/Editor/hooks/useMouseMove.js +9 -3
  121. package/dist/Editor/hooks/useThemeValues.js +63 -0
  122. package/dist/Editor/plugins/withEmbeds.js +12 -1
  123. package/dist/Editor/plugins/withHTML.js +58 -3
  124. package/dist/Editor/plugins/withTable.js +1 -1
  125. package/dist/Editor/service/fileupload.js +70 -0
  126. package/dist/Editor/theme/ThemeList.js +50 -173
  127. package/dist/Editor/theme/index.js +149 -0
  128. package/dist/Editor/themeSettings/ActiveTheme.js +82 -0
  129. package/dist/Editor/themeSettings/buttons/index.js +300 -0
  130. package/dist/Editor/themeSettings/buttons/style.js +23 -0
  131. package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
  132. package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
  133. package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
  134. package/dist/Editor/themeSettings/fonts/index.js +240 -0
  135. package/dist/Editor/themeSettings/fonts/style.js +62 -0
  136. package/dist/Editor/themeSettings/icons.js +60 -0
  137. package/dist/Editor/themeSettings/index.js +380 -0
  138. package/dist/Editor/themeSettings/style.js +299 -0
  139. package/dist/Editor/themeSettingsAI/icons.js +96 -0
  140. package/dist/Editor/themeSettingsAI/index.js +355 -0
  141. package/dist/Editor/themeSettingsAI/saveTheme.js +202 -0
  142. package/dist/Editor/themeSettingsAI/style.js +332 -0
  143. package/dist/Editor/utils/SlateUtilityFunctions.js +183 -21
  144. package/dist/Editor/utils/accordion.js +68 -40
  145. package/dist/Editor/utils/button.js +1 -17
  146. package/dist/Editor/utils/draftToSlate.js +3 -2
  147. package/dist/Editor/utils/events.js +94 -89
  148. package/dist/Editor/utils/font.js +40 -37
  149. package/dist/Editor/utils/helper.js +97 -21
  150. package/dist/Editor/utils/insertAppHeader.js +8 -4
  151. package/package.json +4 -4
  152. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +0 -454
@@ -133,7 +133,11 @@ const editorStyles = ({
133
133
  },
134
134
  "& .accordion-summary-collapse-btn": {
135
135
  padding: "4px",
136
- width: '5px'
136
+ width: "5px",
137
+ "& svg:hover": {
138
+ background: theme?.palette?.editor?.tv_hover_bg,
139
+ borderRadius: "4px"
140
+ }
137
141
  },
138
142
  "& .workflow-icon-btn": {
139
143
  pointerEvents: "none",
@@ -215,6 +219,17 @@ const editorStyles = ({
215
219
  borderRadius: "12px",
216
220
  "& svg": {
217
221
  marginRight: "8px"
222
+ },
223
+ "& .circularProgress-cls": {
224
+ "& svg": {
225
+ width: "15px !important",
226
+ height: "15px !important"
227
+ }
228
+ },
229
+ "& .uploadCancel": {
230
+ color: theme?.palette?.editor?.closeButtonSvgStroke,
231
+ width: "25px !important",
232
+ height: "25px !important"
218
233
  }
219
234
  },
220
235
  "& .content-editable.empty": {
@@ -242,7 +257,7 @@ const editorStyles = ({
242
257
  }
243
258
  },
244
259
  "& .section-tw": {
245
- background: 'transparent !important',
260
+ background: "transparent !important",
246
261
  "& button": {
247
262
  padding: "2px",
248
263
  borderRadius: "0px",
@@ -291,8 +306,8 @@ const editorStyles = ({
291
306
  }
292
307
  },
293
308
  "& ::selection": {
294
- background: 'rgba(35, 131, 226, 0.35)!important',
295
- color: 'inherit'
309
+ // background: 'rgba(35, 131, 226, 0.35)!important',
310
+ color: "inherit"
296
311
  },
297
312
  "&.readOnlyContainer": {
298
313
  "& .max-content": {
@@ -302,7 +317,7 @@ const editorStyles = ({
302
317
  },
303
318
  fullScreenWrapper: {
304
319
  "& .editor-wrapper": {
305
- paddingTop: '20px'
320
+ paddingTop: "20px"
306
321
  },
307
322
  "& .MuiDialog-paper, & .MuiPopover-paper": {
308
323
  background: `${theme?.palette?.editor?.background} !important`
@@ -1,8 +1,32 @@
1
1
  import React from "react";
2
2
  import { Select, MenuItem } from "@mui/material";
3
- import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
3
+ import { addMarkData, activeMark, getSelectedElementStyle } from "../../utils/SlateUtilityFunctions.js";
4
+ import { toolbarGroups } from "../toolbarGroups.js";
4
5
  import KeyboardArrowDownRoundedIcon from "@mui/icons-material/KeyboardArrowDownRounded";
6
+ import { googleFontList as defaultFonts } from "../../common/FontLoader/FontList.js";
5
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
+ const allTools = toolbarGroups.flat();
9
+ const fontWeight = allTools.find(f => f.format === "fontWeight");
10
+ export const getValue = (editor, format) => {
11
+ switch (format) {
12
+ case "fontFamily":
13
+ {
14
+ const style = getSelectedElementStyle("font-family", editor, format);
15
+ return style || defaultFonts[0];
16
+ }
17
+ case "fontWeight":
18
+ {
19
+ const {
20
+ options
21
+ } = fontWeight || {};
22
+ const fontWeightStyle = getSelectedElementStyle("font-weight", editor, format);
23
+ const selected = options?.find(o => o.value === fontWeightStyle || o.numVal === fontWeightStyle);
24
+ return selected?.value;
25
+ }
26
+ default:
27
+ return activeMark(editor, format);
28
+ }
29
+ };
6
30
  const Dropdown = ({
7
31
  classes,
8
32
  editor,
@@ -10,7 +34,7 @@ const Dropdown = ({
10
34
  options,
11
35
  width
12
36
  }) => {
13
- const value = activeMark(editor, format);
37
+ const value = activeMark(editor, format, true) || getValue(editor, format);
14
38
  const changeMarkData = (event, format) => {
15
39
  event.preventDefault();
16
40
  const value = event.target.value;
@@ -20,7 +44,7 @@ const Dropdown = ({
20
44
  });
21
45
  };
22
46
  return /*#__PURE__*/_jsx(Select, {
23
- value: value,
47
+ value: value || options?.[0]?.value,
24
48
  className: "editor-dd",
25
49
  onChange: e => changeMarkData(e, format),
26
50
  MenuProps: {
@@ -1,9 +1,10 @@
1
1
  import React from "react";
2
2
  import { Autocomplete, TextField } from "@mui/material";
3
- import { activeMark, addMarkData } from "../../utils/SlateUtilityFunctions.js";
3
+ import { addMarkData } from "../../utils/SlateUtilityFunctions.js";
4
4
  import usePopupStyle from "../PopupTool/PopupToolStyle.js";
5
5
  import { useEditorContext } from "../../hooks/useMouseMove.js";
6
- import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
6
+ import KeyboardArrowDownRoundedIcon from "@mui/icons-material/KeyboardArrowDownRounded";
7
+ import { getValue } from "./Dropdown.js";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  const FontFamilyAutocomplete = ({
9
10
  editor,
@@ -14,7 +15,7 @@ const FontFamilyAutocomplete = ({
14
15
  val = "",
15
16
  webFont = false
16
17
  }) => {
17
- const markValue = activeMark(editor, format);
18
+ const markValue = getValue(editor, format);
18
19
  const value = !webFont ? markValue : val;
19
20
  const changeMarkData = (event, newValue, format) => {
20
21
  if (!webFont) {
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import Icon from "../../common/Icon";
3
3
  import Button from "../../common/Button";
4
- import { toggleMark, isMarkActive } from "../../utils/SlateUtilityFunctions.js";
4
+ import { toggleMark, isMarkBtnActive } from "../../utils/SlateUtilityFunctions.js";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  const MarkButton = ({
7
7
  editor,
@@ -13,7 +13,7 @@ const MarkButton = ({
13
13
  translation
14
14
  } = customProps;
15
15
  return /*#__PURE__*/_jsx(Button, {
16
- active: isMarkActive(editor, format),
16
+ active: isMarkBtnActive(editor, format),
17
17
  format: format,
18
18
  onMouseDown: e => {
19
19
  e.preventDefault();
@@ -1,27 +1,36 @@
1
1
  import React, { useEffect, useRef, useState } from "react";
2
2
  import { TextField, IconButton } from "@mui/material";
3
- import { addMarkData, activeMark, isBlockActive } from "../../utils/SlateUtilityFunctions.js";
4
- import { headingMap, sizeMap } from "../../utils/font.js";
5
- import { getBreakPointsValue } from "../../helper/theme.js";
3
+ import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
4
+ import { getBreakPointsValue, getTextSizeVal } from "../../helper/theme.js";
6
5
  import useWindowResize from "../../hooks/useWindowResize.js";
7
6
  import { BREAKPOINTS_DEVICES } from "../../helper/theme.js";
8
7
  import { TextSizeDownArrow, TextSizeUpArrow } from "../../common/iconListV2.js";
9
8
  import { jsx as _jsx } from "react/jsx-runtime";
10
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
10
  import { Fragment as _Fragment } from "react/jsx-runtime";
12
- const TextSize = ({
13
- classes,
14
- editor,
15
- format,
16
- fullWidth
17
- }) => {
18
- const [size] = useWindowResize();
19
- const val = activeMark(editor, format);
20
- const value = getBreakPointsValue(val, size?.device);
11
+ const TextSize = props => {
12
+ const {
13
+ classes,
14
+ editor,
15
+ format,
16
+ fullWidth,
17
+ fromMiniTextFormat,
18
+ setResizedSize,
19
+ resizedSize
20
+ } = props;
21
21
  const [fontSize, setFontSize] = useState();
22
+ const sizeValue = fromMiniTextFormat ? resizedSize : fontSize;
23
+ const setSizeValue = fromMiniTextFormat ? setResizedSize : setFontSize;
22
24
  const timerRef = useRef();
25
+ const [size] = useWindowResize();
26
+ const val = activeMark(editor, format);
27
+
28
+ // const noFontSize =
29
+ // val === "normal" || (typeof val === "object" && !Object.keys(val)?.length);
30
+
31
+ const value = getTextSizeVal(editor);
23
32
  useEffect(() => {
24
- setFontSize(getSizeVal());
33
+ setSizeValue(getSizeVal());
25
34
  }, [value]);
26
35
  const updateMarkData = newVal => {
27
36
  let upData = {
@@ -48,38 +57,33 @@ const TextSize = ({
48
57
  if (value) {
49
58
  let inc = parseInt(value);
50
59
  inc = inc > 200 ? 200 : inc;
60
+ setSizeValue(inc);
51
61
  updateMarkData(inc);
52
62
  } else {
53
- setFontSize(null);
63
+ setSizeValue(null);
54
64
  }
55
65
  };
56
66
  const getSizeVal = () => {
57
67
  try {
58
- let size = `${value}`?.indexOf("px") >= 0 ? value : sizeMap[value] || value;
59
- Object.entries(headingMap).forEach(([format, value]) => {
60
- if (isBlockActive(editor, format) && isNaN(parseInt(size))) {
61
- size = value;
62
- }
63
- });
64
- return parseInt(size);
68
+ return parseInt(value);
65
69
  } catch (err) {
66
70
  return "";
67
71
  }
68
72
  };
69
- const combinedOldVal = getSizeVal();
70
73
  const onIncreaseSize = () => {
71
- let inc = (combinedOldVal || 0) + 1;
72
- inc = inc > 200 ? 200 : inc;
73
- updateMarkData(inc);
74
+ const newValue = Math.min((sizeValue || 16) + 1, 200);
75
+ setSizeValue(newValue);
76
+ updateMarkData(newValue);
74
77
  };
75
78
  const onDecreaseSize = () => {
76
- const newVal = combinedOldVal - 1 < 0 ? 0 : combinedOldVal - 1;
77
- updateMarkData(newVal);
79
+ const newValue = sizeValue ? Math.max(sizeValue - 1, 1) : 16;
80
+ setSizeValue(newValue);
81
+ updateMarkData(newValue);
78
82
  };
79
83
  const onChange = e => {
80
84
  clearTimeout(timerRef.current);
81
85
  const value = e.target.value;
82
- setFontSize(value);
86
+ setSizeValue(value);
83
87
  timerRef.current = setTimeout(() => {
84
88
  onChangeSize(value);
85
89
  }, 500);
@@ -87,7 +91,7 @@ const TextSize = ({
87
91
  return /*#__PURE__*/_jsx(_Fragment, {
88
92
  children: /*#__PURE__*/_jsx(TextField, {
89
93
  sx: classes?.textSize,
90
- value: fontSize,
94
+ value: sizeValue || 16,
91
95
  onChange: onChange,
92
96
  size: "small",
93
97
  inputProps: {
@@ -215,7 +215,8 @@ const MiniToolbar = props => {
215
215
  setPopper: setPopper,
216
216
  onClose: onClose,
217
217
  search: search,
218
- onSearch: onSearch
218
+ onSearch: onSearch,
219
+ closeMainPopup: onClose
219
220
  })]
220
221
  }) : null
221
222
  })]
@@ -12,7 +12,8 @@ function MiniColorPicker(props) {
12
12
  classes,
13
13
  id,
14
14
  editor,
15
- customProps
15
+ customProps,
16
+ type
16
17
  } = props;
17
18
  const [openColorTool, setOpenColorTool] = useState(null);
18
19
  const {
@@ -38,7 +39,8 @@ function MiniColorPicker(props) {
38
39
  classes: classes,
39
40
  forMiniTool: true,
40
41
  openColorTool: openColorTool,
41
- closeColorTool: () => setOpenColorTool(null)
42
+ closeColorTool: () => setOpenColorTool(null),
43
+ type: type
42
44
  }, id)]
43
45
  });
44
46
  }
@@ -1,25 +1,30 @@
1
1
  import { useEffect, useRef, useState } from "react";
2
- import { activeMark, addMarkData, isBlockActive } from "../../../utils/SlateUtilityFunctions";
2
+ import { activeMark, addMarkData } from "../../../utils/SlateUtilityFunctions";
3
3
  import { Button, IconButton, Popover, TextField } from "@mui/material";
4
4
  import DownArrowIcon from "../../../assets/svg/DownArrowIcon";
5
5
  import useWindowResize from "../../../hooks/useWindowResize";
6
- import { BREAKPOINTS_DEVICES, getBreakPointsValue } from "../../../helper/theme";
7
- import { headingMap, sizeMap } from "../../../utils/font";
6
+ import { BREAKPOINTS_DEVICES, getBreakPointsValue, getTextSizeVal } from "../../../helper/theme";
8
7
  import { jsx as _jsx } from "react/jsx-runtime";
9
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
9
  const fontSizeOptions = [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 26, 32, 36, 40, 48, 64, 96, 128];
11
- function SelectFontSize({
12
- editor,
13
- classes
14
- }) {
10
+ function SelectFontSize(props) {
11
+ const {
12
+ editor,
13
+ classes,
14
+ fromMiniTextFormat,
15
+ setResizedSize,
16
+ resizedSize
17
+ } = props;
15
18
  const format = "fontSize";
16
19
  const [fontSize, setFontSize] = useState();
20
+ const sizeValue = fromMiniTextFormat ? resizedSize : fontSize;
21
+ const setSizeValue = fromMiniTextFormat ? setResizedSize : setFontSize;
17
22
  const [anchorEl, setAnchorEl] = useState(null);
18
23
  const open = Boolean(anchorEl);
19
24
  const containerRef = useRef();
20
25
  const [size] = useWindowResize();
21
26
  const val = activeMark(editor, format);
22
- const value = getBreakPointsValue(val, size?.device);
27
+ const value = getTextSizeVal(editor);
23
28
  const timerRef = useRef();
24
29
  const updateMarkData = newVal => {
25
30
  let upData = {
@@ -46,31 +51,26 @@ function SelectFontSize({
46
51
  if (value) {
47
52
  let inc = parseInt(value);
48
53
  inc = inc > 200 ? 200 : inc;
54
+ setSizeValue(inc);
49
55
  updateMarkData(inc);
50
56
  } else {
51
- setFontSize(null);
57
+ setSizeValue(null);
52
58
  }
53
59
  };
54
60
  const getSizeVal = () => {
55
61
  try {
56
- let size = `${value}`?.indexOf("px") >= 0 ? value : sizeMap[value] || value;
57
- Object.entries(headingMap).forEach(([format, value]) => {
58
- if (isBlockActive(editor, format) && isNaN(parseInt(size))) {
59
- size = value;
60
- }
61
- });
62
- return isNaN(parseInt(size)) ? 14 : parseInt(size);
62
+ return parseInt(value);
63
63
  } catch (err) {
64
64
  return "";
65
65
  }
66
66
  };
67
67
  useEffect(() => {
68
- setFontSize(getSizeVal());
68
+ setSizeValue(getSizeVal());
69
69
  }, [value]);
70
70
  const onChange = e => {
71
71
  clearTimeout(timerRef.current);
72
72
  const value = e.target.value;
73
- setFontSize(value);
73
+ setSizeValue(value);
74
74
  timerRef.current = setTimeout(() => {
75
75
  onChangeSize(value);
76
76
  }, 500);
@@ -83,7 +83,7 @@ function SelectFontSize({
83
83
  },
84
84
  children: [/*#__PURE__*/_jsx(TextField, {
85
85
  sx: classes?.miniFontSizeInput,
86
- value: fontSize,
86
+ value: sizeValue,
87
87
  onChange: onChange,
88
88
  size: "small"
89
89
  }), /*#__PURE__*/_jsx(IconButton, {
@@ -97,16 +97,16 @@ function SelectFontSize({
97
97
  anchorEl: anchorEl,
98
98
  onClose: () => setAnchorEl(null),
99
99
  anchorOrigin: {
100
- vertical: 'bottom',
101
- horizontal: 'left'
100
+ vertical: "bottom",
101
+ horizontal: "left"
102
102
  },
103
103
  sx: classes.customSelectPopoverWrapper,
104
104
  children: fontSizeOptions.map((s, i) => {
105
105
  return /*#__PURE__*/_jsx("div", {
106
106
  children: /*#__PURE__*/_jsx(Button, {
107
- className: `customSelectOptionLabel ${fontSize === s ? "selected" : ""}`,
107
+ className: `customSelectOptionLabel ${sizeValue === s ? "selected" : ""}`,
108
108
  onClick: () => {
109
- setFontSize(s);
109
+ setSizeValue(s);
110
110
  onChangeSize(s);
111
111
  },
112
112
  children: s
@@ -2,7 +2,7 @@ import { useMemo } from "react";
2
2
  import { isBlockActive, toggleBlock } from "../../../utils/SlateUtilityFunctions";
3
3
  import CustomSelectTool from "./CustomSelectTool";
4
4
  import Icon from "../../../common/Icon";
5
- import { insertAccordion } from "../../../utils/accordion";
5
+ import { insertAccordion, toggleAccordion } from "../../../utils/accordion";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
8
  function Label({
@@ -16,8 +16,8 @@ function Label({
16
16
  }), " ", label]
17
17
  });
18
18
  }
19
- function getListOptions(translation) {
20
- return [{
19
+ function getListOptions(translation, listType) {
20
+ const list = [{
21
21
  id: 15,
22
22
  value: "orderedList",
23
23
  type: "block",
@@ -53,7 +53,8 @@ function getListOptions(translation) {
53
53
  icon: "check-list-item"
54
54
  }),
55
55
  group: "list"
56
- }, {
56
+ }];
57
+ const accordion = [{
57
58
  id: 30,
58
59
  value: "accordion",
59
60
  type: "accordion",
@@ -67,17 +68,30 @@ function getListOptions(translation) {
67
68
  icon: "accordion"
68
69
  })
69
70
  }];
71
+ let options = [];
72
+ if (listType === "accordion-summary") {
73
+ options = [...accordion];
74
+ } else if (listType === "list-item") {
75
+ options = [...list];
76
+ } else {
77
+ options = [...list, ...accordion];
78
+ }
79
+ return options;
70
80
  }
71
81
  function SelectList({
72
82
  editor,
73
83
  classes,
74
84
  closeMainPopup,
75
- customProps
85
+ customProps,
86
+ commonProps
76
87
  }) {
77
88
  const {
78
89
  translation
79
90
  } = customProps;
80
- const listOptions = getListOptions(translation);
91
+ const {
92
+ listType
93
+ } = commonProps || {};
94
+ const listOptions = getListOptions(translation, listType);
81
95
  const selectedList = useMemo(() => {
82
96
  return listOptions.find(t => isBlockActive(editor, t.value));
83
97
  }, [listOptions, isBlockActive, editor]);
@@ -85,7 +99,11 @@ function SelectList({
85
99
  if (option.type === "block") {
86
100
  toggleBlock(editor, format);
87
101
  } else if (option.type === "accordion") {
88
- insertAccordion(editor);
102
+ if (listType === "accordion-summary") {
103
+ toggleAccordion(editor);
104
+ } else {
105
+ insertAccordion(editor);
106
+ }
89
107
  }
90
108
  closeMainPopup();
91
109
  };