@flozy/editor 9.9.6 → 9.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/Editor/ChatEditor.js +16 -17
  2. package/dist/Editor/CommonEditor.js +16 -116
  3. package/dist/Editor/DialogWrapper.js +25 -31
  4. package/dist/Editor/Editor.css +8 -16
  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 +9 -25
  8. package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -61
  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/Video.js +1 -1
  19. package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -24
  20. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +14 -0
  21. package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
  22. package/dist/Editor/Elements/FreeGrid/styles.js +0 -6
  23. package/dist/Editor/Elements/Grid/GridItem.js +1 -1
  24. package/dist/Editor/Elements/List/CheckList.js +1 -4
  25. package/dist/Editor/Elements/Search/SearchAttachment.js +9 -40
  26. package/dist/Editor/Elements/Search/SearchButton.js +8 -9
  27. package/dist/Editor/Elements/Search/SearchList.js +7 -9
  28. package/dist/Editor/Elements/SimpleText/index.js +1 -6
  29. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  30. package/dist/Editor/Elements/Table/Table.js +3 -3
  31. package/dist/Editor/Elements/Title/title.js +6 -6
  32. package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
  33. package/dist/Editor/MiniEditor.js +1 -2
  34. package/dist/Editor/Styles/EditorStyles.js +5 -5
  35. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
  36. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
  37. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  38. package/dist/Editor/Toolbar/FormatTools/TextSize.js +13 -10
  39. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -2
  40. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +2 -4
  41. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +13 -6
  42. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +42 -167
  43. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -7
  44. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +1 -2
  45. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +12 -72
  46. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +27 -100
  47. package/dist/Editor/Toolbar/PopupTool/index.js +1 -1
  48. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  49. package/dist/Editor/common/ColorPickerButton.js +16 -38
  50. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  51. package/dist/Editor/common/FontLoader/FontLoader.js +0 -3
  52. package/dist/Editor/common/Icon.js +1 -31
  53. package/dist/Editor/common/ImageSelector/Styles.js +9 -3
  54. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -2
  55. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
  56. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
  57. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
  58. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
  59. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +2 -4
  60. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +2 -3
  61. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
  62. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +1 -3
  63. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
  64. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +5 -8
  65. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
  66. package/dist/Editor/common/RnD/Utils/gridDropItem.js +2 -1
  67. package/dist/Editor/common/Shorthands/elements.js +0 -54
  68. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  69. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
  70. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +2 -12
  71. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
  72. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +8 -16
  73. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +10 -36
  74. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +7 -16
  75. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +6 -7
  76. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -15
  77. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +7 -5
  78. package/dist/Editor/common/Uploader.js +0 -8
  79. package/dist/Editor/common/iconslist.js +0 -21
  80. package/dist/Editor/commonStyle.js +61 -96
  81. package/dist/Editor/helper/theme.js +2 -203
  82. package/dist/Editor/hooks/useMouseMove.js +5 -8
  83. package/dist/Editor/plugins/withEmbeds.js +1 -1
  84. package/dist/Editor/plugins/withHTML.js +1 -3
  85. package/dist/Editor/plugins/withTable.js +1 -1
  86. package/dist/Editor/theme/ThemeList.js +173 -50
  87. package/dist/Editor/utils/SlateUtilityFunctions.js +43 -166
  88. package/dist/Editor/utils/button.js +17 -1
  89. package/dist/Editor/utils/draftToSlate.js +2 -3
  90. package/dist/Editor/utils/font.js +37 -40
  91. package/dist/Editor/utils/helper.js +19 -90
  92. package/package.json +4 -4
  93. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +0 -454
  94. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -439
  95. package/dist/Editor/assets/svg/BackIcon.js +0 -18
  96. package/dist/Editor/assets/svg/ClearAllRounded.js +0 -31
  97. package/dist/Editor/assets/svg/ResetIconNew.js +0 -23
  98. package/dist/Editor/assets/svg/ThemeIcons.js +0 -293
  99. package/dist/Editor/common/CustomColorPicker/index.js +0 -131
  100. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  101. package/dist/Editor/common/CustomDialog2/index.js +0 -94
  102. package/dist/Editor/common/CustomDialog2/style.js +0 -67
  103. package/dist/Editor/common/CustomSelect.js +0 -43
  104. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
  105. package/dist/Editor/common/SnackBar/index.js +0 -43
  106. package/dist/Editor/helper/textIndeces.js +0 -58
  107. package/dist/Editor/hooks/useEditorTheme.js +0 -153
  108. package/dist/Editor/hooks/useThemeValues.js +0 -63
  109. package/dist/Editor/theme/index.js +0 -149
  110. package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
  111. package/dist/Editor/themeSettings/buttons/index.js +0 -290
  112. package/dist/Editor/themeSettings/buttons/style.js +0 -23
  113. package/dist/Editor/themeSettings/colorTheme/index.js +0 -309
  114. package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
  115. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
  116. package/dist/Editor/themeSettings/fonts/index.js +0 -240
  117. package/dist/Editor/themeSettings/fonts/style.js +0 -62
  118. package/dist/Editor/themeSettings/icons.js +0 -60
  119. package/dist/Editor/themeSettings/index.js +0 -361
  120. package/dist/Editor/themeSettings/style.js +0 -292
  121. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  122. package/dist/Editor/themeSettingsAI/index.js +0 -355
  123. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -202
  124. package/dist/Editor/themeSettingsAI/style.js +0 -324
@@ -1,10 +1,5 @@
1
- import React, { useEffect, useState } from "react";
2
- import Box from "@mui/material/Box";
3
- import Card from "@mui/material/Card";
4
- import CardMedia from "@mui/material/CardMedia";
5
- import CardContent from "@mui/material/CardContent";
6
- import Typography from "@mui/material/Typography";
7
- import Skeleton from "@mui/material/Skeleton";
1
+ import React from "react";
2
+ import { Box, Card, CardMedia, CardContent, Typography } from "@mui/material";
8
3
  import Icon from "../../common/Icon";
9
4
  import { useEditorContext } from "../../hooks/useMouseMove";
10
5
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -20,26 +15,13 @@ const SearchAttachment = props => {
20
15
  metadata
21
16
  } = customProps;
22
17
  const {
23
- type,
24
- id
18
+ title,
19
+ type
25
20
  } = element;
26
21
  const {
27
22
  theme
28
23
  } = useEditorContext();
29
- const [title, setTitle] = useState("");
30
- const [showSkeleton, setShowSkeleton] = useState(false);
31
24
  const label = Boolean(title?.trim()) ? title : 'Untitled';
32
- useEffect(() => {
33
- const fetchTitle = async id => {
34
- setShowSkeleton(true);
35
- const title = await customProps?.services('getDocTitle', id);
36
- setTitle(title?.data);
37
- setShowSkeleton(false);
38
- };
39
- if (id) {
40
- fetchTitle(id);
41
- }
42
- }, []);
43
25
  const handleClick = () => {
44
26
  if (metadata && metadata?.actionHandler) {
45
27
  metadata?.actionHandler(type, element);
@@ -56,15 +38,15 @@ const SearchAttachment = props => {
56
38
  children: /*#__PURE__*/_jsxs(Card, {
57
39
  sx: {
58
40
  display: "flex",
59
- justifyContent: showSkeleton ? "center" : "flex-start",
60
- alignItems: showSkeleton ? "center" : "flex-end",
41
+ justifyContent: "flex-start",
42
+ alignItems: "flex-end",
61
43
  width: "fit-content",
62
44
  maxWidth: '250px',
63
45
  padding: "0px 10px",
64
46
  boxShadow: "none",
65
47
  border: `1px solid ${theme?.palette?.primary?.slashBrainBorder} !important`,
66
48
  borderRadius: "7px !important",
67
- background: showSkeleton ? `${theme?.palette?.editor?.menuOptionHoverBackground} !important` : `${theme?.palette?.containers?.slashBrainCardBg} !important`,
49
+ background: `${theme?.palette?.containers?.slashBrainCardBg} !important`,
68
50
  cursor: 'pointer',
69
51
  margin: '4px 0px',
70
52
  lineHeight: 1.43,
@@ -94,12 +76,7 @@ const SearchAttachment = props => {
94
76
  width: "unset !important"
95
77
  }
96
78
  },
97
- children: showSkeleton ? /*#__PURE__*/_jsx(Skeleton, {
98
- variant: "circular",
99
- width: 14,
100
- height: 14,
101
- animation: "wave"
102
- }) : /*#__PURE__*/_jsx(Icon, {
79
+ children: /*#__PURE__*/_jsx(Icon, {
103
80
  icon: "docsIcon"
104
81
  })
105
82
  }), /*#__PURE__*/_jsx(CardContent, {
@@ -117,15 +94,7 @@ const SearchAttachment = props => {
117
94
  width: "unset !important"
118
95
  }
119
96
  },
120
- children: showSkeleton ? /*#__PURE__*/_jsx(Skeleton, {
121
- variant: "text",
122
- width: 140,
123
- height: 20,
124
- animation: "wave",
125
- sx: {
126
- borderRadius: "4px"
127
- }
128
- }) : /*#__PURE__*/_jsxs(Typography, {
97
+ children: /*#__PURE__*/_jsxs(Typography, {
129
98
  sx: {
130
99
  fontWeight: "500",
131
100
  background: theme?.palette?.text?.slashBrainText,
@@ -30,7 +30,6 @@ const SearchButton = /*#__PURE__*/forwardRef((props, ref) => {
30
30
  const [skip, setSkip] = useState(0);
31
31
  const [search, setSearch] = useState("");
32
32
  const [isLoading, setIsLoading] = useState(false);
33
- const [total, setTotal] = useState(0);
34
33
  const [debouncedSearch] = useDebounce(search, 300);
35
34
  const limit = 20;
36
35
  const observer = useRef();
@@ -64,24 +63,24 @@ const SearchButton = /*#__PURE__*/forwardRef((props, ref) => {
64
63
  }
65
64
  };
66
65
  useEffect(() => {
67
- getDocs();
66
+ getDocs({
67
+ debouncedSearch,
68
+ skip,
69
+ limit,
70
+ current_doc_id: currentId
71
+ });
68
72
  }, [skip, debouncedSearch]);
69
73
  const getDocs = async () => {
70
- if (isLoading) return;
71
- if (total > 0 && mapData?.length >= total) return;
72
74
  setIsLoading(true);
73
75
  try {
74
76
  if (otherProps?.services) {
75
77
  const result = await otherProps?.services("getDocs", {
76
78
  skip,
77
79
  limit,
78
- search: debouncedSearch,
80
+ search,
79
81
  current_doc_id: currentId
80
82
  });
81
- const docs = result?.data?.docs || [];
82
- const totalCount = result?.data?.total || 0;
83
- setMapData(prev => skip === 0 ? docs : [...prev, ...docs]);
84
- setTotal(totalCount);
83
+ setMapData(prev => skip === 0 ? result.data : [...prev, ...result.data]);
85
84
  }
86
85
  } catch (error) {
87
86
  console.error("Error fetching documents:", error);
@@ -259,7 +259,7 @@ const SearchAndDocList = ({
259
259
  xs: 12,
260
260
  children: /*#__PURE__*/_jsx(Typography, {
261
261
  sx: {
262
- display: mapData?.length === 0 && !isLoading ? 'flex' : 'none',
262
+ display: mapData?.length === 0 ? 'flex' : 'none',
263
263
  alignItems: "center",
264
264
  justifyContent: "center",
265
265
  color: theme?.palette?.text?.secondary,
@@ -269,17 +269,15 @@ const SearchAndDocList = ({
269
269
  },
270
270
  children: "No docs"
271
271
  })
272
- }), /*#__PURE__*/_jsx(Grid, {
272
+ }), isLoading && /*#__PURE__*/_jsx(Grid, {
273
273
  item: true,
274
- xs: 12,
275
274
  sx: {
276
- display: isLoading ? 'flex' : 'none',
277
- alignItems: "center",
275
+ display: "flex",
278
276
  justifyContent: "center",
279
- color: theme?.palette?.text?.secondary,
280
- fontSize: '12px',
281
- padding: '20px',
282
- fontWeight: 700
277
+ alignItems: 'center',
278
+ minHeight: '400px',
279
+ padding: '0px 16px 8px',
280
+ position: 'absolute'
283
281
  },
284
282
  children: /*#__PURE__*/_jsx(CircularProgress, {})
285
283
  })]
@@ -5,7 +5,6 @@ import { Box } from "@mui/material";
5
5
  import { isTextSelected } from "../../utils/helper";
6
6
  import { useEditorContext } from "../../hooks/useMouseMove";
7
7
  import SimpleTextStyle from "./style";
8
- import { getBreakpointLineSpacing, getDevice } from "../../helper/theme";
9
8
  import { jsx as _jsx } from "react/jsx-runtime";
10
9
  import { Fragment as _Fragment } from "react/jsx-runtime";
11
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -30,12 +29,8 @@ const SimpleText = props => {
30
29
  } = customProps;
31
30
  // const { element: pageSt } = getPageSettings(editor) || {};
32
31
  // const { pageColor } = pageSt?.pageProps || {};
33
- const breakpoint = getDevice(window.innerWidth);
34
- const lineH = element?.children[0]?.lineHeight;
35
- const lineHeight = getBreakpointLineSpacing(lineH, breakpoint);
36
32
  const classes = SimpleTextStyle({
37
- pageColor: "#FFFFFF",
38
- lineHeight
33
+ pageColor: "#FFFFFF"
39
34
  });
40
35
  const selected = useSelected();
41
36
  const path = ReactEditor.findPath(editor, element);
@@ -35,8 +35,8 @@ const SimpleTextStyle = ({
35
35
  height: "24px",
36
36
  overflow: "hidden",
37
37
  fontSize: "14px",
38
- display: "inline-flex",
39
- alignItems: "center",
38
+ display: 'inline-flex',
39
+ alignItems: 'center',
40
40
  "& .bg-pad-sl": {
41
41
  padding: "2px 4px 2px 4px",
42
42
  background: "transparent",
@@ -307,7 +307,7 @@ const Table = props => {
307
307
  onScroll: handleScroll,
308
308
  onMouseOver: onMouseOver,
309
309
  onMouseLeave: onMouseLeave,
310
- className: "custom-scroll",
310
+ className: !hideTools.includes("add_column") ? "custom-scroll" : '',
311
311
  children: [/*#__PURE__*/_jsx(TableComp, {
312
312
  className: readOnly ? "readOnly" : "",
313
313
  sx: {
@@ -345,8 +345,8 @@ const Table = props => {
345
345
  handleAction: handleAction,
346
346
  exandTools: exandTools,
347
347
  openSetttings: openSetttings,
348
- hideTools: hideTools,
349
- translation: translation
348
+ translation: translation,
349
+ hideTools: hideTools
350
350
  }), /*#__PURE__*/_jsx(MoreTableSettings, {
351
351
  exandTools: exandTools,
352
352
  handleAction: handleAction,
@@ -4,12 +4,6 @@ import { useSlate } from "slate-react";
4
4
  import { getNodeText } from "../../utils/helper";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
- const isEmptyTextNode = node => {
8
- if (Text.isText(node)) {
9
- return !node.text.trim();
10
- }
11
- return false;
12
- };
13
7
  const Title = props => {
14
8
  const {
15
9
  attributes,
@@ -56,4 +50,10 @@ const useDetectExitFromTitle = (titleNode, onSaveTitle) => {
56
50
  }
57
51
  }, [editor.selection]);
58
52
  return null;
53
+ };
54
+ const isEmptyTextNode = node => {
55
+ if (Text.isText(node)) {
56
+ return !node.text.trim();
57
+ }
58
+ return false;
59
59
  };
@@ -34,8 +34,7 @@ const VariableButton = props => {
34
34
  PaperProps: {
35
35
  style: {
36
36
  maxHeight: 300,
37
- overflowY: "auto",
38
- transformOrigin: 'top left'
37
+ overflowY: "auto"
39
38
  },
40
39
  sx: {
41
40
  "&::-webkit-scrollbar-track": {
@@ -45,14 +44,6 @@ const VariableButton = props => {
45
44
  borderRadius: "16px"
46
45
  }
47
46
  }
48
- },
49
- anchorOrigin: {
50
- vertical: 'bottom',
51
- horizontal: 'right'
52
- },
53
- transformOrigin: {
54
- vertical: 'top',
55
- horizontal: 'right'
56
47
  }
57
48
  },
58
49
  children: [/*#__PURE__*/_jsx(MenuItem, {
@@ -45,13 +45,12 @@ const MiniEditor = props => {
45
45
  const {
46
46
  translationMock
47
47
  } = otherProps;
48
- const dummyTranslation = () => {};
49
48
  const customProps = {
50
49
  ...(otherProps || {}),
51
50
  readOnly: isReadOnly,
52
51
  editorPlaceholder: miniEditorPlaceholder,
53
52
  page_id: id,
54
- translation: translation || translationMock || dummyTranslation
53
+ translation: translation || translationMock
55
54
  };
56
55
  const [mentions, setMentions] = useMentions({
57
56
  editor,
@@ -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
  }
@@ -215,8 +215,7 @@ const MiniToolbar = props => {
215
215
  setPopper: setPopper,
216
216
  onClose: onClose,
217
217
  search: search,
218
- onSearch: onSearch,
219
- closeMainPopup: onClose
218
+ onSearch: onSearch
220
219
  })]
221
220
  }) : null
222
221
  })]
@@ -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) => {