@flozy/editor 3.8.7 → 3.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. package/dist/Editor/ChatEditor.js +55 -29
  2. package/dist/Editor/CommonEditor.js +109 -166
  3. package/dist/Editor/Editor.css +12 -8
  4. package/dist/Editor/Elements/AI/AIInput.js +5 -16
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +17 -31
  6. package/dist/Editor/Elements/AI/Styles.js +1 -2
  7. package/dist/Editor/Elements/Accordion/Accordion.js +1 -1
  8. package/dist/Editor/Elements/Accordion/AccordionSummary.js +20 -6
  9. package/dist/Editor/Elements/AppHeader/AppHeader.js +4 -26
  10. package/dist/Editor/Elements/Button/EditorButton.js +16 -28
  11. package/dist/Editor/Elements/Color Picker/ColorButtons.js +17 -60
  12. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  13. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  14. package/dist/Editor/Elements/Color Picker/Styles.js +1 -2
  15. package/dist/Editor/Elements/Emoji/EmojiPicker.js +4 -2
  16. package/dist/Editor/Elements/Form/Form.js +1 -1
  17. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
  18. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -2
  19. package/dist/Editor/Elements/Grid/Grid.js +3 -27
  20. package/dist/Editor/Elements/Grid/GridItem.js +1 -3
  21. package/dist/Editor/Elements/Link/Link.js +1 -6
  22. package/dist/Editor/Elements/Link/LinkButton.js +2 -4
  23. package/dist/Editor/Elements/Link/LinkPopup.js +3 -10
  24. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +8 -4
  25. package/dist/Editor/Elements/Signature/SignaturePopup.js +3 -14
  26. package/dist/Editor/Elements/Table/Styles.js +1 -23
  27. package/dist/Editor/Elements/Table/Table.js +1 -2
  28. package/dist/Editor/Elements/Table/TableCell.js +7 -69
  29. package/dist/Editor/Elements/TableContextMenu/TableContextMenu.js +0 -1
  30. package/dist/Editor/MiniEditor.js +1 -3
  31. package/dist/Editor/Toolbar/Basic/index.js +2 -4
  32. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +2 -26
  33. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  34. package/dist/Editor/Toolbar/FormatTools/TextSize.js +18 -29
  35. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +27 -5
  36. package/dist/Editor/Toolbar/Mini/Options/Options.js +0 -10
  37. package/dist/Editor/Toolbar/Mini/Styles.js +0 -7
  38. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +11 -4
  39. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +86 -213
  40. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +1 -2
  41. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +13 -20
  42. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +7 -52
  43. package/dist/Editor/Toolbar/PopupTool/index.js +5 -6
  44. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  45. package/dist/Editor/assets/svg/AIIcons.js +1 -153
  46. package/dist/Editor/assets/svg/AddTemplateIcon.js +10 -13
  47. package/dist/Editor/assets/svg/TextIcon.js +5 -8
  48. package/dist/Editor/common/ColorPickerButton.js +9 -25
  49. package/dist/Editor/common/DnD/DragHandleButton.js +47 -56
  50. package/dist/Editor/common/Icon.js +3 -43
  51. package/dist/Editor/common/LinkSettings/NavComponents.js +2 -5
  52. package/dist/Editor/common/LinkSettings/index.js +2 -4
  53. package/dist/Editor/common/LinkSettings/navOptions.js +2 -7
  54. package/dist/Editor/common/LinkSettings/style.js +8 -11
  55. package/dist/Editor/common/MentionsPopup/MentionsListCard.js +6 -1
  56. package/dist/Editor/common/Section/index.js +7 -57
  57. package/dist/Editor/common/Section/styles.js +0 -11
  58. package/dist/Editor/common/Shorthands/elements.js +0 -54
  59. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  60. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +29 -33
  61. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +25 -31
  62. package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
  63. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +7 -31
  64. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
  65. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +14 -3
  66. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +4 -14
  67. package/dist/Editor/common/StyleBuilder/index.js +1 -1
  68. package/dist/Editor/common/iconslist.js +31 -0
  69. package/dist/Editor/helper/index.js +22 -0
  70. package/dist/Editor/helper/theme.js +4 -189
  71. package/dist/Editor/hooks/useMouseMove.js +1 -4
  72. package/dist/Editor/hooks/useWindowMessage.js +7 -10
  73. package/dist/Editor/plugins/withEmbeds.js +1 -1
  74. package/dist/Editor/plugins/withHTML.js +1 -1
  75. package/dist/Editor/plugins/withTable.js +1 -1
  76. package/dist/Editor/theme/ThemeList.js +173 -50
  77. package/dist/Editor/utils/SlateUtilityFunctions.js +27 -169
  78. package/dist/Editor/utils/button.js +17 -1
  79. package/dist/Editor/utils/draftToSlate.js +1 -1
  80. package/dist/Editor/utils/events.js +2 -54
  81. package/dist/Editor/utils/font.js +37 -40
  82. package/dist/Editor/utils/helper.js +2 -31
  83. package/dist/Editor/utils/table.js +43 -51
  84. package/package.json +2 -3
  85. package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +0 -73
  86. package/dist/Editor/Elements/AI/VoiceToText/index.js +0 -167
  87. package/dist/Editor/Elements/AI/VoiceToText/style.js +0 -40
  88. package/dist/Editor/Elements/Link/LinkPopupStyles.js +0 -28
  89. package/dist/Editor/Elements/Redo/RedoButton.js +0 -14
  90. package/dist/Editor/Elements/Undo/UndoButton.js +0 -14
  91. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
  92. package/dist/Editor/assets/svg/RedoIcon.js +0 -27
  93. package/dist/Editor/assets/svg/SettingsIcon.js +0 -28
  94. package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
  95. package/dist/Editor/assets/svg/UndoIcon.js +0 -27
  96. package/dist/Editor/common/CustomColorPicker/index.js +0 -106
  97. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  98. package/dist/Editor/common/CustomDialog/index.js +0 -94
  99. package/dist/Editor/common/CustomDialog/style.js +0 -67
  100. package/dist/Editor/common/CustomSelect.js +0 -33
  101. package/dist/Editor/hooks/useEditorTheme.js +0 -139
  102. package/dist/Editor/theme/index.js +0 -144
  103. package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
  104. package/dist/Editor/themeSettings/buttons/index.js +0 -290
  105. package/dist/Editor/themeSettings/buttons/style.js +0 -21
  106. package/dist/Editor/themeSettings/colorTheme/index.js +0 -290
  107. package/dist/Editor/themeSettings/colorTheme/style.js +0 -77
  108. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -123
  109. package/dist/Editor/themeSettings/fonts/index.js +0 -213
  110. package/dist/Editor/themeSettings/fonts/style.js +0 -44
  111. package/dist/Editor/themeSettings/icons.js +0 -60
  112. package/dist/Editor/themeSettings/index.js +0 -320
  113. package/dist/Editor/themeSettings/style.js +0 -152
  114. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  115. package/dist/Editor/themeSettingsAI/index.js +0 -356
  116. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -190
  117. package/dist/Editor/themeSettingsAI/style.js +0 -247
@@ -1,7 +1,6 @@
1
1
  import React from "react";
2
2
  import { Dialog, DialogActions, DialogContent, DialogTitle, FormControl, FormControlLabel, Grid, TextField, Button, IconButton, Typography, Checkbox } from "@mui/material";
3
3
  import CloseIcon from "@mui/icons-material/Close";
4
- import LinkPopupStyles from "./LinkPopupStyles";
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
5
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
6
  const LinkPopup = props => {
@@ -10,11 +9,8 @@ const LinkPopup = props => {
10
9
  handleClose,
11
10
  linkData,
12
11
  handleInputChange,
13
- handleInsertLink,
14
- theme
12
+ handleInsertLink
15
13
  } = props;
16
- const themeType = localStorage.getItem("themeType");
17
- const classes = LinkPopupStyles(themeType);
18
14
  return /*#__PURE__*/_jsxs(Dialog, {
19
15
  fullWidth: true,
20
16
  open: open,
@@ -48,15 +44,13 @@ const LinkPopup = props => {
48
44
  style: {
49
45
  paddingTop: "12px"
50
46
  },
51
- className: classes.titleTypo,
52
47
  children: /*#__PURE__*/_jsx(TextField, {
53
48
  size: "small",
54
49
  fullWidth: true,
55
50
  value: linkData?.name,
56
51
  name: "name",
57
52
  placeholder: "Link Title",
58
- onChange: handleInputChange,
59
- sx: classes.addLinkField
53
+ onChange: handleInputChange
60
54
  })
61
55
  }), /*#__PURE__*/_jsx(Grid, {
62
56
  item: true,
@@ -70,8 +64,7 @@ const LinkPopup = props => {
70
64
  name: "url",
71
65
  value: linkData?.url,
72
66
  placeholder: "https://google.com",
73
- onChange: handleInputChange,
74
- sx: classes.addLinkField
67
+ onChange: handleInputChange
75
68
  })
76
69
  }), /*#__PURE__*/_jsx(Grid, {
77
70
  item: true,
@@ -1,9 +1,9 @@
1
1
  import React, { useState } from "react";
2
2
  import { useSlateStatic } from "slate-react";
3
3
  import PageSettingsPopup from "./PageSettingsPopup";
4
+ import { PageSettings } from "../../common/iconslist";
4
5
  import ToolbarIcon from "../../common/ToolbarIcon";
5
6
  import { getPageSettings, updatePageSettings } from "../../utils/pageSettings";
6
- import SettingsIcon from "../../assets/svg/SettingsIcon";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  import { Fragment as _Fragment } from "react/jsx-runtime";
9
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -11,7 +11,9 @@ const PageSettingsButton = props => {
11
11
  const {
12
12
  customProps,
13
13
  icoBtnType,
14
- from
14
+ from,
15
+ closePopper,
16
+ setToolTip
15
17
  } = props;
16
18
  const [openSetttings, setOpenSettings] = useState(false);
17
19
  const editor = useSlateStatic();
@@ -38,16 +40,18 @@ const PageSettingsButton = props => {
38
40
  }
39
41
  };
40
42
  const onClose = () => {
43
+ closePopper(true);
44
+ setToolTip(false);
41
45
  setOpenSettings(false);
42
46
  };
43
47
  return /*#__PURE__*/_jsxs(_Fragment, {
44
- children: [from === "miniToolBar" ? /*#__PURE__*/_jsx(SettingsIcon, {
48
+ children: [from === "miniToolBar" ? /*#__PURE__*/_jsx(PageSettings, {
45
49
  onClick: onSettings,
46
50
  className: "removeDefaultSvgCls"
47
51
  }) : /*#__PURE__*/_jsx(ToolbarIcon, {
48
52
  title: "Page Settings",
49
53
  onClick: onSettings,
50
- icon: /*#__PURE__*/_jsx(SettingsIcon, {}),
54
+ icon: /*#__PURE__*/_jsx(PageSettings, {}),
51
55
  icoBtnType: icoBtnType
52
56
  }), openSetttings !== false ? /*#__PURE__*/_jsx(PageSettingsPopup, {
53
57
  element: openSetttings?.element || {},
@@ -263,12 +263,7 @@ const SignaturePopup = props => {
263
263
  name: "signedBy",
264
264
  placeholder: "Enter Name",
265
265
  size: "small",
266
- onChange: onChange,
267
- sx: {
268
- '& .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline': {
269
- borderColor: '#ccc'
270
- }
271
- }
266
+ onChange: onChange
272
267
  })
273
268
  })]
274
269
  }), /*#__PURE__*/_jsxs(Grid, {
@@ -316,8 +311,7 @@ const SignaturePopup = props => {
316
311
  },
317
312
  children: [/*#__PURE__*/_jsx(Grid, {
318
313
  style: {
319
- marginRight: "8px",
320
- minWidth: '44px'
314
+ marginRight: "8px"
321
315
  },
322
316
  children: /*#__PURE__*/_jsx("label", {
323
317
  htmlFor: "signedByEmail",
@@ -332,12 +326,7 @@ const SignaturePopup = props => {
332
326
  name: "signedByEmail",
333
327
  placeholder: "Enter Email",
334
328
  size: "small",
335
- onChange: onChange,
336
- sx: {
337
- '& .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline': {
338
- borderColor: '#ccc'
339
- }
340
- }
329
+ onChange: onChange
341
330
  })
342
331
  })]
343
332
  })]
@@ -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";
@@ -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
  } : {};
@@ -182,7 +121,6 @@ const TableCell = props => {
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, {
@@ -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,6 +9,7 @@ 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";
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
15
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -47,14 +48,23 @@ const MiniToolbar = props => {
47
48
  const {
48
49
  popupType
49
50
  } = useEditorContext();
50
- const canUndo = editor.history.undos.length > 0;
51
- const canRedo = editor.history.redos.length > 0;
51
+ const [toolTip, setToolTip] = useState(false);
52
+ const [data, setData] = useState(null);
53
+ useEffect(() => {
54
+ if (data) {
55
+ setToolTip(false);
56
+ setData(null);
57
+ }
58
+ }, [data]);
52
59
  useEffect(() => {
53
60
  if (popper) {
54
61
  setPopper(null);
55
62
  }
56
63
  }, [editor.selection]);
57
64
  const handleClick = type => e => {
65
+ if (type === "page-settings") {
66
+ setToolTip(true);
67
+ }
58
68
  setPopper(type);
59
69
  setAnchorEl(e.currentTarget);
60
70
  };
@@ -68,6 +78,10 @@ const MiniToolbar = props => {
68
78
  const onSearch = e => {
69
79
  setSearch(e?.target?.value || "");
70
80
  };
81
+ const closePopper = data => {
82
+ setData(data);
83
+ setToolTip("false");
84
+ };
71
85
  return /*#__PURE__*/_jsxs(_Fragment, {
72
86
  children: [/*#__PURE__*/_jsx(Box, {
73
87
  component: "div",
@@ -78,16 +92,24 @@ const MiniToolbar = props => {
78
92
  label,
79
93
  icon: Icon
80
94
  }) => {
81
- const isDisabled = popupType === type || type === 'undo' ? !canUndo : type === 'redo' ? !canRedo : false; // for textFormat type
95
+ const isDisabled = popupType === type; // for textFormat type
82
96
 
83
97
  return /*#__PURE__*/_jsx(Tooltip, {
84
98
  arrow: true,
85
99
  title: label,
100
+ disableHoverListener: toolTip,
86
101
  children: /*#__PURE__*/_jsx(IconButton, {
87
- className: `${type === popper ? "active" : ""} ${type === 'undo' && !canUndo || type === 'redo' && !canRedo ? "disabled" : ""}`,
102
+ className: type === popper ? "active" : "",
88
103
  onClick: handleClick(type),
89
104
  disabled: isDisabled,
90
- children: /*#__PURE__*/_jsx(Icon, {
105
+ children: type === "page-settings" ? /*#__PURE__*/_jsx(PageSettingsButton, {
106
+ from: "miniToolBar",
107
+ icoBtnType: "mini",
108
+ customProps: customProps,
109
+ editor: editor,
110
+ closePopper: closePopper,
111
+ setToolTip: setToolTip
112
+ }) : /*#__PURE__*/_jsx(Icon, {
91
113
  from: "miniToolBar",
92
114
  icoBtnType: "mini",
93
115
  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
  }