@flozy/editor 3.9.1 → 3.9.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 (127) hide show
  1. package/dist/Editor/ChatEditor.js +45 -55
  2. package/dist/Editor/CommonEditor.js +111 -180
  3. package/dist/Editor/Editor.css +0 -7
  4. package/dist/Editor/Elements/AI/AIInput.js +18 -17
  5. package/dist/Editor/Elements/AI/CustomSelect.js +12 -19
  6. package/dist/Editor/Elements/AI/PopoverAIInput.js +28 -23
  7. package/dist/Editor/Elements/AI/Styles.js +1 -2
  8. package/dist/Editor/Elements/Accordion/Accordion.js +7 -74
  9. package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +2 -3
  10. package/dist/Editor/Elements/Accordion/AccordionSummary.js +60 -4
  11. package/dist/Editor/Elements/AppHeader/AppHeader.js +4 -26
  12. package/dist/Editor/Elements/Button/EditorButton.js +16 -28
  13. package/dist/Editor/Elements/Color Picker/ColorButtons.js +17 -60
  14. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  15. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  16. package/dist/Editor/Elements/Color Picker/Styles.js +1 -2
  17. package/dist/Editor/Elements/Embed/Image.js +19 -27
  18. package/dist/Editor/Elements/Embed/Video.js +10 -14
  19. package/dist/Editor/Elements/Emoji/EmojiPicker.js +2 -4
  20. package/dist/Editor/Elements/Form/Form.js +1 -1
  21. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
  22. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -2
  23. package/dist/Editor/Elements/Grid/Grid.js +3 -27
  24. package/dist/Editor/Elements/Grid/GridItem.js +1 -3
  25. package/dist/Editor/Elements/Link/Link.js +1 -6
  26. package/dist/Editor/Elements/Link/LinkButton.js +2 -4
  27. package/dist/Editor/Elements/Link/LinkPopup.js +3 -10
  28. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +4 -8
  29. package/dist/Editor/Elements/Signature/SignaturePopup.js +3 -14
  30. package/dist/Editor/Elements/Table/Styles.js +1 -23
  31. package/dist/Editor/Elements/Table/Table.js +2 -3
  32. package/dist/Editor/Elements/Table/TableCell.js +8 -70
  33. package/dist/Editor/Elements/TableContextMenu/TableContextMenu.js +0 -1
  34. package/dist/Editor/MiniEditor.js +1 -3
  35. package/dist/Editor/Styles/EditorStyles.js +1 -1
  36. package/dist/Editor/Toolbar/Basic/index.js +2 -4
  37. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +2 -26
  38. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  39. package/dist/Editor/Toolbar/FormatTools/TextSize.js +18 -29
  40. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +3 -29
  41. package/dist/Editor/Toolbar/Mini/Options/Options.js +0 -10
  42. package/dist/Editor/Toolbar/Mini/Styles.js +0 -7
  43. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +11 -4
  44. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +86 -213
  45. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +1 -2
  46. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +16 -22
  47. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +7 -52
  48. package/dist/Editor/Toolbar/PopupTool/index.js +17 -7
  49. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  50. package/dist/Editor/assets/svg/AIIcons.js +1 -153
  51. package/dist/Editor/assets/svg/AddTemplateIcon.js +10 -13
  52. package/dist/Editor/assets/svg/TextIcon.js +5 -8
  53. package/dist/Editor/common/ColorPickerButton.js +9 -25
  54. package/dist/Editor/common/DnD/DragHandleButton.js +47 -56
  55. package/dist/Editor/common/Icon.js +3 -43
  56. package/dist/Editor/common/LinkSettings/NavComponents.js +2 -5
  57. package/dist/Editor/common/LinkSettings/index.js +2 -4
  58. package/dist/Editor/common/LinkSettings/navOptions.js +2 -7
  59. package/dist/Editor/common/LinkSettings/style.js +8 -11
  60. package/dist/Editor/common/MentionsPopup/MentionsListCard.js +1 -6
  61. package/dist/Editor/common/MentionsPopup/Styles.js +2 -5
  62. package/dist/Editor/common/Section/index.js +7 -57
  63. package/dist/Editor/common/Section/styles.js +0 -11
  64. package/dist/Editor/common/Shorthands/elements.js +0 -54
  65. package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +7 -7
  66. package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +16 -16
  67. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  68. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +3 -13
  69. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
  70. package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
  71. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +7 -31
  72. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
  73. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +3 -14
  74. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +4 -14
  75. package/dist/Editor/common/StyleBuilder/index.js +1 -1
  76. package/dist/Editor/common/iconslist.js +31 -0
  77. package/dist/Editor/helper/deserialize/index.js +9 -14
  78. package/dist/Editor/helper/theme.js +4 -190
  79. package/dist/Editor/hooks/useMouseMove.js +2 -4
  80. package/dist/Editor/hooks/useWindowMessage.js +7 -10
  81. package/dist/Editor/plugins/withEmbeds.js +1 -1
  82. package/dist/Editor/plugins/withHTML.js +5 -47
  83. package/dist/Editor/plugins/withLayout.js +10 -15
  84. package/dist/Editor/plugins/withTable.js +2 -2
  85. package/dist/Editor/theme/ThemeList.js +173 -50
  86. package/dist/Editor/utils/SlateUtilityFunctions.js +25 -161
  87. package/dist/Editor/utils/button.js +17 -1
  88. package/dist/Editor/utils/draftToSlate.js +1 -1
  89. package/dist/Editor/utils/events.js +6 -65
  90. package/dist/Editor/utils/font.js +37 -40
  91. package/dist/Editor/utils/helper.js +14 -74
  92. package/dist/Editor/utils/table.js +43 -51
  93. package/package.json +3 -4
  94. package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +0 -73
  95. package/dist/Editor/Elements/AI/VoiceToText/index.js +0 -177
  96. package/dist/Editor/Elements/AI/VoiceToText/style.js +0 -40
  97. package/dist/Editor/Elements/Link/LinkPopupStyles.js +0 -28
  98. package/dist/Editor/Elements/Redo/RedoButton.js +0 -14
  99. package/dist/Editor/Elements/Undo/UndoButton.js +0 -14
  100. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
  101. package/dist/Editor/assets/svg/RedoIcon.js +0 -27
  102. package/dist/Editor/assets/svg/SettingsIcon.js +0 -28
  103. package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
  104. package/dist/Editor/assets/svg/UndoIcon.js +0 -27
  105. package/dist/Editor/common/CustomColorPicker/index.js +0 -106
  106. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  107. package/dist/Editor/common/CustomDialog/index.js +0 -94
  108. package/dist/Editor/common/CustomDialog/style.js +0 -67
  109. package/dist/Editor/common/CustomSelect.js +0 -33
  110. package/dist/Editor/common/EditorCmds.js +0 -35
  111. package/dist/Editor/hooks/useEditorTheme.js +0 -139
  112. package/dist/Editor/theme/index.js +0 -144
  113. package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
  114. package/dist/Editor/themeSettings/buttons/index.js +0 -290
  115. package/dist/Editor/themeSettings/buttons/style.js +0 -21
  116. package/dist/Editor/themeSettings/colorTheme/index.js +0 -290
  117. package/dist/Editor/themeSettings/colorTheme/style.js +0 -77
  118. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -123
  119. package/dist/Editor/themeSettings/fonts/index.js +0 -213
  120. package/dist/Editor/themeSettings/fonts/style.js +0 -44
  121. package/dist/Editor/themeSettings/icons.js +0 -60
  122. package/dist/Editor/themeSettings/index.js +0 -320
  123. package/dist/Editor/themeSettings/style.js +0 -152
  124. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  125. package/dist/Editor/themeSettingsAI/index.js +0 -356
  126. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -190
  127. package/dist/Editor/themeSettingsAI/style.js +0 -247
@@ -1,4 +1,4 @@
1
- const TableStyles = themeType => ({
1
+ const TableStyles = () => ({
2
2
  tableToolBar: {
3
3
  position: "absolute",
4
4
  top: "-34px",
@@ -61,28 +61,6 @@ const TableStyles = themeType => ({
61
61
  "&:hover": {
62
62
  background: "#ccc"
63
63
  }
64
- },
65
- deleteCellsPopUp: {
66
- backgroundColor: themeType === "dark" ? "#292C32" : "#FFFFFF",
67
- borderRadius: "7px !important",
68
- border: themeType === "dark" ? "1px solid #5B5E64" : "1px solid #E4E8EB",
69
- zIndex: 100,
70
- minWidth: "186px !important"
71
- },
72
- menuItemPopUp: {
73
- padding: "5px 7px !important",
74
- margin: "6px !important",
75
- borderRadius: 1,
76
- userSelect: "none",
77
- color: themeType === "dark" ? "#2563EB" : "#0F172A",
78
- "&:hover": {
79
- // backgroundColor: "rgba(0, 123, 255, 0.1)",
80
- backgroundColor: themeType === "dark" ? "#2563EB" : "#E9F3FE"
81
- },
82
- "&.Mui-selected": {
83
- backgroundColor: themeType === "dark" ? "#2563EB" : "#E9F3FE",
84
- color: themeType === "dark" ? "#F6F6F6" : "#0F172A"
85
- }
86
64
  }
87
65
  });
88
66
  export default TableStyles;
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from "react";
2
2
  import { Transforms } from "slate";
3
3
  import { useSelected, useSlateStatic } from "slate-react";
4
- import { Box, IconButton, Tooltip, Table as TableComp, TableBody, Popper, Typography } from "@mui/material";
4
+ import { Box, IconButton, Tooltip, Table as TableComp, TableBody } from "@mui/material";
5
5
  import AlignHorizontalLeftIcon from "@mui/icons-material/AlignHorizontalLeft";
6
6
  import AlignHorizontalRightIcon from "@mui/icons-material/AlignHorizontalRight";
7
7
  import AlignVerticalTopIcon from "@mui/icons-material/AlignVerticalTop";
@@ -15,7 +15,6 @@ import { TableUtil } from "../../utils/table";
15
15
  import TablePopup from "./TablePopup";
16
16
  import { useEditorSelection } from "../../hooks/useMouseMove";
17
17
  import TableStyles from "./Styles";
18
- import useClickOutside from "../../hooks/useClickOutside";
19
18
  import "./table.css";
20
19
  import { jsx as _jsx } from "react/jsx-runtime";
21
20
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -184,7 +183,7 @@ const Table = props => {
184
183
  children: [/*#__PURE__*/_jsx(TableComp, {
185
184
  sx: classes.table,
186
185
  style: {
187
- background: bgColor,
186
+ backgroundColor: bgColor,
188
187
  border: `1px solid ${borderColor}`,
189
188
  width: "auto"
190
189
  },
@@ -1,12 +1,11 @@
1
1
  import React, { useState, useEffect } from "react";
2
- import { Editor, Element, Transforms } from "slate";
3
- import { Box, MenuItem, Popper, Typography } from "@mui/material";
2
+ import { Editor, Element } from "slate";
3
+ import { Box } from "@mui/material";
4
4
  import { useSlateStatic, ReactEditor } from "slate-react";
5
5
  import useTableResize from "../../utils/customHooks/useTableResize";
6
6
  import { TableUtil } from "../../utils/table";
7
7
  import TableStyles from "./Styles";
8
8
  import { useEditorSelection } from "../../hooks/useMouseMove";
9
- import useClickOutside from "../../hooks/useClickOutside";
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
11
10
  import { Fragment as _Fragment } from "react/jsx-runtime";
12
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -29,8 +28,7 @@ const Resizer = ({
29
28
  });
30
29
  };
31
30
  const TableCell = props => {
32
- const themeType = localStorage.getItem("themeType");
33
- const classes = TableStyles(themeType);
31
+ const classes = TableStyles();
34
32
  const {
35
33
  element,
36
34
  attributes,
@@ -71,42 +69,6 @@ const TableCell = props => {
71
69
  const tableDOM = table.getDOMNode(path, true);
72
70
  const isCellSelected = table.isCellSelected(editor.selection);
73
71
  const hasSelected = (isCellSelected || [])?.findIndex(f => f.join(",") === path.join(",")) > -1;
74
- const [anchorEl, setAnchorEl] = useState(null);
75
- const open = Boolean(anchorEl);
76
- const popperOptions = [{
77
- value: "Delete Row"
78
- }, {
79
- value: "Delete Column"
80
- }];
81
- const onRightClick = e => {
82
- e.preventDefault();
83
- if (hasSelected) {
84
- setAnchorEl(e.currentTarget);
85
- }
86
- };
87
- const closePoper = () => {
88
- setAnchorEl(null);
89
- };
90
- const handleMenuItemClick = value => {
91
- Transforms.select(editor, editor.selection);
92
- switch (value) {
93
- case "Delete Row":
94
- table.deleteRow();
95
- break;
96
- case "Delete Column":
97
- table.deleteColumn();
98
- break;
99
- default:
100
- return;
101
- }
102
- // closePoper();
103
- };
104
-
105
- // Use the useClickOutside hook
106
- const popperRef = useClickOutside({
107
- onClickOutside: closePoper,
108
- refCount: 1
109
- })[0];
110
72
  useEffect(() => {
111
73
  if (tableDOM) {
112
74
  const {
@@ -127,7 +89,7 @@ const TableCell = props => {
127
89
  cellWidth: parentWidth / columns
128
90
  });
129
91
  }
130
- }, [tableDOM, anchorEl]);
92
+ }, [tableDOM]);
131
93
  useEffect(() => {
132
94
  if (editor && element && tableSize) {
133
95
  const dom = ReactEditor.toDOMNode(editor, element);
@@ -137,37 +99,14 @@ const TableCell = props => {
137
99
  height: 100
138
100
  });
139
101
  }
140
- }, [tableSize, anchorEl]);
102
+ }, [tableSize]);
141
103
  useEffect(() => {
142
104
  if (!resizing && tableProps) {
143
105
  table.updateTableStyle({
144
106
  "col.size": size
145
107
  }, tableProps);
146
108
  }
147
- }, [resizing, anchorEl]);
148
- const poperForDeltion = () => {
149
- return /*#__PURE__*/_jsx(Popper, {
150
- open: open,
151
- anchorEl: anchorEl,
152
- placement: "bottom-start",
153
- disablePortal: true,
154
- ref: popperRef,
155
- sx: classes.deleteCellsPopUp,
156
- children: popperOptions.map(option => /*#__PURE__*/_jsx(MenuItem, {
157
- value: option.value,
158
- onClick: () => handleMenuItemClick(option.value),
159
- contentEditable: false,
160
- sx: classes.menuItemPopUp,
161
- children: /*#__PURE__*/_jsx(Typography, {
162
- sx: {
163
- fontSize: "12px",
164
- userSelect: "none"
165
- },
166
- children: option.value
167
- })
168
- }, option.value))
169
- });
170
- };
109
+ }, [resizing]);
171
110
  const sizeProps = isHeader ? {
172
111
  width: size?.width || tableSize?.cellWidth
173
112
  } : {};
@@ -178,11 +117,10 @@ const TableCell = props => {
178
117
  className: `editor-table-cell ${hasSelected ? "selection" : ""}`,
179
118
  style: {
180
119
  position: "relative",
181
- background: bgColor || entireBgColor,
120
+ backgroundColor: bgColor || entireBgColor,
182
121
  border: `3px solid ${cellBorderColor}`,
183
122
  ...(sizeProps || {})
184
123
  },
185
- onContextMenu: onRightClick,
186
124
  children: [children, isHeader && !readOnly && tableSize?.height && !showTool ? /*#__PURE__*/_jsx(Resizer, {
187
125
  classes: classes,
188
126
  onMouseDown: onMouseDown,
@@ -190,7 +128,7 @@ const TableCell = props => {
190
128
  }) : null, hasSelected && !readOnly ? /*#__PURE__*/_jsx("div", {
191
129
  className: "selection-area-tc",
192
130
  contentEditable: false
193
- }) : null, poperForDeltion()]
131
+ }) : null]
194
132
  });
195
133
  };
196
134
  export default TableCell;
@@ -8,7 +8,6 @@ import { ReactEditor } from "slate-react";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
10
  const TableContextMenu = props => {
11
- console.log("Table context menu :", props);
12
11
  const {
13
12
  editor
14
13
  } = props;
@@ -23,8 +23,7 @@ const MiniEditor = props => {
23
23
  miniEditorPlaceholder,
24
24
  className,
25
25
  otherProps,
26
- onSave,
27
- theme
26
+ onSave
28
27
  } = props;
29
28
  const {
30
29
  CHARACTERS = []
@@ -133,7 +132,6 @@ const MiniEditor = props => {
133
132
  editor: editor,
134
133
  initialValue: content,
135
134
  onChange: onChange,
136
- theme: theme,
137
135
  children: [/*#__PURE__*/_jsx(BasicToolbar, {
138
136
  ...props
139
137
  }), /*#__PURE__*/_jsx(Editable, {
@@ -60,7 +60,7 @@ const editorStyles = ({
60
60
  display: "flex",
61
61
  flex: 1,
62
62
  flexDirection: "column",
63
- paddingBottom: "25px !important"
63
+ paddingBottom: "18px"
64
64
  },
65
65
  "& .scroll-area": {
66
66
  display: "flex",
@@ -25,8 +25,7 @@ const BasicToolbar = props => {
25
25
  hideTextColor = false,
26
26
  hideResetIcon = true,
27
27
  onResetClick = () => {}
28
- },
29
- theme
28
+ }
30
29
  } = props;
31
30
  // state
32
31
  const [activeColor, setActiveColor] = useState("#000000");
@@ -66,8 +65,7 @@ const BasicToolbar = props => {
66
65
  item: true,
67
66
  children: /*#__PURE__*/_jsx(LinkButton, {
68
67
  active: isBlockActive(editor, link.format),
69
- editor: editor,
70
- theme: theme
68
+ editor: editor
71
69
  }, link.id)
72
70
  }), !hideTextColor && /*#__PURE__*/_jsx(Grid, {
73
71
  item: true,
@@ -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";
3
+ import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
4
4
  import { fontFamilyMap } from "../../utils/font";
5
- import { toolbarGroups } from "../toolbarGroups.js";
6
5
  import { jsx as _jsx } from "react/jsx-runtime";
7
- const allTools = toolbarGroups.flat();
8
- const fontWeight = allTools.find(f => f.format === "fontWeight");
9
- const getValue = (editor, format) => {
10
- switch (format) {
11
- case "fontFamily":
12
- {
13
- const style = getSelectedElementStyle("font-family", editor);
14
- const val = Object.entries(fontFamilyMap).find(([key, value]) => value === style)?.[0];
15
- return val || fontFamilyMap.PoppinsRegular;
16
- }
17
- case "fontWeight":
18
- {
19
- const {
20
- options
21
- } = fontWeight || {};
22
- const fontWeightStyle = getSelectedElementStyle("font-weight", editor);
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 = 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;
@@ -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,
@@ -9,7 +9,7 @@ const MarkButton = ({
9
9
  title
10
10
  }) => {
11
11
  return /*#__PURE__*/_jsx(Button, {
12
- active: isMarkBtnActive(editor, format),
12
+ active: isMarkActive(editor, format),
13
13
  format: format,
14
14
  onMouseDown: e => {
15
15
  e.preventDefault();
@@ -1,8 +1,9 @@
1
- import React, { useEffect, useRef, useState } from "react";
1
+ import React from "react";
2
2
  import { TextField, IconButton } from "@mui/material";
3
- import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
3
+ import { addMarkData, activeMark, isBlockActive } from "../../utils/SlateUtilityFunctions.js";
4
+ import { headingMap, sizeMap } from "../../utils/font.js";
4
5
  import { TextMinusIcon, TextPlusIcon } from "../../common/iconslist.js";
5
- import { getBreakPointsValue, getTextSizeVal } from "../../helper/theme.js";
6
+ import { getBreakPointsValue } from "../../helper/theme.js";
6
7
  import useWindowResize from "../../hooks/useWindowResize.js";
7
8
  import { BREAKPOINTS_DEVICES } from "../../helper/theme.js";
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -16,13 +17,7 @@ const TextSize = ({
16
17
  }) => {
17
18
  const [size] = useWindowResize();
18
19
  const val = activeMark(editor, format);
19
- const noFontSize = val === "normal" || typeof val === "object" && !Object.keys(val)?.length;
20
- const value = noFontSize ? getTextSizeVal(editor) : getBreakPointsValue(val, size?.device);
21
- const [fontSize, setFontSize] = useState();
22
- const timerRef = useRef();
23
- useEffect(() => {
24
- setFontSize(getSizeVal());
25
- }, [value]);
20
+ const value = getBreakPointsValue(val, size?.device);
26
21
  const updateMarkData = newVal => {
27
22
  let upData = {
28
23
  ...getBreakPointsValue(val),
@@ -44,18 +39,20 @@ const TextSize = ({
44
39
  }
45
40
  });
46
41
  };
47
- const onChangeSize = value => {
48
- if (value) {
49
- let inc = parseInt(value);
50
- inc = inc > 200 ? 200 : inc;
51
- updateMarkData(inc);
52
- } else {
53
- setFontSize(null);
54
- }
42
+ const onChangeSize = e => {
43
+ let inc = parseInt(e.target.value) || 8;
44
+ inc = inc > 200 ? 200 : inc;
45
+ updateMarkData(inc || 8);
55
46
  };
56
47
  const getSizeVal = () => {
57
48
  try {
58
- return parseInt(value);
49
+ let size = `${value}`?.indexOf("px") >= 0 ? value : sizeMap[value] || value;
50
+ Object.entries(headingMap).forEach(([format, value]) => {
51
+ if (isBlockActive(editor, format) && isNaN(parseInt(size))) {
52
+ size = value;
53
+ }
54
+ });
55
+ return parseInt(size);
59
56
  } catch (err) {
60
57
  return "";
61
58
  }
@@ -70,19 +67,11 @@ const TextSize = ({
70
67
  const newVal = combinedOldVal - 1 < 0 ? 0 : combinedOldVal - 1;
71
68
  updateMarkData(newVal);
72
69
  };
73
- const onChange = e => {
74
- clearTimeout(timerRef.current);
75
- const value = e.target.value;
76
- setFontSize(value);
77
- timerRef.current = setTimeout(() => {
78
- onChangeSize(value);
79
- }, 500);
80
- };
81
70
  return /*#__PURE__*/_jsx(_Fragment, {
82
71
  children: /*#__PURE__*/_jsx(TextField, {
83
72
  sx: classes?.textSize,
84
- value: fontSize,
85
- onChange: onChange,
73
+ value: combinedOldVal,
74
+ onChange: onChangeSize,
86
75
  size: "small",
87
76
  inputProps: {
88
77
  style: {
@@ -9,7 +9,6 @@ import miniToolbarStyles from "./Styles";
9
9
  import usePopupStyle from "../PopupTool/PopupToolStyle";
10
10
  import PopperHeader from "../PopupTool/PopperHeader";
11
11
  import { useEditorContext } from "../../hooks/useMouseMove";
12
- import PageSettingsButton from "../../Elements/PageSettings/PageSettingsButton";
13
12
  import { jsx as _jsx } from "react/jsx-runtime";
14
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
14
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -48,25 +47,12 @@ const MiniToolbar = props => {
48
47
  const {
49
48
  popupType
50
49
  } = useEditorContext();
51
- const canUndo = editor.history.undos.length > 0;
52
- const canRedo = editor.history.redos.length > 0;
53
- const [toolTip, setToolTip] = useState(false);
54
- const [data, setData] = useState(null);
55
- useEffect(() => {
56
- if (data) {
57
- setToolTip(false);
58
- setData(null);
59
- }
60
- }, [data]);
61
50
  useEffect(() => {
62
51
  if (popper) {
63
52
  setPopper(null);
64
53
  }
65
54
  }, [editor.selection]);
66
55
  const handleClick = type => e => {
67
- if (type === "page-settings") {
68
- setToolTip(true);
69
- }
70
56
  setPopper(type);
71
57
  setAnchorEl(e.currentTarget);
72
58
  };
@@ -80,10 +66,6 @@ const MiniToolbar = props => {
80
66
  const onSearch = e => {
81
67
  setSearch(e?.target?.value || "");
82
68
  };
83
- const closePopper = data => {
84
- setData(data);
85
- setToolTip("false");
86
- };
87
69
  return /*#__PURE__*/_jsxs(_Fragment, {
88
70
  children: [/*#__PURE__*/_jsx(Box, {
89
71
  component: "div",
@@ -94,24 +76,16 @@ const MiniToolbar = props => {
94
76
  label,
95
77
  icon: Icon
96
78
  }) => {
97
- const isDisabled = popupType === type || type === "undo" ? !canUndo : type === "redo" ? !canRedo : false; // for textFormat type
79
+ const isDisabled = popupType === type; // for textFormat type
98
80
 
99
81
  return /*#__PURE__*/_jsx(Tooltip, {
100
82
  arrow: true,
101
83
  title: label,
102
- disableHoverListener: toolTip,
103
84
  children: /*#__PURE__*/_jsx(IconButton, {
104
- className: `${type === popper ? "active" : ""} ${type === "undo" && !canUndo || type === "redo" && !canRedo ? "disabled" : ""}`,
85
+ className: type === popper ? "active" : "",
105
86
  onClick: handleClick(type),
106
87
  disabled: isDisabled,
107
- children: type === "page-settings" ? /*#__PURE__*/_jsx(PageSettingsButton, {
108
- from: "miniToolBar",
109
- icoBtnType: "mini",
110
- customProps: customProps,
111
- editor: editor,
112
- closePopper: closePopper,
113
- setToolTip: setToolTip
114
- }) : /*#__PURE__*/_jsx(Icon, {
88
+ children: /*#__PURE__*/_jsx(Icon, {
115
89
  from: "miniToolBar",
116
90
  icoBtnType: "mini",
117
91
  customProps: customProps,
@@ -2,8 +2,6 @@ import TextIcon from "../../../assets/svg/TextIcon";
2
2
  import AddElementIcon from "../../../assets/svg/AddElementIcon";
3
3
  import AddTemplateIcon from "../../../assets/svg/AddTemplateIcon";
4
4
  import PageSettingsButton from "../../../Elements/PageSettings/PageSettingsButton";
5
- import UndoButton from "../../../Elements/Undo/UndoButton";
6
- import RedoButton from "../../../Elements/Redo/RedoButton";
7
5
  const MENU_OPTIONS = [{
8
6
  type: "textFormat",
9
7
  icon: TextIcon,
@@ -20,13 +18,5 @@ const MENU_OPTIONS = [{
20
18
  type: "page-settings",
21
19
  icon: PageSettingsButton,
22
20
  label: "Page Settings"
23
- }, {
24
- type: "undo",
25
- icon: UndoButton,
26
- label: "Undo"
27
- }, {
28
- type: "redo",
29
- icon: RedoButton,
30
- label: "Redo"
31
21
  }];
32
22
  export default MENU_OPTIONS;
@@ -41,13 +41,6 @@ const miniToolbarStyles = theme => ({
41
41
  "& svg": {
42
42
  stroke: theme?.palette?.editor?.activeColor
43
43
  }
44
- },
45
- "&.disabled": {
46
- "& svg": {
47
- '& path': {
48
- stroke: theme?.palette?.editor?.svgStrokeDisabled
49
- }
50
- }
51
44
  }
52
45
  }
53
46
  }
@@ -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 parseInt(size);
56
63
  } catch (err) {
57
64
  return "";
58
65
  }