@flozy/editor 9.8.4 → 9.8.5

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 (139) hide show
  1. package/dist/Editor/ChatEditor.js +18 -18
  2. package/dist/Editor/CommonEditor.js +18 -118
  3. package/dist/Editor/DialogWrapper.js +25 -31
  4. package/dist/Editor/Editor.css +7 -11
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +3 -11
  6. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  7. package/dist/Editor/Elements/Button/EditorButton.js +25 -37
  8. package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -60
  9. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  10. package/dist/Editor/Elements/Color Picker/ColorPicker.js +7 -10
  11. package/dist/Editor/Elements/Color Picker/Styles.js +13 -15
  12. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +2 -4
  13. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +6 -21
  14. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +1 -5
  15. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +2 -3
  16. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +0 -11
  17. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +4 -8
  18. package/dist/Editor/Elements/Embed/Image.js +2 -2
  19. package/dist/Editor/Elements/Embed/Video.js +1 -1
  20. package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -24
  21. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +21 -48
  22. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -25
  23. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +3 -46
  24. package/dist/Editor/Elements/FreeGrid/Options/More.js +2 -7
  25. package/dist/Editor/Elements/FreeGrid/styles.js +0 -3
  26. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  27. package/dist/Editor/Elements/List/CheckList.js +1 -4
  28. package/dist/Editor/Elements/Search/SearchButton.js +1 -1
  29. package/dist/Editor/Elements/Search/SearchList.js +2 -3
  30. package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +8 -2
  31. package/dist/Editor/Elements/SimpleText/index.js +1 -9
  32. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  33. package/dist/Editor/Elements/Table/Table.js +3 -3
  34. package/dist/Editor/Elements/Title/title.js +8 -9
  35. package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
  36. package/dist/Editor/MiniEditor.js +1 -2
  37. package/dist/Editor/Styles/EditorStyles.js +5 -5
  38. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
  39. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
  40. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  41. package/dist/Editor/Toolbar/FormatTools/TextSize.js +13 -10
  42. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +2 -4
  43. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +13 -6
  44. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +42 -167
  45. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -7
  46. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +1 -2
  47. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +11 -71
  48. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +23 -95
  49. package/dist/Editor/Toolbar/PopupTool/index.js +1 -1
  50. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  51. package/dist/Editor/common/ColorPickerButton.js +14 -39
  52. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  53. package/dist/Editor/common/FontLoader/FontLoader.js +0 -3
  54. package/dist/Editor/common/Icon.js +1 -31
  55. package/dist/Editor/common/ImageSelector/Styles.js +9 -3
  56. package/dist/Editor/common/MUIIcon/index.js +3 -0
  57. package/dist/Editor/common/RnD/ContextMenu/CMenus.js +0 -24
  58. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -2
  59. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
  60. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
  61. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
  62. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
  63. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +2 -4
  64. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +2 -3
  65. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
  66. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +1 -3
  67. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
  68. package/dist/Editor/common/RnD/ShadowElement.js +1 -2
  69. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -8
  70. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
  71. package/dist/Editor/common/RnD/Utils/gridDropItem.js +9 -73
  72. package/dist/Editor/common/RnD/Utils/index.js +0 -3
  73. package/dist/Editor/common/RnD/VirtualElement/index.js +103 -187
  74. package/dist/Editor/common/RnD/VirtualElement/styles.js +7 -155
  75. package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +3 -5
  76. package/dist/Editor/common/RnD/index.js +10 -59
  77. package/dist/Editor/common/Shorthands/elements.js +0 -54
  78. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  79. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
  80. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +2 -12
  81. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
  82. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +8 -16
  83. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +10 -35
  84. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +7 -16
  85. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +6 -7
  86. package/dist/Editor/common/StyleBuilder/fieldTypes/metaDataMapping.js +3 -3
  87. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -15
  88. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +7 -5
  89. package/dist/Editor/common/SwipeableDrawer/index.js +1 -1
  90. package/dist/Editor/common/Uploader.js +0 -8
  91. package/dist/Editor/commonStyle.js +57 -68
  92. package/dist/Editor/helper/theme.js +2 -202
  93. package/dist/Editor/hooks/useMouseMove.js +3 -9
  94. package/dist/Editor/plugins/withEmbeds.js +1 -1
  95. package/dist/Editor/plugins/withHTML.js +9 -11
  96. package/dist/Editor/plugins/withTable.js +1 -1
  97. package/dist/Editor/theme/ThemeList.js +173 -50
  98. package/dist/Editor/utils/SlateUtilityFunctions.js +45 -171
  99. package/dist/Editor/utils/draftToSlate.js +2 -3
  100. package/dist/Editor/utils/font.js +37 -40
  101. package/dist/Editor/utils/freegrid.js +2 -2
  102. package/dist/Editor/utils/helper.js +19 -90
  103. package/package.json +4 -4
  104. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +0 -448
  105. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -436
  106. package/dist/Editor/assets/svg/ClearAllRounded.js +0 -31
  107. package/dist/Editor/assets/svg/ResetIconNew.js +0 -23
  108. package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
  109. package/dist/Editor/common/CustomColorPicker/index.js +0 -131
  110. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  111. package/dist/Editor/common/CustomDialog2/index.js +0 -94
  112. package/dist/Editor/common/CustomDialog2/style.js +0 -67
  113. package/dist/Editor/common/CustomSelect.js +0 -43
  114. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
  115. package/dist/Editor/common/RnD/VirtualElement/BoxHeaderAutoAlignment.js +0 -43
  116. package/dist/Editor/common/RnD/VirtualElement/ForceAutoAlignment.js +0 -44
  117. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +0 -134
  118. package/dist/Editor/common/RnD/VirtualElement/helper.js +0 -382
  119. package/dist/Editor/common/SnackBar/index.js +0 -43
  120. package/dist/Editor/helper/textIndeces.js +0 -58
  121. package/dist/Editor/hooks/useAutoScroll.js +0 -38
  122. package/dist/Editor/hooks/useEditorTheme.js +0 -153
  123. package/dist/Editor/hooks/useThemeValues.js +0 -63
  124. package/dist/Editor/theme/index.js +0 -149
  125. package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
  126. package/dist/Editor/themeSettings/buttons/index.js +0 -290
  127. package/dist/Editor/themeSettings/buttons/style.js +0 -23
  128. package/dist/Editor/themeSettings/colorTheme/index.js +0 -310
  129. package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
  130. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
  131. package/dist/Editor/themeSettings/fonts/index.js +0 -240
  132. package/dist/Editor/themeSettings/fonts/style.js +0 -61
  133. package/dist/Editor/themeSettings/icons.js +0 -60
  134. package/dist/Editor/themeSettings/index.js +0 -351
  135. package/dist/Editor/themeSettings/style.js +0 -220
  136. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  137. package/dist/Editor/themeSettingsAI/index.js +0 -355
  138. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -205
  139. package/dist/Editor/themeSettingsAI/style.js +0 -259
@@ -133,7 +133,7 @@ const editorStyles = ({
133
133
  },
134
134
  "& .accordion-summary-collapse-btn": {
135
135
  padding: "4px",
136
- width: "5px"
136
+ width: '5px'
137
137
  },
138
138
  "& .workflow-icon-btn": {
139
139
  pointerEvents: "none",
@@ -242,7 +242,7 @@ const editorStyles = ({
242
242
  }
243
243
  },
244
244
  "& .section-tw": {
245
- background: "transparent !important",
245
+ background: 'transparent !important',
246
246
  "& button": {
247
247
  padding: "2px",
248
248
  borderRadius: "0px",
@@ -291,8 +291,8 @@ const editorStyles = ({
291
291
  }
292
292
  },
293
293
  "& ::selection": {
294
- background: "rgba(35, 131, 226, 0.35)!important",
295
- color: "inherit"
294
+ background: 'rgba(35, 131, 226, 0.35)!important',
295
+ color: 'inherit'
296
296
  },
297
297
  "&.readOnlyContainer": {
298
298
  "& .max-content": {
@@ -302,7 +302,7 @@ const editorStyles = ({
302
302
  },
303
303
  fullScreenWrapper: {
304
304
  "& .editor-wrapper": {
305
- paddingTop: "20px"
305
+ paddingTop: '20px'
306
306
  },
307
307
  "& .MuiDialog-paper, & .MuiPopover-paper": {
308
308
  background: `${theme?.palette?.editor?.background} !important`
@@ -1,32 +1,8 @@
1
1
  import React from "react";
2
2
  import { Select, MenuItem } from "@mui/material";
3
- import { addMarkData, activeMark, getSelectedElementStyle } from "../../utils/SlateUtilityFunctions.js";
4
- import { toolbarGroups } from "../toolbarGroups.js";
3
+ import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
5
4
  import KeyboardArrowDownRoundedIcon from "@mui/icons-material/KeyboardArrowDownRounded";
6
- import { googleFontList as defaultFonts } from "../../common/FontLoader/FontList.js";
7
5
  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
- };
30
6
  const Dropdown = ({
31
7
  classes,
32
8
  editor,
@@ -34,7 +10,7 @@ const Dropdown = ({
34
10
  options,
35
11
  width
36
12
  }) => {
37
- const value = activeMark(editor, format, true) || getValue(editor, format);
13
+ const value = activeMark(editor, format);
38
14
  const changeMarkData = (event, format) => {
39
15
  event.preventDefault();
40
16
  const value = event.target.value;
@@ -44,7 +20,7 @@ const Dropdown = ({
44
20
  });
45
21
  };
46
22
  return /*#__PURE__*/_jsx(Select, {
47
- value: value || options?.[0]?.value,
23
+ value: value,
48
24
  className: "editor-dd",
49
25
  onChange: e => changeMarkData(e, format),
50
26
  MenuProps: {
@@ -1,10 +1,9 @@
1
1
  import React from "react";
2
2
  import { Autocomplete, TextField } from "@mui/material";
3
- import { addMarkData } from "../../utils/SlateUtilityFunctions.js";
3
+ import { activeMark, 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";
7
- import { getValue } from "./Dropdown.js";
6
+ import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
8
7
  import { jsx as _jsx } from "react/jsx-runtime";
9
8
  const FontFamilyAutocomplete = ({
10
9
  editor,
@@ -15,7 +14,7 @@ const FontFamilyAutocomplete = ({
15
14
  val = "",
16
15
  webFont = false
17
16
  }) => {
18
- const markValue = getValue(editor, format);
17
+ const markValue = activeMark(editor, format);
19
18
  const value = !webFont ? markValue : val;
20
19
  const changeMarkData = (event, newValue, format) => {
21
20
  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, isMarkBtnActive } from "../../utils/SlateUtilityFunctions.js";
4
+ import { toggleMark, isMarkActive } 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: isMarkBtnActive(editor, format),
16
+ active: isMarkActive(editor, format),
17
17
  format: format,
18
18
  onMouseDown: e => {
19
19
  e.preventDefault();
@@ -1,7 +1,8 @@
1
1
  import React, { useEffect, useRef, useState } from "react";
2
2
  import { TextField, IconButton } from "@mui/material";
3
- import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
4
- import { getBreakPointsValue, getTextSizeVal } from "../../helper/theme.js";
3
+ import { addMarkData, activeMark, isBlockActive } from "../../utils/SlateUtilityFunctions.js";
4
+ import { headingMap, sizeMap } from "../../utils/font.js";
5
+ import { getBreakPointsValue } from "../../helper/theme.js";
5
6
  import useWindowResize from "../../hooks/useWindowResize.js";
6
7
  import { BREAKPOINTS_DEVICES } from "../../helper/theme.js";
7
8
  import { TextSizeDownArrow, TextSizeUpArrow } from "../../common/iconListV2.js";
@@ -14,15 +15,11 @@ const TextSize = ({
14
15
  format,
15
16
  fullWidth
16
17
  }) => {
17
- const [fontSize, setFontSize] = useState();
18
- const timerRef = useRef();
19
18
  const [size] = useWindowResize();
20
19
  const val = activeMark(editor, format);
21
-
22
- // const noFontSize =
23
- // val === "normal" || (typeof val === "object" && !Object.keys(val)?.length);
24
-
25
- const value = getTextSizeVal(editor);
20
+ const value = getBreakPointsValue(val, size?.device);
21
+ const [fontSize, setFontSize] = useState();
22
+ const timerRef = useRef();
26
23
  useEffect(() => {
27
24
  setFontSize(getSizeVal());
28
25
  }, [value]);
@@ -58,7 +55,13 @@ const TextSize = ({
58
55
  };
59
56
  const getSizeVal = () => {
60
57
  try {
61
- return parseInt(value);
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);
62
65
  } catch (err) {
63
66
  return "";
64
67
  }
@@ -12,8 +12,7 @@ function MiniColorPicker(props) {
12
12
  classes,
13
13
  id,
14
14
  editor,
15
- customProps,
16
- type
15
+ customProps
17
16
  } = props;
18
17
  const [openColorTool, setOpenColorTool] = useState(null);
19
18
  const {
@@ -39,8 +38,7 @@ function MiniColorPicker(props) {
39
38
  classes: classes,
40
39
  forMiniTool: true,
41
40
  openColorTool: openColorTool,
42
- closeColorTool: () => setOpenColorTool(null),
43
- type: type
41
+ closeColorTool: () => setOpenColorTool(null)
44
42
  }, id)]
45
43
  });
46
44
  }
@@ -1,9 +1,10 @@
1
1
  import { useEffect, useRef, useState } from "react";
2
- import { activeMark, addMarkData } from "../../../utils/SlateUtilityFunctions";
2
+ import { activeMark, addMarkData, isBlockActive } 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, getTextSizeVal } from "../../../helper/theme";
6
+ import { BREAKPOINTS_DEVICES, getBreakPointsValue } from "../../../helper/theme";
7
+ import { headingMap, sizeMap } from "../../../utils/font";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
10
  const fontSizeOptions = [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 26, 32, 36, 40, 48, 64, 96, 128];
@@ -18,7 +19,7 @@ function SelectFontSize({
18
19
  const containerRef = useRef();
19
20
  const [size] = useWindowResize();
20
21
  const val = activeMark(editor, format);
21
- const value = getTextSizeVal(editor);
22
+ const value = getBreakPointsValue(val, size?.device);
22
23
  const timerRef = useRef();
23
24
  const updateMarkData = newVal => {
24
25
  let upData = {
@@ -52,7 +53,13 @@ function SelectFontSize({
52
53
  };
53
54
  const getSizeVal = () => {
54
55
  try {
55
- return parseInt(value);
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);
56
63
  } catch (err) {
57
64
  return "";
58
65
  }
@@ -90,8 +97,8 @@ function SelectFontSize({
90
97
  anchorEl: anchorEl,
91
98
  onClose: () => setAnchorEl(null),
92
99
  anchorOrigin: {
93
- vertical: "bottom",
94
- horizontal: "left"
100
+ vertical: 'bottom',
101
+ horizontal: 'left'
95
102
  },
96
103
  sx: classes.customSelectPopoverWrapper,
97
104
  children: fontSizeOptions.map((s, i) => {
@@ -2,11 +2,8 @@ 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, isTextCustomized as isCustomized, textThemeFields as themeFields } from "../../../helper/theme";
5
+ import { BREAKPOINTS_DEVICES, getBreakPointsValue } 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";
10
7
  import { jsx as _jsx } from "react/jsx-runtime";
11
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
9
  function Label({
@@ -21,29 +18,26 @@ function Label({
21
18
  });
22
19
  }
23
20
  function DisplayHeaderLabel({
24
- type,
25
- isCustomized,
26
- isPara = false
21
+ type
27
22
  }) {
28
23
  return /*#__PURE__*/_jsxs("div", {
29
- children: [isCustomized ? "*" : "", isPara ? "P" : "H", /*#__PURE__*/_jsx("sub", {
24
+ children: ["H", /*#__PURE__*/_jsx("sub", {
30
25
  children: type
31
26
  })]
32
27
  });
33
28
  }
34
- function getTypographyOptions(isCustomized, translation) {
35
- const typographyOptions = [{
29
+ function getTypographyOptions(translation) {
30
+ return [{
36
31
  id: 11,
37
32
  format: "headingOne",
38
33
  type: "block",
39
34
  title: /*#__PURE__*/_jsx(Label, {
40
35
  label: "H1",
41
- type: "Heading",
36
+ type: "Header",
42
37
  translation: translation
43
38
  }),
44
39
  label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
45
- type: 1,
46
- isCustomized: isCustomized
40
+ type: 1
47
41
  }),
48
42
  group: "typography",
49
43
  value: "headingOne"
@@ -53,12 +47,11 @@ function getTypographyOptions(isCustomized, translation) {
53
47
  type: "block",
54
48
  title: /*#__PURE__*/_jsx(Label, {
55
49
  label: "H2",
56
- type: "Heading",
50
+ type: "Header",
57
51
  translation: translation
58
52
  }),
59
53
  label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
60
- type: 2,
61
- isCustomized: isCustomized
54
+ type: 2
62
55
  }),
63
56
  group: "typography",
64
57
  value: "headingTwo"
@@ -68,156 +61,63 @@ function getTypographyOptions(isCustomized, translation) {
68
61
  type: "block",
69
62
  title: /*#__PURE__*/_jsx(Label, {
70
63
  label: "H3",
71
- type: "Heading",
64
+ type: "Header",
72
65
  translation: translation
73
66
  }),
74
67
  label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
75
- type: 3,
76
- isCustomized: isCustomized
68
+ type: 3
77
69
  }),
78
70
  group: "typography",
79
71
  value: "headingThree"
80
72
  }, {
81
- id: 17,
82
- format: "headingFour",
83
- type: "block",
73
+ id: 14,
74
+ format: "fontSize",
75
+ type: "mark",
84
76
  title: /*#__PURE__*/_jsx(Label, {
85
- label: "H4",
86
- type: "Heading",
77
+ label: "L",
78
+ type: "Large",
87
79
  translation: translation
88
80
  }),
89
- label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
90
- type: 4,
91
- isCustomized: isCustomized
92
- }),
81
+ label: "L",
93
82
  group: "typography",
94
- value: "headingFour"
83
+ value: "huge"
95
84
  }, {
96
- id: 18,
97
- format: "headingFive",
98
- type: "block",
85
+ id: 15,
86
+ format: "fontSize",
87
+ type: "mark",
99
88
  title: /*#__PURE__*/_jsx(Label, {
100
- label: "H5",
101
- type: "Heading",
89
+ label: "M",
90
+ type: "Medium",
102
91
  translation: translation
103
92
  }),
104
- label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
105
- type: 5,
106
- isCustomized: isCustomized
107
- }),
93
+ label: "M",
108
94
  group: "typography",
109
- value: "headingFive"
95
+ value: "medium"
110
96
  }, {
111
- id: 19,
112
- format: "headingSix",
113
- type: "block",
97
+ id: 16,
98
+ format: "fontSize",
99
+ type: "mark",
114
100
  title: /*#__PURE__*/_jsx(Label, {
115
- label: "H6",
116
- type: "Heading",
101
+ label: "S",
102
+ type: "Small",
117
103
  translation: translation
118
104
  }),
119
- label: /*#__PURE__*/_jsx(DisplayHeaderLabel, {
120
- type: 6,
121
- isCustomized: isCustomized
122
- }),
105
+ label: "S",
123
106
  group: "typography",
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;
107
+ value: "small"
108
+ }];
204
109
  }
205
110
  function SelectTypography({
206
111
  editor,
207
112
  classes,
208
113
  closeMainPopup,
209
- type,
210
114
  customProps
211
115
  }) {
212
116
  const [size] = useWindowResize();
213
- const {
214
- theme
215
- } = useEditorTheme();
216
117
  const {
217
118
  translation
218
119
  } = customProps;
219
- const isTextCustomized = theme?.id ? isCustomized(editor) : false;
220
- const typographyOptions = getTypographyOptions(isTextCustomized, translation);
120
+ const typographyOptions = getTypographyOptions(translation);
221
121
  const updateMarkData = newVal => {
222
122
  const val = activeMark(editor, "fontSize");
223
123
  let upData = {
@@ -239,10 +139,7 @@ function SelectTypography({
239
139
  ...upData
240
140
  }
241
141
  });
242
-
243
- // closeMainPopup();
244
142
  };
245
-
246
143
  const selectedBlock = useMemo(() => {
247
144
  return typographyOptions.find(t => {
248
145
  if (t.type === "block") {
@@ -264,13 +161,15 @@ function SelectTypography({
264
161
  });
265
162
  }, [typographyOptions, activeMark, isBlockActive, editor]);
266
163
  const onChange = (format, option) => {
164
+ // add/reset block elements
165
+ toggleBlock(editor, format);
267
166
  if (option.type === "block") {
268
- themeFields.forEach(field => {
269
- Editor.removeMark(editor, field);
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: {}
270
172
  });
271
-
272
- // add/reset block elements
273
- toggleBlock(editor, format);
274
173
  } else if (option.type === "mark") {
275
174
  const size = sizeMap[option.value] || "";
276
175
  const [sizeInNumber] = size.split("px");
@@ -278,35 +177,11 @@ function SelectTypography({
278
177
  }
279
178
  closeMainPopup();
280
179
  };
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
- }
305
180
  return /*#__PURE__*/_jsx(CustomSelectTool, {
306
181
  options: typographyOptions,
307
182
  editor: editor,
308
183
  onChange: onChange,
309
- value: typographyValue,
184
+ value: selectedBlock?.value || "headingOne",
310
185
  classes: classes
311
186
  });
312
187
  }
@@ -1,4 +1,4 @@
1
- import { Fade, Grid, IconButton, Paper, Popper, useTheme } from "@mui/material";
1
+ import { Fade, Grid, IconButton, Paper, Popper } 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 { getSelectedElementColor, viewSlateSelection } from "../../../utils/helper";
17
+ import { 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,12 +35,11 @@ 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();
39
38
  const removeFontStyles = ["superscript", "subscript"];
40
39
  const fontStyle = allTools.filter(f => f.type === "mark" && !removeFontStyles.includes(f.format));
41
40
  const link = allTools.find(f => f.format?.indexOf("link") >= 0);
42
41
  const fontAlign = allTools.filter(f => f.format?.indexOf("align") >= 0);
43
- const activeColor = getSelectedElementColor(editor, textColorFormat, theme);
42
+ const activeColor = activeMark(editor, textColorFormat) || DEFAULT_COLOR[textColorFormat];
44
43
  const activeBg = activeMark(editor, textBgFormat) || DEFAULT_COLOR[textBgFormat];
45
44
  return /*#__PURE__*/_jsx(Grid, {
46
45
  container: true,
@@ -58,7 +57,6 @@ const MiniTextFormat = props => {
58
57
  classes: classes,
59
58
  editor: editor,
60
59
  closeMainPopup: closeMainPopup,
61
- type: "miniToolBar",
62
60
  customProps: customProps
63
61
  }), /*#__PURE__*/_jsx("div", {
64
62
  className: "verticalLine"
@@ -94,8 +92,7 @@ const MiniTextFormat = props => {
94
92
  activeColor: activeColor,
95
93
  id: "11_cc",
96
94
  editor: editor,
97
- customProps: customProps,
98
- type: "textColor"
95
+ customProps: customProps
99
96
  }), /*#__PURE__*/_jsx(MiniColorPicker, {
100
97
  format: textBgFormat,
101
98
  classes: classes,
@@ -50,8 +50,7 @@ const PopperHeader = props => {
50
50
  padding: 2,
51
51
  className: "headerContainer",
52
52
  style: {
53
- paddingTop: "5px",
54
- paddingBottom: "0px"
53
+ paddingTop: "5px"
55
54
  },
56
55
  children: /*#__PURE__*/_jsxs(Grid, {
57
56
  item: true,