@flozy/editor 9.1.4 → 9.1.6

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 (130) hide show
  1. package/dist/Editor/ChatEditor.js +2 -19
  2. package/dist/Editor/CommonEditor.js +37 -104
  3. package/dist/Editor/DialogWrapper.js +25 -31
  4. package/dist/Editor/Editor.css +3 -21
  5. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  6. package/dist/Editor/Elements/Button/EditorButton.js +9 -25
  7. package/dist/Editor/Elements/Color Picker/ColorButtons.js +12 -57
  8. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  9. package/dist/Editor/Elements/Color Picker/ColorPicker.js +5 -5
  10. package/dist/Editor/Elements/Color Picker/Styles.js +1 -1
  11. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +1 -4
  12. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +4 -3
  13. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +1 -6
  14. package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +9 -19
  15. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +2 -32
  16. package/dist/Editor/Elements/DataView/Layouts/TableView.js +29 -126
  17. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +3 -3
  18. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +1 -1
  19. package/dist/Editor/Elements/DataView/styles.js +8 -8
  20. package/dist/Editor/Elements/Embed/Image.js +2 -2
  21. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +14 -0
  22. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +1 -2
  23. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -2
  24. package/dist/Editor/Elements/FreeGrid/styles.js +0 -3
  25. package/dist/Editor/Elements/Grid/GridItem.js +3 -2
  26. package/dist/Editor/Elements/Link/Link.js +43 -70
  27. package/dist/Editor/Elements/SimpleText/index.js +1 -0
  28. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  29. package/dist/Editor/Elements/Table/Table.js +27 -43
  30. package/dist/Editor/Elements/Table/TableCell.js +5 -5
  31. package/dist/Editor/Elements/Title/title.js +31 -13
  32. package/dist/Editor/Elements/Variables/Style.js +2 -28
  33. package/dist/Editor/Elements/Variables/VariableButton.js +4 -17
  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 +15 -7
  39. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +0 -1
  40. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +8 -9
  41. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +13 -6
  42. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +85 -210
  43. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +1 -2
  44. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +12 -16
  45. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +7 -54
  46. package/dist/Editor/Toolbar/PopupTool/index.js +17 -6
  47. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  48. package/dist/Editor/common/ColorPickerButton.js +9 -35
  49. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  50. package/dist/Editor/common/DnD/Draggable.js +1 -0
  51. package/dist/Editor/common/FontLoader/FontLoader.js +0 -3
  52. package/dist/Editor/common/Icon.js +0 -28
  53. package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -1
  54. package/dist/Editor/common/ImageSelector/Styles.js +9 -3
  55. package/dist/Editor/common/ImageSelector/UploadStyles.js +10 -9
  56. package/dist/Editor/common/MentionsPopup/Styles.js +12 -6
  57. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -2
  58. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
  59. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
  60. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
  61. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
  62. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +2 -4
  63. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +2 -3
  64. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
  65. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
  66. package/dist/Editor/common/RnD/ElementSettings/styles.js +1 -0
  67. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -8
  68. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +10 -31
  69. package/dist/Editor/common/RnD/Utils/gridDropItem.js +4 -5
  70. package/dist/Editor/common/RnD/Utils/index.js +0 -45
  71. package/dist/Editor/common/RnD/VirtualElement/index.js +2 -1
  72. package/dist/Editor/common/RnD/index.js +3 -23
  73. package/dist/Editor/common/Shorthands/elements.js +0 -54
  74. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  75. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
  76. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +2 -12
  77. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
  78. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
  79. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +11 -35
  80. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
  81. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -15
  82. package/dist/Editor/common/Uploader.js +0 -8
  83. package/dist/Editor/commonStyle.js +69 -114
  84. package/dist/Editor/helper/index.js +12 -8
  85. package/dist/Editor/helper/theme.js +2 -200
  86. package/dist/Editor/hooks/useDrag.js +11 -17
  87. package/dist/Editor/hooks/useEditorScroll.js +6 -10
  88. package/dist/Editor/hooks/useMouseMove.js +13 -25
  89. package/dist/Editor/hooks/useTable.js +1 -1
  90. package/dist/Editor/plugins/withEmbeds.js +1 -1
  91. package/dist/Editor/plugins/withHTML.js +16 -20
  92. package/dist/Editor/plugins/withLayout.js +1 -1
  93. package/dist/Editor/plugins/withTable.js +1 -1
  94. package/dist/Editor/theme/ThemeList.js +173 -50
  95. package/dist/Editor/utils/SlateUtilityFunctions.js +37 -150
  96. package/dist/Editor/utils/button.js +14 -0
  97. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +0 -23
  98. package/dist/Editor/utils/draftToSlate.js +2 -3
  99. package/dist/Editor/utils/font.js +37 -40
  100. package/dist/Editor/utils/helper.js +27 -59
  101. package/dist/Editor/utils/link.js +1 -1
  102. package/dist/Editor/utils/table.js +0 -8
  103. package/package.json +3 -6
  104. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
  105. package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
  106. package/dist/Editor/common/CustomColorPicker/index.js +0 -106
  107. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  108. package/dist/Editor/common/CustomDialog/index.js +0 -90
  109. package/dist/Editor/common/CustomDialog/styles.js +0 -80
  110. package/dist/Editor/common/CustomDialog2/index.js +0 -94
  111. package/dist/Editor/common/CustomDialog2/style.js +0 -67
  112. package/dist/Editor/common/CustomSelect.js +0 -33
  113. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
  114. package/dist/Editor/hooks/useEditorTheme.js +0 -153
  115. package/dist/Editor/theme/index.js +0 -144
  116. package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
  117. package/dist/Editor/themeSettings/buttons/index.js +0 -283
  118. package/dist/Editor/themeSettings/buttons/style.js +0 -21
  119. package/dist/Editor/themeSettings/colorTheme/index.js +0 -292
  120. package/dist/Editor/themeSettings/colorTheme/style.js +0 -77
  121. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
  122. package/dist/Editor/themeSettings/fonts/index.js +0 -220
  123. package/dist/Editor/themeSettings/fonts/style.js +0 -44
  124. package/dist/Editor/themeSettings/icons.js +0 -60
  125. package/dist/Editor/themeSettings/index.js +0 -320
  126. package/dist/Editor/themeSettings/style.js +0 -152
  127. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  128. package/dist/Editor/themeSettingsAI/index.js +0 -356
  129. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -197
  130. package/dist/Editor/themeSettingsAI/style.js +0 -250
@@ -11,7 +11,7 @@ const useDataViewStyles = (theme, appTheme) => ({
11
11
  },
12
12
  "& table th": {
13
13
  cursor: "pointer",
14
- minWidth: "200px"
14
+ width: "200px"
15
15
  },
16
16
  "& table, th, td": {
17
17
  border: "1px solid black",
@@ -48,7 +48,7 @@ const useDataViewStyles = (theme, appTheme) => ({
48
48
  "& .tv-ck-box": {
49
49
  "& svg": {
50
50
  color: appTheme?.palette?.editor?.tv_border,
51
- "& rect": {
51
+ '& rect': {
52
52
  fill: appTheme?.palette?.editor?.tv_chk_box_fill,
53
53
  stroke: appTheme?.palette?.editor?.tv_chk_box_stroke
54
54
  }
@@ -56,9 +56,9 @@ const useDataViewStyles = (theme, appTheme) => ({
56
56
  "&.Mui-checked": {
57
57
  "& svg": {
58
58
  color: "rgba(37, 99, 235, 1)",
59
- "& rect": {
59
+ '& rect': {
60
60
  fill: appTheme?.palette?.editor?.activeColor,
61
- stroke: "none"
61
+ stroke: 'none'
62
62
  }
63
63
  }
64
64
  }
@@ -94,7 +94,7 @@ const useDataViewStyles = (theme, appTheme) => ({
94
94
  border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
95
95
  boxShadow: "0px 4px 18px 0px #0000000D",
96
96
  borderRadius: "8px",
97
- minWidth: "148px"
97
+ minWidth: '148px'
98
98
  },
99
99
  "& input": {
100
100
  paddingBottom: "0px",
@@ -140,12 +140,12 @@ const useDataViewStyles = (theme, appTheme) => ({
140
140
  width: "150px",
141
141
  border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
142
142
  borderRadius: "8px",
143
- fontFamily: "Inter !important",
143
+ fontFamily: 'Inter !important',
144
144
  background: appTheme?.palette?.editor?.tv_pop_bg,
145
145
  color: appTheme?.palette?.editor?.tv_text_primary,
146
146
  "& .MuiButtonBase-root": {
147
147
  fontSize: "14px",
148
- padding: "6px 8px",
148
+ padding: '6px 8px',
149
149
  "& svg": {
150
150
  width: "16px",
151
151
  height: "16px",
@@ -157,7 +157,7 @@ const useDataViewStyles = (theme, appTheme) => ({
157
157
  color: `${appTheme?.palette?.editor?.tv_hover_text} !important`,
158
158
  "& svg": {
159
159
  color: `${appTheme?.palette?.editor?.tv_hover_text} !important`,
160
- "& path": {
160
+ '& path': {
161
161
  stroke: `${appTheme?.palette?.editor?.tv_hover_text} !important`
162
162
  }
163
163
  }
@@ -5,7 +5,7 @@ import AspectRatioIcon from "@mui/icons-material/AspectRatio";
5
5
  import useResize from "../../utils/customHooks/useResize";
6
6
  import EmbedPopup from "./EmbedPopup";
7
7
  import { IconButton, Tooltip, Box, useTheme } from "@mui/material";
8
- import { LinkIcon } from "../../common/iconslist";
8
+ import { GridSettingsIcon, LinkIcon } from "../../common/iconslist";
9
9
  import { useEditorContext } from "../../hooks/useMouseMove";
10
10
  import { getTRBLBreakPoints, getBreakPointsValue, groupByBreakpoint } from "../../helper/theme";
11
11
  import Icon from "../../common/Icon";
@@ -32,7 +32,7 @@ const ToolBar = ({
32
32
  top: "-4px",
33
33
  left: topM ? "35px" : "0px",
34
34
  margin: "0px",
35
- gap: "3px"
35
+ gap: '3px'
36
36
  },
37
37
  children: [/*#__PURE__*/_jsx(Tooltip, {
38
38
  title: "Image Settings",
@@ -180,6 +180,20 @@ const FreeGrid = props => {
180
180
  linkType: "webAddress"
181
181
  },
182
182
  iconPosition: "start",
183
+ bgColor: "#2563EB",
184
+ textColor: "#FFF",
185
+ borderRadius: {
186
+ topLeft: 30,
187
+ topRight: 30,
188
+ bottomLeft: 30,
189
+ bottomRight: 30
190
+ },
191
+ bannerSpacing: {
192
+ left: 12,
193
+ top: 12,
194
+ right: 12,
195
+ bottom: 12
196
+ },
183
197
  textAlign: "center",
184
198
  label: "Get Started"
185
199
  }],
@@ -59,8 +59,7 @@ const FreeGridBox = props => {
59
59
  delete updateData.children;
60
60
  updateData = formatBreakpointValues(element.type, breakpoint, updateData);
61
61
  Transforms.setNodes(editor, {
62
- ...updateData,
63
- [`${breakpoint}_updatedOn`]: new Date().getTime()
62
+ ...updateData
64
63
  }, {
65
64
  at: path
66
65
  });
@@ -59,8 +59,7 @@ const FreeGridItem = props => {
59
59
  delete updateData.children;
60
60
  updateData = formatBreakpointValues(element.type, breakpoint, updateData);
61
61
  Transforms.setNodes(editor, {
62
- ...updateData,
63
- [`${breakpoint}_updatedOn`]: new Date().getTime()
62
+ ...updateData
64
63
  }, {
65
64
  at: path
66
65
  });
@@ -338,9 +338,6 @@ const useFreeGridStyles = ({
338
338
  fontSize: "14px",
339
339
  borderRadius: "7px"
340
340
  }
341
- },
342
- "& .remove-resize-styles": {
343
- transform: "none !important"
344
341
  }
345
342
  }
346
343
  },
@@ -50,7 +50,8 @@ const GridItemToolbar = props => {
50
50
  open: true,
51
51
  placement: "top-end",
52
52
  sx: classes.popTools,
53
- className: "gi-tool-pp hide-popper-on-overlap",
53
+ className: "gi-tool-pp",
54
+ disablePortal: true,
54
55
  contentEditable: false,
55
56
  children: /*#__PURE__*/_jsxs(Box, {
56
57
  className: "ico-grp-ss",
@@ -287,7 +288,7 @@ const GridItem = props => {
287
288
  ...getBRProps,
288
289
  display: "flex",
289
290
  flexDirection: flexDirection || "column",
290
- background: bgColor,
291
+ background: bgColor || "transparent",
291
292
  borderColor: getBorderColor(),
292
293
  borderWidth: borderWidth || "1px",
293
294
  borderStyle: borderStyle || "solid",
@@ -1,7 +1,7 @@
1
- import React, { useRef, useState } from "react";
1
+ import React, { useState } from "react";
2
2
  import { Node, Transforms } from "slate";
3
- import { ReactEditor, useSelected, useSlateStatic } from "slate-react";
4
- import { Box, IconButton, Popper, Tooltip } from "@mui/material";
3
+ import { ReactEditor, useFocused, useSelected, useSlateStatic } from "slate-react";
4
+ import { Box, IconButton, Tooltip } from "@mui/material";
5
5
  import OpenInNewIcon from "@mui/icons-material/OpenInNew";
6
6
  import EditIcon from "@mui/icons-material/Edit";
7
7
  import LinkOffIcon from "@mui/icons-material/LinkOff";
@@ -11,62 +11,6 @@ import { getLinkType, handleLinkType } from "../../utils/helper";
11
11
  import LinkSettings from "../../common/LinkSettings";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
- const Toolbar = props => {
15
- const {
16
- urlPath,
17
- linkType,
18
- showInNewTab,
19
- selected,
20
- linkRef,
21
- onEditLink,
22
- editor
23
- } = props;
24
- const btnProps = handleLinkType(urlPath, linkType, true, showInNewTab === "_blank");
25
- const navType = getLinkType(linkType, urlPath);
26
- const hideOpenLink = navType === "page" || !navType;
27
- return selected ? /*#__PURE__*/_jsx(Popper, {
28
- anchorEl: linkRef?.current,
29
- open: true,
30
- placement: "top-start",
31
- className: "hide-popper-on-overlap",
32
- contentEditable: false,
33
- style: {
34
- zIndex: 1000
35
- },
36
- children: /*#__PURE__*/_jsxs(Box, {
37
- className: "element-toolbar hr",
38
- style: {
39
- width: "150px",
40
- display: "flex",
41
- position: "unset"
42
- },
43
- component: "div",
44
- children: [hideOpenLink ? null : /*#__PURE__*/_jsx(Tooltip, {
45
- title: "Open",
46
- children: /*#__PURE__*/_jsx(Box, {
47
- sx: {
48
- display: "inline-flex",
49
- color: "rgba(0, 0, 0, 0.54)"
50
- },
51
- ...btnProps,
52
- children: /*#__PURE__*/_jsx(OpenInNewIcon, {})
53
- })
54
- }), /*#__PURE__*/_jsx(Tooltip, {
55
- title: "Edit",
56
- children: /*#__PURE__*/_jsx(IconButton, {
57
- onClick: onEditLink,
58
- children: /*#__PURE__*/_jsx(EditIcon, {})
59
- })
60
- }), /*#__PURE__*/_jsx(Tooltip, {
61
- title: "Remove",
62
- children: /*#__PURE__*/_jsx(IconButton, {
63
- onClick: () => removeLink(editor),
64
- children: /*#__PURE__*/_jsx(LinkOffIcon, {})
65
- })
66
- })]
67
- })
68
- }) : null;
69
- };
70
14
  const linkStyles = () => ({
71
15
  linkBtn: {
72
16
  border: "none",
@@ -96,6 +40,7 @@ const Link = props => {
96
40
  } = customProps;
97
41
  const editor = useSlateStatic();
98
42
  const selected = useSelected();
43
+ const focused = useFocused();
99
44
  const [showInput, setShowInput] = useState(false);
100
45
  const [linkData, setLinkData] = useState({
101
46
  name: "",
@@ -108,7 +53,6 @@ const Link = props => {
108
53
  const showInNewTab = element?.showInNewTab || element?.target;
109
54
  const linkType = element?.linkType;
110
55
  const classes = linkStyles();
111
- const linkRef = useRef(null);
112
56
  const updateLink = data => {
113
57
  Transforms.setNodes(editor, data, {
114
58
  at: path
@@ -133,25 +77,54 @@ const Link = props => {
133
77
  const handleClose = () => {
134
78
  setShowInput(false);
135
79
  };
80
+ const Toolbar = () => {
81
+ const btnProps = handleLinkType(urlPath, linkType, true, showInNewTab === "_blank");
82
+ const navType = getLinkType(linkType, urlPath);
83
+ const hideOpenLink = navType === "page" || !navType;
84
+ return selected && focused ? /*#__PURE__*/_jsxs("div", {
85
+ className: "element-toolbar hr",
86
+ contentEditable: false,
87
+ style: {
88
+ width: "150px",
89
+ top: "100%",
90
+ left: "0px",
91
+ display: "flex"
92
+ },
93
+ children: [hideOpenLink ? null : /*#__PURE__*/_jsx(Tooltip, {
94
+ title: "Open",
95
+ children: /*#__PURE__*/_jsx(Box, {
96
+ sx: {
97
+ display: "inline-flex",
98
+ color: "rgba(0, 0, 0, 0.54)"
99
+ },
100
+ ...btnProps,
101
+ children: /*#__PURE__*/_jsx(OpenInNewIcon, {})
102
+ })
103
+ }), /*#__PURE__*/_jsx(Tooltip, {
104
+ title: "Edit",
105
+ children: /*#__PURE__*/_jsx(IconButton, {
106
+ onClick: onEditLink,
107
+ children: /*#__PURE__*/_jsx(EditIcon, {})
108
+ })
109
+ }), /*#__PURE__*/_jsx(Tooltip, {
110
+ title: "Remove",
111
+ children: /*#__PURE__*/_jsx(IconButton, {
112
+ onClick: () => removeLink(editor),
113
+ children: /*#__PURE__*/_jsx(LinkOffIcon, {})
114
+ })
115
+ })]
116
+ }) : null;
117
+ };
136
118
  const buttonProps = handleLinkType(urlPath, linkType, readOnly, showInNewTab === "_blank");
137
119
  return /*#__PURE__*/_jsxs("div", {
138
120
  className: "link",
139
- ref: linkRef,
140
121
  children: [/*#__PURE__*/_jsx(Box, {
141
122
  ...attributes,
142
123
  ...element.attr,
143
124
  sx: classes.linkBtn,
144
125
  ...buttonProps,
145
126
  children: children
146
- }), /*#__PURE__*/_jsx(Toolbar, {
147
- urlPath: urlPath,
148
- linkType: linkType,
149
- showInNewTab: showInNewTab,
150
- selected: selected,
151
- linkRef: linkRef,
152
- onEditLink: onEditLink,
153
- editor: editor
154
- }), showInput ? /*#__PURE__*/_jsx(LinkSettings, {
127
+ }), /*#__PURE__*/_jsx(Toolbar, {}), showInput ? /*#__PURE__*/_jsx(LinkSettings, {
155
128
  handleClose: handleClose,
156
129
  onSave: ({
157
130
  linkType,
@@ -5,6 +5,7 @@ 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 } from "../../helper/theme";
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
  import { Fragment as _Fragment } from "react/jsx-runtime";
10
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -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",
@@ -12,11 +12,9 @@ import useTable, { TableProvider, getDefaultTableSelection } from "../../hooks/u
12
12
  import AddRowCol from "./AddRowCol";
13
13
  import TableTool from "./TableTool";
14
14
  import { MoreIcon, SettingsIcon } from "../../assets/svg/TableIcons";
15
- import { DeleteIcon } from "../../assets/svg/AIIcons";
16
15
  import { getSelectedCls } from "../../utils/helper";
17
16
  import SwipeableDrawerComponent from "../../common/SwipeableDrawer";
18
17
  import { jsx as _jsx } from "react/jsx-runtime";
19
- import { Fragment as _Fragment } from "react/jsx-runtime";
20
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
21
19
  const hideRowDragBtns = (hide, dragRowBtnCls) => {
22
20
  const rowDragBtns = document.querySelectorAll(`.${dragRowBtnCls}`);
@@ -32,16 +30,14 @@ const ToolTableComponent = props => {
32
30
  const {
33
31
  updateTableSelection
34
32
  } = useTable();
35
- return /*#__PURE__*/_jsx("div", {
36
- children: /*#__PURE__*/_jsx(TableTool, {
37
- theme: editorTheme,
38
- handleToolAction: (type, option) => {
39
- handleAction(type, option);
40
- if (type === "duplicate") {
41
- updateTableSelection(getDefaultTableSelection());
42
- }
33
+ return /*#__PURE__*/_jsx(TableTool, {
34
+ theme: editorTheme,
35
+ handleToolAction: (type, option) => {
36
+ handleAction(type, option);
37
+ if (type === "duplicate") {
38
+ updateTableSelection(getDefaultTableSelection());
43
39
  }
44
- })
40
+ }
45
41
  });
46
42
  };
47
43
  const MoreTableSettings = props => {
@@ -93,44 +89,34 @@ const ToolBar = props => {
93
89
  handleExpand,
94
90
  handleAction,
95
91
  exandTools,
96
- openSetttings,
97
- hideTools
92
+ openSetttings
98
93
  } = props;
99
94
  const {
100
95
  getSelectedCells
101
96
  } = useTable();
102
97
  const viewTool = selected && !showTool && getSelectedCells()?.length <= 1;
103
- return viewTool ? /*#__PURE__*/_jsx(Box, {
98
+ return viewTool ? /*#__PURE__*/_jsxs(Box, {
104
99
  component: "div",
105
100
  contentEditable: false,
106
101
  className: `tableToolBar ${exandTools ? "active" : ""}`,
107
102
  sx: classes.tableToolBar,
108
- children: !hideTools.includes("settings") ? /*#__PURE__*/_jsxs(_Fragment, {
109
- children: [/*#__PURE__*/_jsx(Tooltip, {
110
- title: "Settings",
111
- arrow: true,
112
- onClick: () => handleAction("settings"),
113
- children: /*#__PURE__*/_jsx(IconButton, {
114
- className: getSelectedCls("toolbtn toggle", openSetttings),
115
- children: /*#__PURE__*/_jsx(SettingsIcon, {})
116
- })
117
- }), /*#__PURE__*/_jsx(Tooltip, {
118
- title: "Show Tools",
119
- arrow: true,
120
- onClick: handleExpand,
121
- children: /*#__PURE__*/_jsx(IconButton, {
122
- className: getSelectedCls("toolbtn toggle", exandTools),
123
- children: /*#__PURE__*/_jsx(MoreIcon, {})
124
- })
125
- })]
126
- }) : /*#__PURE__*/_jsx(Tooltip, {
127
- title: "Delete",
103
+ children: [/*#__PURE__*/_jsx(Tooltip, {
104
+ title: "Settings",
128
105
  arrow: true,
129
- onClick: () => handleAction("delete"),
106
+ onClick: () => handleAction("settings"),
130
107
  children: /*#__PURE__*/_jsx(IconButton, {
131
- children: /*#__PURE__*/_jsx(DeleteIcon, {})
108
+ className: getSelectedCls("toolbtn toggle", openSetttings),
109
+ children: /*#__PURE__*/_jsx(SettingsIcon, {})
132
110
  })
133
- })
111
+ }), /*#__PURE__*/_jsx(Tooltip, {
112
+ title: "Show Tools",
113
+ arrow: true,
114
+ onClick: handleExpand,
115
+ children: /*#__PURE__*/_jsx(IconButton, {
116
+ className: getSelectedCls("toolbtn toggle", exandTools),
117
+ children: /*#__PURE__*/_jsx(MoreIcon, {})
118
+ })
119
+ })]
134
120
  }) : null;
135
121
  };
136
122
  const Table = props => {
@@ -147,8 +133,7 @@ const Table = props => {
147
133
  const classes = TableStyles(editorTheme);
148
134
  const {
149
135
  readOnly,
150
- isMobile,
151
- hideTools = []
136
+ isMobile
152
137
  } = customProps;
153
138
  const [openSetttings, setOpenSettings] = useState(false);
154
139
  const [exandTools, setExpandTools] = useState(null);
@@ -319,12 +304,12 @@ const Table = props => {
319
304
  ...attributes,
320
305
  children: children
321
306
  })
322
- }), !hideTools.includes("add_column") && /*#__PURE__*/_jsx(AddRowCol, {
307
+ }), /*#__PURE__*/_jsx(AddRowCol, {
323
308
  ...commonAddBtnProps,
324
309
  addType: "col",
325
310
  onAdd: addCol
326
311
  })]
327
- }), !hideTools.includes("add_column") && /*#__PURE__*/_jsx(AddRowCol, {
312
+ }), /*#__PURE__*/_jsx(AddRowCol, {
328
313
  ...commonAddBtnProps,
329
314
  addType: "row",
330
315
  onAdd: addRow
@@ -335,8 +320,7 @@ const Table = props => {
335
320
  handleExpand: handleExpand,
336
321
  handleAction: handleAction,
337
322
  exandTools: exandTools,
338
- openSetttings: openSetttings,
339
- hideTools: hideTools
323
+ openSetttings: openSetttings
340
324
  }), /*#__PURE__*/_jsx(MoreTableSettings, {
341
325
  exandTools: exandTools,
342
326
  handleAction: handleAction,
@@ -48,8 +48,7 @@ const TableCell = props => {
48
48
  customProps
49
49
  } = props;
50
50
  const {
51
- readOnly,
52
- hideTools = []
51
+ readOnly
53
52
  } = customProps;
54
53
  const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
55
54
  const {
@@ -107,8 +106,8 @@ const TableCell = props => {
107
106
  const isFirstRow = row === 0;
108
107
  const isFirstColumn = column === 0;
109
108
  const [hoverRow, hoverCol] = hoverPath ? hoverPath.slice(-2) : [];
110
- const showColDrag = isFirstRow && hoverCol === column && !resizing && !readOnly && !hideTools.includes("drag");
111
- const showRowDrag = isFirstColumn && hoverRow === row && !resizing && !readOnly && !hideTools.includes("drag");
109
+ const showColDrag = isFirstRow && hoverCol === column && !resizing && !readOnly;
110
+ const showRowDrag = isFirstColumn && hoverRow === row && !resizing && !readOnly;
112
111
  const [parentProps] = tableNode || [{}];
113
112
  const [rowProps] = rowNode || [{}];
114
113
  const tableDOM = table.getDOMNode(path, true);
@@ -156,7 +155,7 @@ const TableCell = props => {
156
155
  };
157
156
  useEffect(() => {
158
157
  const currentPath = path?.toString();
159
- setTimeout(() => {
158
+ const timeoutId = setTimeout(() => {
160
159
  if (tableResizing === currentPath) {
161
160
  setTableResizing(null);
162
161
 
@@ -172,6 +171,7 @@ const TableCell = props => {
172
171
  if (resizing) {
173
172
  setTableResizing(currentPath);
174
173
  }
174
+ return () => clearTimeout(timeoutId);
175
175
  }, [resizing]);
176
176
  const onMouseEnter = path => {
177
177
  setHoverPath(path);
@@ -1,24 +1,18 @@
1
- import React from "react";
2
- import { Text } from "slate";
1
+ import React, { useEffect, useState } from "react";
2
+ import { Editor } from "slate";
3
+ import { useSlate } from "slate-react";
4
+ import { getNodeText } from "../../utils/helper";
3
5
  import { jsx as _jsx } from "react/jsx-runtime";
4
- const isEmptyTextNode = node => {
5
- if (Text.isText(node)) {
6
- return !node.text.trim();
7
- }
8
- return false;
9
- };
10
6
  const Title = props => {
11
7
  const {
12
- element,
13
8
  attributes,
14
9
  children,
10
+ element,
15
11
  customProps
16
12
  } = props;
17
- const isEmpty = !customProps?.readOnly && isEmptyTextNode(element?.children[0]) ? "empty" : "";
13
+ useDetectExitFromTitle(element, customProps?.getTitleSaveData);
18
14
  return /*#__PURE__*/_jsx("div", {
19
15
  ...attributes,
20
- placeholder: "Title",
21
- className: `content-editable ${isEmpty}`,
22
16
  style: {
23
17
  fontWeight: "bold",
24
18
  fontSize: "20px"
@@ -26,4 +20,28 @@ const Title = props => {
26
20
  children: children
27
21
  });
28
22
  };
29
- export default Title;
23
+ export default Title;
24
+ const useDetectExitFromTitle = (titleNode, onSaveTitle) => {
25
+ const editor = useSlate();
26
+ const [wasInsideTitle, setWasInsideTitle] = useState(false);
27
+ useEffect(() => {
28
+ if (!editor.selection) return;
29
+
30
+ // Get the current node where the cursor is
31
+ const [nodeEntry] = Editor.nodes(editor, {
32
+ at: editor.selection,
33
+ match: n => n.type === "title"
34
+ });
35
+ if (nodeEntry) {
36
+ setWasInsideTitle(true); // User was inside the title
37
+ } else if (wasInsideTitle) {
38
+ // User exited the title node
39
+ const text = getNodeText(titleNode) || "";
40
+ if (text?.trim() && text !== "Untitled" && onSaveTitle) {
41
+ onSaveTitle(text);
42
+ }
43
+ setWasInsideTitle(false);
44
+ }
45
+ }, [editor.selection]);
46
+ return null;
47
+ };
@@ -1,4 +1,4 @@
1
- const VariableStyles = theme => ({
1
+ const VariableStyles = () => ({
2
2
  variablesItem: {
3
3
  color: "#2563EB",
4
4
  background: "#EEEEEE"
@@ -37,34 +37,8 @@ const VariableStyles = theme => ({
37
37
  "& .MuiMenuItem-root": {
38
38
  color: "#64748B"
39
39
  },
40
- "& .MuiPaper-root": {
41
- borderRadius: '8px',
42
- backgroundColor: `${theme?.palette?.editor?.miniToolBarBackground} !important`,
43
- marginTop: '5px',
44
- "@media only screen and (max-width: 599px)": {
45
- padding: '10px 0px'
46
- }
47
- },
48
- "& .MuiList-root": {
49
- padding: '0px'
50
- },
51
- "& .MuiButtonBase-root": {
52
- margin: '6px',
53
- borderRadius: '8px',
54
- padding: '6px 14px',
55
- fontSize: '14px',
56
- fontWeight: '400',
57
- color: theme?.palette?.editor?.deletePopUpButtonTextColor,
58
- "&:hover": {
59
- background: `${theme?.palette?.editor?.menuOptionHoverBackground} !important`
60
- },
61
- "@media only screen and (max-width: 599px)": {
62
- minHeight: '30px',
63
- margin: '0px 6px'
64
- }
65
- },
66
40
  "& .Mui-selected": {
67
- backgroundColor: 'unset !important'
41
+ backgroundColor: "rgba(0, 0, 0, 0.04) !important"
68
42
  }
69
43
  }
70
44
  });
@@ -3,15 +3,11 @@ import { useSlateStatic } from "slate-react";
3
3
  import { MenuItem, Select } from "@mui/material";
4
4
  import { insertVariables } from "../../utils/variables";
5
5
  import VariableStyles from "./Style";
6
- import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
7
- import { useEditorContext } from "../../hooks/useMouseMove";
6
+ import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
8
7
  import { jsx as _jsx } from "react/jsx-runtime";
9
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
9
  const VariableButton = props => {
11
- const {
12
- theme
13
- } = useEditorContext();
14
- const classes = VariableStyles(theme);
10
+ const classes = VariableStyles();
15
11
  const editor = useSlateStatic();
16
12
  const {
17
13
  options
@@ -28,14 +24,13 @@ const VariableButton = props => {
28
24
  value: "",
29
25
  sx: classes.variableBtn,
30
26
  onChange: updateVariable,
31
- IconComponent: () => /*#__PURE__*/_jsx(KeyboardArrowDownRoundedIcon, {}),
27
+ IconComponent: () => /*#__PURE__*/_jsx(KeyboardArrowDownIcon, {}),
32
28
  MenuProps: {
33
29
  sx: classes.variableMenuItem,
34
30
  PaperProps: {
35
31
  style: {
36
32
  maxHeight: 300,
37
- overflowY: "auto",
38
- transformOrigin: 'top left'
33
+ overflowY: "auto"
39
34
  },
40
35
  sx: {
41
36
  "&::-webkit-scrollbar-track": {
@@ -45,14 +40,6 @@ const VariableButton = props => {
45
40
  borderRadius: "16px"
46
41
  }
47
42
  }
48
- },
49
- anchorOrigin: {
50
- vertical: 'bottom',
51
- horizontal: 'right'
52
- },
53
- transformOrigin: {
54
- vertical: 'top',
55
- horizontal: 'right'
56
43
  }
57
44
  },
58
45
  children: [/*#__PURE__*/_jsx(MenuItem, {