@flozy/editor 5.1.2 → 5.1.4

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