@flozy/editor 5.4.2 → 5.4.3

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 (192) hide show
  1. package/dist/Editor/ChatEditor.js +34 -25
  2. package/dist/Editor/CommonEditor.js +15 -29
  3. package/dist/Editor/Editor.css +18 -100
  4. package/dist/Editor/Elements/AI/AIInput.js +1 -0
  5. package/dist/Editor/Elements/AI/CustomSelect.js +11 -19
  6. package/dist/Editor/Elements/AI/PopoverAIInput.js +52 -58
  7. package/dist/Editor/Elements/AI/Styles.js +6 -24
  8. package/dist/Editor/Elements/Accordion/Accordion.js +1 -8
  9. package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
  10. package/dist/Editor/Elements/Button/EditorButton.js +2 -9
  11. package/dist/Editor/Elements/Carousel/CarouselItem.js +3 -11
  12. package/dist/Editor/Elements/Color Picker/ColorButtons.js +5 -7
  13. package/dist/Editor/Elements/Color Picker/Styles.js +3 -7
  14. package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
  15. package/dist/Editor/Elements/Divider/Divider.js +20 -36
  16. package/dist/Editor/Elements/Embed/Image.js +16 -51
  17. package/dist/Editor/Elements/Embed/Video.js +3 -26
  18. package/dist/Editor/Elements/Form/Form.js +2 -39
  19. package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +1 -7
  20. package/dist/Editor/Elements/Form/FormElements/FormDate.js +1 -7
  21. package/dist/Editor/Elements/Form/FormElements/FormEmail.js +1 -7
  22. package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +1 -7
  23. package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +1 -7
  24. package/dist/Editor/Elements/Form/FormElements/FormText.js +1 -7
  25. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +1 -6
  26. package/dist/Editor/Elements/Form/FormPopup.js +9 -12
  27. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
  28. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -20
  29. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
  30. package/dist/Editor/Elements/FreeGrid/styles.js +1 -2
  31. package/dist/Editor/Elements/Grid/GridButton.js +2 -2
  32. package/dist/Editor/Elements/Grid/GridItem.js +36 -47
  33. package/dist/Editor/Elements/Grid/Styles.js +0 -50
  34. package/dist/Editor/Elements/Link/LinkButton.js +1 -1
  35. package/dist/Editor/Elements/List/CheckList.js +1 -2
  36. package/dist/Editor/Elements/Search/SearchAttachment.js +0 -1
  37. package/dist/Editor/Elements/Search/SearchButton.js +0 -1
  38. package/dist/Editor/Elements/Signature/Signature.css +1 -1
  39. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -2
  40. package/dist/Editor/Elements/Signature/SignaturePopup.js +52 -17
  41. package/dist/Editor/Elements/SimpleText/index.js +1 -8
  42. package/dist/Editor/Elements/SimpleText/style.js +1 -20
  43. package/dist/Editor/Elements/Table/Styles.js +79 -82
  44. package/dist/Editor/Elements/Table/Table.js +140 -258
  45. package/dist/Editor/Elements/Table/TableCell.js +111 -365
  46. package/dist/Editor/Elements/Table/TablePopup.js +3 -9
  47. package/dist/Editor/Elements/Table/TableRow.js +2 -10
  48. package/dist/Editor/Elements/TopBanner/TopBanner.js +1 -2
  49. package/dist/Editor/MiniEditor.js +1 -15
  50. package/dist/Editor/Styles/EditorStyles.js +4 -13
  51. package/dist/Editor/Toolbar/FormatTools/BlockButton.js +0 -10
  52. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +12 -7
  53. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -26
  54. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +0 -3
  55. package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -5
  56. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +6 -3
  57. package/dist/Editor/Toolbar/Mini/Styles.js +1 -4
  58. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/InfinityAITool.js +3 -7
  59. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -6
  60. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +15 -19
  61. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +57 -555
  62. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +16 -73
  63. package/dist/Editor/Toolbar/PopupTool/index.js +5 -3
  64. package/dist/Editor/Toolbar/Toolbar.js +0 -6
  65. package/dist/Editor/Toolbar/toolbarGroups.js +0 -4
  66. package/dist/Editor/assets/svg/BrainIcon.js +2 -2
  67. package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
  68. package/dist/Editor/common/ColorPickerButton.js +45 -85
  69. package/dist/Editor/common/DnD/Draggable.js +1 -2
  70. package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
  71. package/dist/Editor/common/Icon.js +20 -23
  72. package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -2
  73. package/dist/Editor/common/ImageSelector/Styles.js +6 -47
  74. package/dist/Editor/common/ImageSelector/UploadStyles.js +6 -18
  75. package/dist/Editor/common/LinkSettings/NavComponents.js +1 -2
  76. package/dist/Editor/common/LinkSettings/index.js +1 -2
  77. package/dist/Editor/common/MentionsPopup/Styles.js +8 -143
  78. package/dist/Editor/common/MentionsPopup/index.js +1 -1
  79. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +12 -108
  80. package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
  81. package/dist/Editor/common/RnD/ShadowElement.js +1 -1
  82. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -14
  83. package/dist/Editor/common/RnD/Utils/gridDropItem.js +6 -9
  84. package/dist/Editor/common/RnD/VirtualElement/index.js +1 -5
  85. package/dist/Editor/common/RnD/index.js +2 -3
  86. package/dist/Editor/common/Section/index.js +3 -3
  87. package/dist/Editor/common/Section/styles.js +1 -5
  88. package/dist/Editor/common/Shorthands/elements.js +1 -13
  89. package/dist/Editor/common/StyleBuilder/fieldStyle.js +1 -2
  90. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +3 -9
  91. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +7 -35
  92. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +2 -15
  93. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
  94. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +1 -2
  95. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +1 -1
  96. package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +0 -2
  97. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
  98. package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +11 -11
  99. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +6 -22
  100. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +2 -21
  101. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -20
  102. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +2 -12
  103. package/dist/Editor/common/StyleBuilder/formStyle.js +149 -268
  104. package/dist/Editor/common/StyleBuilder/index.js +20 -101
  105. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +0 -4
  106. package/dist/Editor/common/StyleBuilder/tableStyle.js +25 -69
  107. package/dist/Editor/common/SwipeableDrawer/style.js +4 -15
  108. package/dist/Editor/common/ToolbarIcon.js +1 -1
  109. package/dist/Editor/common/Uploader.js +36 -46
  110. package/dist/Editor/common/iconListV2.js +60 -616
  111. package/dist/Editor/common/iconslist.js +17 -23
  112. package/dist/Editor/commonStyle.js +11 -417
  113. package/dist/Editor/helper/deserialize/index.js +3 -4
  114. package/dist/Editor/helper/index.js +4 -17
  115. package/dist/Editor/helper/theme.js +1 -24
  116. package/dist/Editor/hooks/useMouseMove.js +2 -5
  117. package/dist/Editor/plugins/withCustomDeleteBackward.js +4 -36
  118. package/dist/Editor/plugins/withEmbeds.js +26 -30
  119. package/dist/Editor/plugins/withHTML.js +10 -61
  120. package/dist/Editor/plugins/withLayout.js +0 -1
  121. package/dist/Editor/utils/SlateUtilityFunctions.js +12 -39
  122. package/dist/Editor/utils/brains.js +1 -1
  123. package/dist/Editor/utils/button.js +4 -4
  124. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +1 -26
  125. package/dist/Editor/utils/customHooks/useResize.js +4 -7
  126. package/dist/Editor/utils/customHooks/useTableResize.js +2 -6
  127. package/dist/Editor/utils/embed.js +1 -2
  128. package/dist/Editor/utils/events.js +1 -0
  129. package/dist/Editor/utils/font.js +4 -11
  130. package/dist/Editor/utils/formfield.js +4 -8
  131. package/dist/Editor/utils/helper.js +2 -103
  132. package/dist/Editor/utils/insertNewLine.js +1 -19
  133. package/dist/Editor/utils/pageSettings.js +2 -14
  134. package/dist/Editor/utils/serializeToText.js +0 -2
  135. package/dist/Editor/utils/table.js +24 -228
  136. package/package.json +2 -2
  137. package/dist/Editor/Elements/DataView/DataView.js +0 -124
  138. package/dist/Editor/Elements/DataView/DataViewButton.js +0 -23
  139. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +0 -67
  140. package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +0 -33
  141. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +0 -162
  142. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +0 -40
  143. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +0 -67
  144. package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +0 -35
  145. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +0 -39
  146. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +0 -30
  147. package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +0 -30
  148. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +0 -35
  149. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +0 -36
  150. package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +0 -17
  151. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +0 -29
  152. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +0 -38
  153. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +0 -74
  154. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +0 -64
  155. package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +0 -106
  156. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +0 -174
  157. package/dist/Editor/Elements/DataView/Layouts/Formula.js +0 -29
  158. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +0 -113
  159. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +0 -37
  160. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +0 -111
  161. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +0 -60
  162. package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +0 -36
  163. package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +0 -101
  164. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +0 -160
  165. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +0 -190
  166. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +0 -42
  167. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +0 -30
  168. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +0 -110
  169. package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +0 -179
  170. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +0 -112
  171. package/dist/Editor/Elements/DataView/Layouts/TableView.js +0 -227
  172. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +0 -80
  173. package/dist/Editor/Elements/DataView/Layouts/colStyles.js +0 -10
  174. package/dist/Editor/Elements/DataView/Layouts/index.js +0 -25
  175. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +0 -281
  176. package/dist/Editor/Elements/DataView/Utils/globalSearch.js +0 -15
  177. package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +0 -74
  178. package/dist/Editor/Elements/DataView/styles.js +0 -154
  179. package/dist/Editor/Elements/Table/AddRowCol.js +0 -77
  180. package/dist/Editor/Elements/Table/DragButton.js +0 -142
  181. package/dist/Editor/Elements/Table/DragStyles.js +0 -70
  182. package/dist/Editor/Elements/Table/Draggable.js +0 -25
  183. package/dist/Editor/Elements/Table/Droppable.js +0 -53
  184. package/dist/Editor/Elements/Table/TableTool.js +0 -101
  185. package/dist/Editor/Elements/Table/tableHelper.js +0 -71
  186. package/dist/Editor/assets/svg/TableIcons.js +0 -220
  187. package/dist/Editor/common/Select/index.js +0 -20
  188. package/dist/Editor/common/Select/styles.js +0 -17
  189. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
  190. package/dist/Editor/helper/enforceDateFormat.js +0 -41
  191. package/dist/Editor/hooks/useTable.js +0 -210
  192. package/dist/Editor/utils/dataView.js +0 -43
@@ -1,17 +1,12 @@
1
- import React, { useState, useEffect, useMemo } from "react";
2
- import { Editor, Path, Transforms } from "slate";
3
- import { Box } from "@mui/material";
1
+ import React, { useState, useEffect } from "react";
2
+ import { Editor, Element, Transforms } from "slate";
3
+ import { Box, MenuItem, Popper, Typography } 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
- import { useEditorContext, useEditorSelection } from "../../hooks/useMouseMove";
9
- import useTable, { getDefaultTableSelection } from "../../hooks/useTable";
10
- import DragButton from "./DragButton";
11
- import TablePopup from "./TablePopup";
12
- import { Droppable } from "./Droppable";
13
- import { useDndContext } from "@dnd-kit/core";
14
- import { getNodeWithType } from "../../utils/helper";
8
+ import { useEditorSelection } from "../../hooks/useMouseMove";
9
+ import useClickOutside from "../../hooks/useClickOutside";
15
10
  import { jsx as _jsx } from "react/jsx-runtime";
16
11
  import { Fragment as _Fragment } from "react/jsx-runtime";
17
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -33,14 +28,9 @@ const Resizer = ({
33
28
  })
34
29
  });
35
30
  };
36
- const isCellEditable = (startCellPath, path) => {
37
- return startCellPath?.length && startCellPath?.toString() === path?.toString();
38
- };
39
31
  const TableCell = props => {
40
- const {
41
- theme
42
- } = useEditorContext();
43
- const classes = TableStyles(theme);
32
+ const themeType = localStorage.getItem("themeType");
33
+ const classes = TableStyles(themeType);
44
34
  const {
45
35
  element,
46
36
  attributes,
@@ -54,65 +44,69 @@ const TableCell = props => {
54
44
  bgColor,
55
45
  borderColor,
56
46
  entireBgColor,
57
- entireBorderColor,
58
- entireTextColor,
59
- entireFontFamily,
60
- entireFontWeight,
61
- entireTextSize,
62
- size: elementSize
47
+ entireBorderColor
63
48
  } = element;
64
49
  const [parentDOM, setParentDOM] = useState(null);
65
50
  const editor = useSlateStatic();
66
51
  const [showTool] = useEditorSelection(editor);
67
- const {
68
- hoverPath,
69
- setHoverPath,
70
- getSelectedCells,
71
- updateTableSelection,
72
- tableSelection,
73
- tableResizing,
74
- setTableResizing,
75
- otherProps
76
- } = useTable();
77
- const {
78
- active,
79
- over
80
- } = useDndContext();
81
- const currentDraggingType = active?.data?.current?.dragType;
82
- const {
83
- dragRowBtnCls
84
- } = otherProps || {};
85
- const {
86
- startCellPath
87
- } = tableSelection;
88
52
  const path = ReactEditor.findPath(editor, element);
89
53
  const isHeader = path.length >= 2 ? path[path.length - 2] === 0 : false;
90
54
  const [size, onMouseDown, resizing, onLoad] = useTableResize({
91
55
  parentDOM,
92
- size: element?.size,
93
- minMaxProps: {
94
- minWidth: 30
95
- }
56
+ size: element?.size
96
57
  });
97
58
  const [tableSize, setTableSize] = useState({});
98
- const [openSettings, setOpenSettings] = useState(false);
99
59
  const table = new TableUtil(editor);
100
60
  const tableProps = table.getTableProps();
101
- const [tableNode] = getNodeWithType(editor, "table", path); // getting cannot find the descendant path error, while deleting table because of unknown re-render issue, so wrapping it with try catch
102
- const [rowNode] = getNodeWithType(editor, "table-row", path);
103
- const currentPath = path.slice(-2) || []; // getting last 2 items from path, which gives row and column position of the cell
104
- const [row, column] = currentPath;
105
- const isFirstRow = row === 0;
106
- const isFirstColumn = column === 0;
107
- const [hoverRow, hoverCol] = hoverPath ? hoverPath.slice(-2) : [];
108
- const showColDrag = isFirstRow && hoverCol === column && !resizing && !readOnly;
109
- const showRowDrag = isFirstColumn && hoverRow === row && !resizing && !readOnly;
61
+ const [tableNode] = Editor.nodes(editor, {
62
+ at: path,
63
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
64
+ });
65
+ const [rowNode] = Editor.nodes(editor, {
66
+ at: path,
67
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-row"
68
+ });
110
69
  const [parentProps] = tableNode || [{}];
111
70
  const [rowProps] = rowNode || [{}];
112
71
  const tableDOM = table.getDOMNode(path, true);
113
- const isCellSelected = getSelectedCells();
72
+ const isCellSelected = table.isCellSelected(editor.selection);
114
73
  const hasSelected = (isCellSelected || [])?.findIndex(f => f.join(",") === path.join(",")) > -1;
115
- const containerEle = tableDOM?.parentNode?.parentNode;
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];
116
110
  useEffect(() => {
117
111
  if (tableDOM) {
118
112
  const {
@@ -122,329 +116,81 @@ const TableCell = props => {
122
116
  const {
123
117
  width: parentWidth
124
118
  } = tableDOM?.parentNode?.parentNode?.getBoundingClientRect();
125
- const cellWidth = element?.size?.width;
126
- const columns = tableNode?.[0]?.columns;
127
- const oldTableWidth = parentWidth / columns - 4;
119
+ const {
120
+ styleProps
121
+ } = tableProps || {};
122
+ const columns = styleProps ? styleProps["table.columns"] : 2;
128
123
  setTableSize({
129
124
  width,
130
125
  height,
131
126
  parentWidth,
132
- cellWidth: cellWidth || oldTableWidth
127
+ cellWidth: parentWidth / columns
133
128
  });
134
129
  }
135
- }, [tableDOM]);
130
+ }, [tableDOM, anchorEl]);
136
131
  useEffect(() => {
137
132
  if (editor && element && tableSize) {
138
133
  const dom = ReactEditor.toDOMNode(editor, element);
139
134
  setParentDOM(dom);
140
- const width = tableSize?.cellWidth;
141
- const size = element?.size ? {
142
- ...element?.size,
143
- width
144
- } : {
145
- width,
135
+ onLoad(element?.size || {
136
+ width: tableSize?.cellWidth,
146
137
  height: 100
147
- };
148
- onLoad(size);
138
+ });
149
139
  }
150
- }, [tableSize]);
151
- const resetSelection = () => {
152
- Transforms.deselect(editor);
153
- updateTableSelection(getDefaultTableSelection());
154
- };
140
+ }, [tableSize, anchorEl]);
155
141
  useEffect(() => {
156
- const currentPath = path?.toString();
157
- setTimeout(() => {
158
- if (tableResizing === currentPath) {
159
- setTableResizing(null);
160
-
161
- // reset selection after resizing
162
- resetSelection();
163
- }
164
- }, 200);
165
- if (!resizing && tableResizing) {
166
- table.resizeTableCell({
142
+ if (!resizing && tableProps) {
143
+ table.updateTableStyle({
167
144
  "col.size": size
168
- }, path);
169
- }
170
- if (resizing) {
171
- setTableResizing(currentPath);
172
- }
173
- }, [resizing]);
174
- const onMouseEnter = path => {
175
- setHoverPath(path);
176
- if (tableSelection?.isDragging) {
177
- updateTableSelection({
178
- endCellPath: path
179
- });
180
- const isSelectingOneCellToAnotherCell = startCellPath?.length && !Path.equals(path, startCellPath);
181
- if (isSelectingOneCellToAnotherCell) {
182
- Transforms.deselect(editor);
183
- }
184
- }
185
- };
186
- const onMouseLeave = () => {
187
- setHoverPath(null);
188
- };
189
- const onMouseDownInCell = e => {
190
- if (
191
- // for shift selection
192
- e.shiftKey && startCellPath?.length && startCellPath.toString() !== path.toString()) {
193
- updateTableSelection({
194
- endCellPath: path
195
- });
196
- } else {
197
- updateTableSelection({
198
- startCellPath: path,
199
- endCellPath: [],
200
- isDragging: true
201
- });
202
- }
203
- };
204
- const onMouseUp = () => {
205
- if (startCellPath?.length) {
206
- updateTableSelection({
207
- endCellPath: path,
208
- isDragging: false
209
- });
145
+ }, tableProps);
210
146
  }
211
- };
212
- const onClick = () => {
213
- const currentEditorSelection = editor?.selection?.focus?.path || [];
214
- const selectionPath = currentEditorSelection?.slice(0, -2);
215
- const isCellSelected = selectionPath?.length && Path.equals(selectionPath, path);
216
- if (!isCellSelected) {
217
- // after mousedown event, onclick is triggered, while onclick, dragging should be disabled and focus should be on that clicked cell to edit the contents inside it.
218
- updateTableSelection({
219
- isDragging: false
220
- });
221
- }
222
- };
223
- const cellId = "table-cell" + path.toString();
224
- const cellRef = document.getElementById(cellId);
225
- const contentEditable = !readOnly && isCellEditable(startCellPath, path);
226
- const commonTdProps = useMemo(() => {
227
- const props = {
228
- id: cellId
229
- };
230
-
231
- // if (!contentEditable) {
232
- // props.contentEditable = false;
233
- // }
234
-
235
- return props;
236
- }, [contentEditable, cellId]);
237
- const handleTouchMove = e => {
238
- const touch = e.touches[0]; // Get the current touch point
239
- const element = document.elementFromPoint(touch.clientX, touch.clientY);
240
- if (element && element.dataset.cell) {
241
- const elementPath = element.dataset.cell.split(",").map(Number);
242
- onMouseEnter(elementPath);
243
- }
244
- };
245
- const handleTouchEnd = () => {
246
- updateTableSelection({
247
- isDragging: false
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))
248
169
  });
249
170
  };
250
- const tbProps = tableResizing || resizing || over || readOnly ? {
251
- ...commonTdProps,
252
- contentEditable: false
253
- } : {
254
- ...commonTdProps,
255
- onMouseEnter: () => onMouseEnter(path),
256
- onMouseLeave,
257
- onMouseDown: onMouseDownInCell,
258
- onMouseUp,
259
- onClick,
260
- // mobile events for selection
261
- onTouchStart: onMouseDownInCell,
262
- onTouchMove: handleTouchMove,
263
- onTouchEnd: handleTouchEnd
264
- };
265
- const dndProps = {
266
- id: cellId,
267
- data: {
268
- path
269
- }
270
- };
271
- const isCellDragging = active?.id && active?.id === cellId;
272
- const isRowDragging = isCellDragging && currentDraggingType === "row";
273
- const isColDragging = isCellDragging && currentDraggingType === "col";
274
- const width = isHeader ? size?.width || tableSize?.cellWidth || elementSize?.width : "0px";
275
- const sizeProps = {
276
- minWidth: width,
277
- maxWidth: width
278
- };
171
+ const sizeProps = isHeader ? {
172
+ width: size?.width || tableSize?.cellWidth
173
+ } : {};
279
174
  const cellBorderColor = borderColor || rowProps?.borderColor || parentProps?.borderColor || entireBorderColor;
280
- const selectCurrentCell = () => {
281
- const cellPath = Editor.start(editor, path);
282
- const selection = {
283
- anchor: cellPath,
284
- focus: cellPath
285
- };
286
-
287
- // select the cell to insert/delete/duplicate/clear
288
- Transforms.select(editor, selection);
289
- };
290
- const onRowDrag = () => {
291
- const {
292
- children
293
- } = rowNode[0] || {};
294
- const rowPath = rowNode[1] || [];
295
- const rowStartCell = [...rowPath, 0];
296
- const rowEndCell = [...rowPath, children?.length - 1];
297
- updateTableSelection({
298
- startCellPath: rowStartCell,
299
- endCellPath: rowEndCell,
300
- isDragging: false
301
- });
302
- selectCurrentCell();
303
- };
304
- const onColDrag = () => {
305
- const [tableData, tablePath] = tableNode;
306
- const {
307
- rows
308
- } = tableData;
309
- const startColCell = [...tablePath, 0, column];
310
- const endColCell = [...tablePath, rows - 1, column];
311
- updateTableSelection({
312
- startCellPath: startColCell,
313
- endCellPath: endColCell,
314
- isDragging: false
315
- });
316
- selectCurrentCell();
317
- };
318
- const handleToolAction = (value, option, dragType) => {
319
- const isRowDrag = dragType === "row";
320
- switch (value) {
321
- case "insertAbove":
322
- table.insertRow("at");
323
- break;
324
- case "insertBelow":
325
- table.insertRow("after");
326
- break;
327
- case "delete":
328
- const deleteFn = isRowDrag ? table.deleteRow : table.deleteColumn;
329
- deleteFn();
330
- setTimeout(() => resetSelection(), 200); // throws cannot find the descendant path error because of deletion
331
- break;
332
- case "duplicate":
333
- if (isRowDrag) {
334
- table.insertRow("duplicate");
335
- } else {
336
- table.duplicateColumn();
337
- }
338
- break;
339
- case "clear":
340
- if (isRowDrag) {
341
- table.clearRow();
342
- } else {
343
- table.clearColumn();
344
- }
345
- break;
346
- case "insertRight":
347
- table.insertColumn("after");
348
- break;
349
- case "insertLeft":
350
- table.insertColumn("at");
351
- break;
352
- case "color":
353
- setOpenSettings(dragType);
354
- break;
355
- default:
356
- return;
357
- }
358
- const omitValues = ["color", "delete"];
359
- if (!omitValues.includes(value)) {
360
- resetSelection();
361
- }
362
- };
363
- const onClose = () => {
364
- setOpenSettings(false);
365
- };
366
- const onSave = data => {
367
- const updateData = {
368
- ...data
369
- };
370
- delete updateData.children;
371
- delete updateData.type;
372
- table.updateTableStyle(updateData, {
373
- ...tableProps
374
- });
375
- onClose();
376
- };
377
- const commonDragBtnProps = {
378
- anchorEl: cellRef,
379
- handleToolAction,
380
- customProps,
381
- dndProps,
382
- resetSelection
383
- };
384
- const showRowDragBtn = (showRowDrag || isRowDragging) && containerEle?.scrollLeft <= 0;
385
- return /*#__PURE__*/_jsxs(_Fragment, {
386
- children: [/*#__PURE__*/_jsxs("td", {
387
- ...element.attr,
388
- ...attributes,
389
- className: `editor-table-cell ${hasSelected ? "selection" : ""}`,
390
- style: {
391
- position: "relative",
392
- background: bgColor || entireBgColor,
393
- border: cellBorderColor ? `3px solid ${cellBorderColor}` : "1px solid #E0E0E0",
394
- fontFamily: entireFontFamily || "inherit",
395
- fontWeight: entireFontWeight || "inherit",
396
- fontSize: entireTextSize || "inherit",
397
- color: entireTextColor || "inherit",
398
- cursor: "text",
399
- verticalAlign: "top",
400
- padding: "0px",
401
- ...(sizeProps || {})
402
- },
403
- ...tbProps,
404
- "data-cell": path.toString(),
405
- children: [isFirstRow && currentDraggingType === "col" ? /*#__PURE__*/_jsx(Droppable, {
406
- ...dndProps,
407
- dragType: currentDraggingType,
408
- tableDOM: tableDOM
409
- }) : null, isFirstColumn && currentDraggingType === "row" ? /*#__PURE__*/_jsx(Droppable, {
410
- ...dndProps,
411
- dragType: currentDraggingType,
412
- tableDOM: tableDOM
413
- }) : null, /*#__PURE__*/_jsx("div", {
414
- style: {
415
- overflow: "auto hidden",
416
- padding: "8px"
417
- },
418
- children: children
419
- }), isHeader && !readOnly && tableSize?.height && !showTool ? /*#__PURE__*/_jsx(Resizer, {
420
- classes: classes,
421
- onMouseDown: onMouseDown,
422
- height: tableDOM?.getBoundingClientRect()?.height
423
- }) : null, hasSelected && !readOnly && !tableResizing ? /*#__PURE__*/_jsx("div", {
424
- className: "selection-area-tc",
425
- contentEditable: false
426
- }) : null, /*#__PURE__*/_jsx(DragButton, {
427
- ...commonDragBtnProps,
428
- placement: "top",
429
- dragType: "col",
430
- onDrag: onColDrag,
431
- hideDelete: rowProps?.children?.length <= 1,
432
- show: showColDrag || isColDragging
433
- }), /*#__PURE__*/_jsx(DragButton, {
434
- ...commonDragBtnProps,
435
- dragType: "row",
436
- onDrag: onRowDrag,
437
- hideDelete: parentProps?.children?.length <= 1,
438
- className: dragRowBtnCls,
439
- show: showRowDragBtn
440
- })]
441
- }), openSettings ? /*#__PURE__*/_jsx(TablePopup, {
442
- element: tableProps?.styleProps || {},
443
- customProps: customProps,
444
- onSave: onSave,
445
- onClose: onClose,
446
- styleType: openSettings
447
- }) : null]
175
+ return /*#__PURE__*/_jsxs("td", {
176
+ ...element.attr,
177
+ ...attributes,
178
+ className: `editor-table-cell ${hasSelected ? "selection" : ""}`,
179
+ style: {
180
+ position: "relative",
181
+ background: bgColor || entireBgColor,
182
+ border: cellBorderColor ? `3px solid ${cellBorderColor}` : "",
183
+ ...(sizeProps || {})
184
+ },
185
+ onContextMenu: onRightClick,
186
+ children: [children, isHeader && !readOnly && tableSize?.height && !showTool ? /*#__PURE__*/_jsx(Resizer, {
187
+ classes: classes,
188
+ onMouseDown: onMouseDown,
189
+ height: tableDOM.getBoundingClientRect()?.height
190
+ }) : null, hasSelected && !readOnly ? /*#__PURE__*/_jsx("div", {
191
+ className: "selection-area-tc",
192
+ contentEditable: false
193
+ }) : null, poperForDeltion()]
448
194
  });
449
195
  };
450
196
  export default TableCell;
@@ -1,27 +1,21 @@
1
1
  import React from "react";
2
2
  import StyleBuilder from "../../common/StyleBuilder";
3
- import tableStyle, { tableColumnStyle, tableRowStyle } from "../../common/StyleBuilder/tableStyle";
3
+ import tableStyle from "../../common/StyleBuilder/tableStyle";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
- const STYLE_TYPES = {
6
- row: tableRowStyle,
7
- col: tableColumnStyle
8
- };
9
5
  const TablePopup = props => {
10
6
  const {
11
7
  element,
12
8
  onSave,
13
9
  onClose,
14
- customProps,
15
- styleType
10
+ customProps
16
11
  } = props;
17
- const styles = STYLE_TYPES[styleType] || tableStyle;
18
12
  return /*#__PURE__*/_jsx(StyleBuilder, {
19
13
  title: "Table",
20
14
  type: "gridStyle",
21
15
  element: element,
22
16
  onSave: onSave,
23
17
  onClose: onClose,
24
- renderTabs: styles,
18
+ renderTabs: tableStyle,
25
19
  customProps: customProps
26
20
  });
27
21
  };
@@ -10,11 +10,7 @@ const TableRow = props => {
10
10
  } = props;
11
11
  const {
12
12
  bgColor,
13
- borderColor,
14
- fontFamily,
15
- fontWeight,
16
- textSize,
17
- textColor
13
+ borderColor
18
14
  } = element;
19
15
  const editor = useSlateStatic();
20
16
  const path = ReactEditor.findPath(editor, element);
@@ -28,11 +24,7 @@ const TableRow = props => {
28
24
  ...attributes,
29
25
  style: {
30
26
  backgroundColor: bgColor,
31
- border: rowBorderColor ? `1px solid ${rowBorderColor}` : "",
32
- fontFamily,
33
- fontWeight,
34
- fontSize: textSize,
35
- color: textColor
27
+ border: rowBorderColor ? `1px solid ${rowBorderColor}` : ""
36
28
  },
37
29
  children: children
38
30
  });
@@ -77,7 +77,6 @@ const TopBanner = props => {
77
77
  theme
78
78
  } = useEditorContext();
79
79
  const classes = TopBannerStyles(theme);
80
- const renderHeaderAboveBanner = customProps?.metadata?.renderHeader ? customProps.metadata.renderHeader() : null;
81
80
  return /*#__PURE__*/_jsxs(Box, {
82
81
  component: "div",
83
82
  ...attributes,
@@ -88,7 +87,7 @@ const TopBanner = props => {
88
87
  },
89
88
  contentEditable: false,
90
89
  sx: classes.root,
91
- children: [renderHeaderAboveBanner, /*#__PURE__*/_jsx("img", {
90
+ children: [/*#__PURE__*/_jsx("img", {
92
91
  src: url,
93
92
  alt: "Top Banner",
94
93
  className: "top-banner-wrpr-ele",
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useRef, useState, useEffect } from "react";
2
- import { createEditor, Range } from "slate";
2
+ import { createEditor } from "slate";
3
3
  import { Slate, Editable } from "slate-react";
4
4
  import { useDebounce } from "use-debounce";
5
5
  import { getBlock, getMarked } from "./utils/SlateUtilityFunctions";
@@ -115,20 +115,6 @@ const MiniEditor = props => {
115
115
  event,
116
116
  editor
117
117
  });
118
- } else if (event.key === "Backspace") {
119
- const {
120
- selection
121
- } = editor;
122
- event.preventDefault();
123
- if (selection) {
124
- if (!Range.isCollapsed(selection)) {
125
- editor.deleteFragment();
126
- } else {
127
- editor.deleteBackward({
128
- unit: "character"
129
- });
130
- }
131
- }
132
118
  }
133
119
  }, [chars, editor, target, mentions, setMentions, search, type, mentionsRef]);
134
120
  const renderElement = useCallback(props => {
@@ -129,8 +129,7 @@ const editorStyles = ({
129
129
  }
130
130
  },
131
131
  "& .accordion-summary-collapse-btn": {
132
- padding: "4px",
133
- width: '5px'
132
+ padding: "4px"
134
133
  },
135
134
  "& .workflow-icon-btn": {
136
135
  pointerEvents: "none",
@@ -239,7 +238,6 @@ const editorStyles = ({
239
238
  }
240
239
  },
241
240
  "& .section-tw": {
242
- background: 'transparent !important',
243
241
  "& button": {
244
242
  padding: "2px",
245
243
  borderRadius: "0px",
@@ -288,21 +286,14 @@ const editorStyles = ({
288
286
  }
289
287
  },
290
288
  "& ::selection": {
291
- background: 'rgba(35, 131, 226, 0.35)!important',
292
- color: 'inherit'
293
- },
294
- "&.readOnlyContainer": {
295
- "& .max-content": {
296
- paddingBottom: "0px !important"
297
- }
289
+ color: "inherit",
290
+ background: "#EAEBFE"
298
291
  }
299
292
  },
300
293
  fullScreenWrapper: {
301
- "& .editor-wrapper": {
302
- paddingTop: '20px'
303
- },
304
294
  "& .MuiPaper-root": {
305
295
  borderRadius: "0px !important",
296
+ paddingTop: "20px",
306
297
  "& .MuiDialogTitle-root": {
307
298
  position: "absolute",
308
299
  top: 0,