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