@flozy/editor 5.0.1 → 5.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/Editor.css +1 -15
- package/dist/Editor/Elements/Carousel/Carousel.js +2 -1
- package/dist/Editor/Elements/Carousel/slick.min.css +1 -1
- package/dist/Editor/Elements/Search/SearchButton.js +2 -10
- package/dist/Editor/Elements/Table/TableCell.js +4 -5
- package/dist/Editor/Elements/TopBanner/Styles.js +18 -12
- package/dist/Editor/Elements/TopBanner/TopBanner.js +15 -6
- package/dist/Editor/Toolbar/FormatTools/BlockButton.js +3 -0
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +3 -0
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +48 -45
- package/dist/Editor/Toolbar/PopupTool/index.js +10 -4
- package/dist/Editor/common/Icon.js +5 -1
- package/dist/Editor/common/MentionsPopup/Styles.js +3 -2
- package/dist/Editor/common/iconListV2.js +40 -41
- package/dist/Editor/common/iconslist.js +2 -3
- package/dist/Editor/helper/deserialize/index.js +4 -1
- package/dist/Editor/helper/index.js +37 -1
- package/dist/Editor/hooks/useTable.js +5 -4
- package/dist/Editor/utils/table.js +34 -13
- package/package.json +1 -1
package/dist/Editor/Editor.css
CHANGED
@@ -622,21 +622,7 @@ blockquote {
|
|
622
622
|
}
|
623
623
|
|
624
624
|
.MuiIconButton-root.btnActive {
|
625
|
-
|
626
|
-
stroke: #2563EB;
|
627
|
-
}
|
628
|
-
|
629
|
-
svg text,
|
630
|
-
svg circle,
|
631
|
-
.fill-svg,
|
632
|
-
.fill-path,
|
633
|
-
.fill-path path {
|
634
|
-
fill: #2563EB;
|
635
|
-
}
|
636
|
-
|
637
|
-
path.fill-path {
|
638
|
-
stroke: none;
|
639
|
-
}
|
625
|
+
color: #2563EB !important;
|
640
626
|
}
|
641
627
|
|
642
628
|
.embed .element-toolbar {
|
@@ -121,7 +121,7 @@ const Carousel = props => {
|
|
121
121
|
};
|
122
122
|
return /*#__PURE__*/_jsxs("div", {
|
123
123
|
...attributes,
|
124
|
-
className:
|
124
|
+
className: `sliderBg ${edit ? "carousel_slider_edit" : ""}`,
|
125
125
|
style: {
|
126
126
|
backgroundColor: "transparent",
|
127
127
|
position: "relative"
|
@@ -136,6 +136,7 @@ const Carousel = props => {
|
|
136
136
|
style: {
|
137
137
|
padding: "12px"
|
138
138
|
},
|
139
|
+
contentEditable: false,
|
139
140
|
children: /*#__PURE__*/_jsx(Slider, {
|
140
141
|
...settings,
|
141
142
|
children: children.map((m, i) => {
|
@@ -13,9 +13,9 @@
|
|
13
13
|
-webkit-user-select: none;
|
14
14
|
-moz-user-select: none;
|
15
15
|
-ms-user-select: none;
|
16
|
-
user-select: none;
|
17
16
|
-webkit-touch-callout: none;
|
18
17
|
-khtml-user-select: none;
|
18
|
+
user-select: none;
|
19
19
|
-ms-touch-action: pan-y;
|
20
20
|
touch-action: pan-y;
|
21
21
|
-webkit-tap-highlight-color: transparent;
|
@@ -7,7 +7,7 @@ import SwipeableDrawerComponent from "../../common/SwipeableDrawer";
|
|
7
7
|
import SearchAndDocList from "./SearchList";
|
8
8
|
import { insertBrain } from "../../utils/brains";
|
9
9
|
import { useDebounce } from "use-debounce";
|
10
|
-
import {
|
10
|
+
import { clearBrainText } from "../../helper";
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
12
12
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
13
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -89,15 +89,7 @@ const SearchButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
89
89
|
setSkip(0);
|
90
90
|
};
|
91
91
|
const handleClose = () => {
|
92
|
-
|
93
|
-
selection
|
94
|
-
} = editor;
|
95
|
-
if (selection) {
|
96
|
-
const [, currentPath] = Editor.node(editor, selection);
|
97
|
-
Transforms.insertText(editor, '', {
|
98
|
-
at: currentPath
|
99
|
-
});
|
100
|
-
}
|
92
|
+
clearBrainText(editor);
|
101
93
|
setAnchorEl(null);
|
102
94
|
};
|
103
95
|
const handleClick = data => {
|
@@ -166,7 +166,7 @@ const TableCell = props => {
|
|
166
166
|
if (!resizing && tableResizing) {
|
167
167
|
table.resizeTableCell({
|
168
168
|
"col.size": size
|
169
|
-
},
|
169
|
+
}, path);
|
170
170
|
}
|
171
171
|
if (resizing) {
|
172
172
|
setTableResizing(currentPath);
|
@@ -205,9 +205,8 @@ const TableCell = props => {
|
|
205
205
|
});
|
206
206
|
}
|
207
207
|
};
|
208
|
-
const onMouseUp =
|
208
|
+
const onMouseUp = () => {
|
209
209
|
if (startCellPath?.length) {
|
210
|
-
e.preventDefault();
|
211
210
|
updateTableSelection({
|
212
211
|
endCellPath: path,
|
213
212
|
isDragging: false
|
@@ -232,7 +231,7 @@ const TableCell = props => {
|
|
232
231
|
});
|
233
232
|
}
|
234
233
|
};
|
235
|
-
const cellId = path.toString()
|
234
|
+
const cellId = "table-cell" + path.toString();
|
236
235
|
const cellRef = document.getElementById(cellId);
|
237
236
|
const contentEditable = !readOnly && isCellEditable(startCellPath, path);
|
238
237
|
const commonTdProps = useMemo(() => {
|
@@ -281,7 +280,7 @@ const TableCell = props => {
|
|
281
280
|
const isCellDragging = active?.id && active?.id === cellId;
|
282
281
|
const isRowDragging = isCellDragging && currentDraggingType === "row";
|
283
282
|
const isColDragging = isCellDragging && currentDraggingType === "col";
|
284
|
-
const width = size?.width || tableSize?.cellWidth;
|
283
|
+
const width = isHeader ? size?.width || tableSize?.cellWidth : "0px";
|
285
284
|
const sizeProps = {
|
286
285
|
minWidth: width,
|
287
286
|
maxWidth: width
|
@@ -1,4 +1,4 @@
|
|
1
|
-
const TopBannerStyles =
|
1
|
+
const TopBannerStyles = theme => ({
|
2
2
|
root: {
|
3
3
|
"&:hover": {
|
4
4
|
"& .tb-toolbar": {
|
@@ -9,23 +9,29 @@ const TopBannerStyles = () => ({
|
|
9
9
|
toolbar: {
|
10
10
|
position: "absolute",
|
11
11
|
width: "auto",
|
12
|
-
bottom: "
|
13
|
-
left: 0,
|
12
|
+
bottom: "23px",
|
14
13
|
right: 0,
|
15
14
|
margin: "auto",
|
16
15
|
display: "none",
|
17
16
|
"& button": {
|
18
|
-
background:
|
19
|
-
border:
|
20
|
-
borderRadius: "
|
21
|
-
color: "#
|
17
|
+
background: theme?.palette?.editor?.background,
|
18
|
+
border: `1px solid ${theme?.palette?.editor?.popUpBorderColor}`,
|
19
|
+
borderRadius: "50%",
|
20
|
+
color: "#000",
|
22
21
|
marginRight: "8px",
|
23
|
-
padding: "4px
|
24
|
-
|
25
|
-
fontSize: "14px",
|
22
|
+
padding: "4px",
|
23
|
+
boxShadow: '0px 0px 32px rgba(255, 255, 255, 0.12)',
|
26
24
|
"&:hover": {
|
27
|
-
background:
|
28
|
-
|
25
|
+
background: theme?.palette?.editor?.background,
|
26
|
+
border: `1px solid ${theme?.palette?.editor?.activeColor}`,
|
27
|
+
"& svg": {
|
28
|
+
fill: theme?.palette?.editor?.activeColor
|
29
|
+
}
|
30
|
+
},
|
31
|
+
"& svg": {
|
32
|
+
width: '20px',
|
33
|
+
height: '20px',
|
34
|
+
fill: theme?.palette?.editor?.menuOptionTextColor
|
29
35
|
}
|
30
36
|
}
|
31
37
|
}
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
|
-
import { Box,
|
2
|
+
import { Box, IconButton } from "@mui/material";
|
3
3
|
import { updateTopBanner, removeTopBanner } from "../../utils/topBanner";
|
4
4
|
import ImageSelector from "../../common/ImageSelector/ImageSelector";
|
5
5
|
import TopBannerStyles from "./Styles";
|
6
|
+
import Icon from "../../common/Icon";
|
7
|
+
import { useEditorContext } from "../../hooks/useMouseMove";
|
6
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
10
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
@@ -39,12 +41,16 @@ export const TopBannerToolbar = props => {
|
|
39
41
|
component: "div",
|
40
42
|
className: "tb-toolbar",
|
41
43
|
sx: classes.toolbar,
|
42
|
-
children: [/*#__PURE__*/_jsx(
|
44
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
43
45
|
onClick: handleClick("change"),
|
44
|
-
children:
|
45
|
-
|
46
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
47
|
+
icon: "editIcon"
|
48
|
+
})
|
49
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
46
50
|
onClick: handleClick("remove"),
|
47
|
-
children:
|
51
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
52
|
+
icon: "deleteIcon"
|
53
|
+
})
|
48
54
|
})]
|
49
55
|
}), /*#__PURE__*/_jsx(ImageSelector, {
|
50
56
|
open: open,
|
@@ -67,7 +73,10 @@ const TopBanner = props => {
|
|
67
73
|
const {
|
68
74
|
url
|
69
75
|
} = element;
|
70
|
-
const
|
76
|
+
const {
|
77
|
+
theme
|
78
|
+
} = useEditorContext();
|
79
|
+
const classes = TopBannerStyles(theme);
|
71
80
|
return /*#__PURE__*/_jsxs(Box, {
|
72
81
|
component: "div",
|
73
82
|
...attributes,
|
@@ -145,7 +145,10 @@ const usePopupStyle = theme => ({
|
|
145
145
|
background: "#2563EB"
|
146
146
|
},
|
147
147
|
"& .MuiTabScrollButton-horizontal": {
|
148
|
-
borderBottom: "unset !important"
|
148
|
+
borderBottom: "unset !important",
|
149
|
+
"& svg": {
|
150
|
+
color: theme?.palette?.editor?.closeButtonSvgStroke
|
151
|
+
}
|
149
152
|
},
|
150
153
|
"@media only screen and (max-width: 599px)": {
|
151
154
|
width: "330px"
|
@@ -336,50 +339,50 @@ const usePopupStyle = theme => ({
|
|
336
339
|
marginBottom: "16px"
|
337
340
|
},
|
338
341
|
textAlignButtons: {
|
339
|
-
"& .justifyIcon": {
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
},
|
345
|
-
"& .textAlignIconSameStyles": {
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
},
|
350
|
-
"& .orderedListIcon": {
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
},
|
358
|
-
"& .bulletedListTextIcon": {
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
},
|
367
|
-
"& .checkedListTextIcon": {
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
},
|
372
|
-
"& .accordianListTextIcon": {
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
}
|
342
|
+
// "& .justifyIcon": {
|
343
|
+
// "& path": {
|
344
|
+
// fill: `${theme?.palette?.editor?.svgTextAlignStrokeColor}`,
|
345
|
+
// stroke: `${theme?.palette?.editor?.svgTextAlignStrokeColor}`,
|
346
|
+
// },
|
347
|
+
// },
|
348
|
+
// "& .textAlignIconSameStyles": {
|
349
|
+
// "& path": {
|
350
|
+
// fill: `${theme?.palette?.editor?.svgTextAlignStrokeColor}`,
|
351
|
+
// },
|
352
|
+
// },
|
353
|
+
// "& .orderedListIcon": {
|
354
|
+
// "& path": {
|
355
|
+
// stroke: `${theme?.palette?.editor?.svgTextAlignStrokeColor}`,
|
356
|
+
// },
|
357
|
+
// "& text": {
|
358
|
+
// fill: `${theme?.palette?.editor?.svgTextAlignStrokeColor}`,
|
359
|
+
// },
|
360
|
+
// },
|
361
|
+
// "& .bulletedListTextIcon": {
|
362
|
+
// "& path": {
|
363
|
+
// fill: `${theme?.palette?.editor?.svgTextAlignStrokeColor}`,
|
364
|
+
// stroke: `${theme?.palette?.editor?.svgTextAlignStrokeColor}`,
|
365
|
+
// },
|
366
|
+
// "& circle": {
|
367
|
+
// fill: `${theme?.palette?.editor?.svgTextAlignStrokeColor}`,
|
368
|
+
// },
|
369
|
+
// },
|
370
|
+
// "& .checkedListTextIcon": {
|
371
|
+
// "& path": {
|
372
|
+
// stroke: `${theme?.palette?.editor?.svgTextAlignStrokeColor}`,
|
373
|
+
// },
|
374
|
+
// },
|
375
|
+
// "& .accordianListTextIcon": {
|
376
|
+
// // stroke: `${theme?.palette?.editor?.svgTextAlignStrokeColor} !important`,
|
377
|
+
// "& svg": {
|
378
|
+
// fill: `${theme?.palette?.editor?.svgTextAlignStrokeColor}`,
|
379
|
+
// stroke: `${theme?.palette?.editor?.svgTextAlignStrokeColor}`,
|
380
|
+
// },
|
381
|
+
// "& path": {
|
382
|
+
// fill: `${theme?.palette?.editor?.svgTextAlignStrokeColor}`,
|
383
|
+
// stroke: `${theme?.palette?.editor?.svgTextAlignStrokeColor}`,
|
384
|
+
// },
|
385
|
+
// },
|
383
386
|
},
|
384
387
|
autoCompleteaFontFamily: {
|
385
388
|
"& .MuiOutlinedInput-root": {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useCallback, useEffect, useState } from "react";
|
2
2
|
import { Popper, Fade, Paper, ClickAwayListener } from "@mui/material";
|
3
|
-
import { Editor, Range } from "slate";
|
3
|
+
import { Editor, Range, Transforms } from "slate";
|
4
4
|
import { ReactEditor, useSlate } from "slate-react";
|
5
5
|
import useDrag from "../../hooks/useDrag";
|
6
6
|
import useWindowResize from "../../hooks/useWindowResize";
|
@@ -8,6 +8,7 @@ import MiniTextFormat from "./MiniTextFormat";
|
|
8
8
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
9
9
|
import usePopupStyles from "../PopupTool/PopupToolStyle";
|
10
10
|
import useEditorScroll from "../../hooks/useEditorScroll";
|
11
|
+
import { isCarouselSelected } from "../../helper";
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
12
13
|
const PopupTool = props => {
|
13
14
|
const {
|
@@ -63,10 +64,15 @@ const PopupTool = props => {
|
|
63
64
|
// for table cell selection
|
64
65
|
// const isCellsSelected = table.isCellSelected(editor.selection);
|
65
66
|
// if (!isCellsSelected) {
|
66
|
-
setOpen(true);
|
67
|
-
setPopupType("textFormat");
|
68
|
-
setIsTextSelected(true);
|
69
67
|
// }
|
68
|
+
const isCarouselEdit = isCarouselSelected(editor);
|
69
|
+
if (isCarouselEdit) {
|
70
|
+
Transforms.deselect(editor);
|
71
|
+
} else {
|
72
|
+
setOpen(true);
|
73
|
+
setPopupType("textFormat");
|
74
|
+
setIsTextSelected(true);
|
75
|
+
}
|
70
76
|
} else if (!anchorEl) {
|
71
77
|
setOpen(false);
|
72
78
|
setPopupType("");
|
@@ -23,6 +23,8 @@ import OpenLinkIcon from "../assets/svg/OpenLinkIcon";
|
|
23
23
|
import { BrainIcon } from "../assets/svg/BrainIcon";
|
24
24
|
import DocsIcon from "../assets/svg/DocsIcon";
|
25
25
|
import UserIcon from "../assets/svg/UserIcon";
|
26
|
+
import EditIcon from "@mui/icons-material/Edit";
|
27
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
26
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
27
29
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
28
30
|
const iconList = {
|
@@ -270,7 +272,9 @@ const iconList = {
|
|
270
272
|
openLinkIcon: /*#__PURE__*/_jsx(OpenLinkIcon, {}),
|
271
273
|
brain: /*#__PURE__*/_jsx(BrainIcon, {}),
|
272
274
|
docsIcon: /*#__PURE__*/_jsx(DocsIcon, {}),
|
273
|
-
userIcon: /*#__PURE__*/_jsx(UserIcon, {})
|
275
|
+
userIcon: /*#__PURE__*/_jsx(UserIcon, {}),
|
276
|
+
editIcon: /*#__PURE__*/_jsx(EditIcon, {}),
|
277
|
+
deleteIcon: /*#__PURE__*/_jsx(DeleteIcon, {})
|
274
278
|
};
|
275
279
|
export const icons = {
|
276
280
|
...iconList
|
@@ -18,7 +18,7 @@ const usePopupStyles = theme => ({
|
|
18
18
|
"& button": {
|
19
19
|
padding: "0px 0px 0px 6px",
|
20
20
|
"& svg": {
|
21
|
-
width: "19px !important",
|
21
|
+
// width: "19px !important",
|
22
22
|
paddingRight: "6px"
|
23
23
|
}
|
24
24
|
},
|
@@ -215,7 +215,8 @@ const usePopupStyles = theme => ({
|
|
215
215
|
margin: "8px",
|
216
216
|
display: "flex",
|
217
217
|
justifyContent: "center",
|
218
|
-
alignItems: "center"
|
218
|
+
alignItems: "center",
|
219
|
+
color: "#64748B"
|
219
220
|
}
|
220
221
|
});
|
221
222
|
export default usePopupStyles;
|
@@ -462,19 +462,19 @@ export const OrderedListTextFormatIcon = props => /*#__PURE__*/_jsxs("svg", {
|
|
462
462
|
className: "orderedListIcon",
|
463
463
|
children: [/*#__PURE__*/_jsx("path", {
|
464
464
|
d: "M11 19.8564H21",
|
465
|
-
stroke: "
|
465
|
+
stroke: "currentColor",
|
466
466
|
strokeWidth: "1.5",
|
467
467
|
strokeLinecap: "round",
|
468
468
|
strokeLinejoin: "round"
|
469
469
|
}), /*#__PURE__*/_jsx("path", {
|
470
470
|
d: "M11 12.8564H21",
|
471
|
-
stroke: "
|
471
|
+
stroke: "currentColor",
|
472
472
|
strokeWidth: "1.5",
|
473
473
|
strokeLinecap: "round",
|
474
474
|
strokeLinejoin: "round"
|
475
475
|
}), /*#__PURE__*/_jsx("path", {
|
476
476
|
d: "M11 5.85645H21",
|
477
|
-
stroke: "
|
477
|
+
stroke: "currentColor",
|
478
478
|
strokeWidth: "1.5",
|
479
479
|
strokeLinecap: "round",
|
480
480
|
strokeLinejoin: "round"
|
@@ -482,19 +482,19 @@ export const OrderedListTextFormatIcon = props => /*#__PURE__*/_jsxs("svg", {
|
|
482
482
|
x: "3",
|
483
483
|
y: "8",
|
484
484
|
fontSize: "5",
|
485
|
-
fill: "
|
485
|
+
fill: "currentColor",
|
486
486
|
children: "1"
|
487
487
|
}), /*#__PURE__*/_jsx("text", {
|
488
488
|
x: "3",
|
489
489
|
y: "14",
|
490
490
|
fontSize: "5",
|
491
|
-
fill: "
|
491
|
+
fill: "currentColor",
|
492
492
|
children: "2"
|
493
493
|
}), /*#__PURE__*/_jsx("text", {
|
494
494
|
x: "3",
|
495
495
|
y: "21",
|
496
496
|
fontSize: "5",
|
497
|
-
fill: "
|
497
|
+
fill: "currentColor",
|
498
498
|
children: "3"
|
499
499
|
})]
|
500
500
|
});
|
@@ -507,19 +507,19 @@ export const BulletedListTextFormatIcon = props => /*#__PURE__*/_jsxs("svg", {
|
|
507
507
|
className: "bulletedListTextIcon",
|
508
508
|
children: [/*#__PURE__*/_jsx("path", {
|
509
509
|
d: "M11 19.8564H21",
|
510
|
-
stroke: "
|
510
|
+
stroke: "currentColor",
|
511
511
|
strokeWidth: "1.5",
|
512
512
|
strokeLinecap: "round",
|
513
513
|
strokeLinejoin: "round"
|
514
514
|
}), /*#__PURE__*/_jsx("path", {
|
515
515
|
d: "M11 12.8564H21",
|
516
|
-
stroke: "
|
516
|
+
stroke: "currentColor",
|
517
517
|
strokeWidth: "1.5",
|
518
518
|
strokeLinecap: "round",
|
519
519
|
strokeLinejoin: "round"
|
520
520
|
}), /*#__PURE__*/_jsx("path", {
|
521
521
|
d: "M11 5.85645H21",
|
522
|
-
stroke: "
|
522
|
+
stroke: "currentColor",
|
523
523
|
strokeWidth: "1.5",
|
524
524
|
strokeLinecap: "round",
|
525
525
|
strokeLinejoin: "round"
|
@@ -527,17 +527,17 @@ export const BulletedListTextFormatIcon = props => /*#__PURE__*/_jsxs("svg", {
|
|
527
527
|
cx: "5.25",
|
528
528
|
cy: "5.80664",
|
529
529
|
r: "1.25",
|
530
|
-
fill: "
|
530
|
+
fill: "currentColor"
|
531
531
|
}), /*#__PURE__*/_jsx("circle", {
|
532
532
|
cx: "5.25",
|
533
533
|
cy: "12.8066",
|
534
534
|
r: "1.25",
|
535
|
-
fill: "
|
535
|
+
fill: "currentColor"
|
536
536
|
}), /*#__PURE__*/_jsx("circle", {
|
537
537
|
cx: "5.25",
|
538
538
|
cy: "19.8066",
|
539
539
|
r: "1.25",
|
540
|
-
fill: "
|
540
|
+
fill: "currentColor"
|
541
541
|
})]
|
542
542
|
});
|
543
543
|
export const CheckListTextFormatIcon = props => /*#__PURE__*/_jsxs("svg", {
|
@@ -549,37 +549,37 @@ export const CheckListTextFormatIcon = props => /*#__PURE__*/_jsxs("svg", {
|
|
549
549
|
className: "checkedListTextIcon",
|
550
550
|
children: [/*#__PURE__*/_jsx("path", {
|
551
551
|
d: "M11 19.8564H21",
|
552
|
-
stroke: "
|
552
|
+
stroke: "currentColor",
|
553
553
|
strokeWidth: "1.5",
|
554
554
|
strokeLinecap: "round",
|
555
555
|
strokeLinejoin: "round"
|
556
556
|
}), /*#__PURE__*/_jsx("path", {
|
557
557
|
d: "M11 12.8564H21",
|
558
|
-
stroke: "
|
558
|
+
stroke: "currentColor",
|
559
559
|
strokeWidth: "1.5",
|
560
560
|
strokeLinecap: "round",
|
561
561
|
strokeLinejoin: "round"
|
562
562
|
}), /*#__PURE__*/_jsx("path", {
|
563
563
|
d: "M11 5.85645H21",
|
564
|
-
stroke: "
|
564
|
+
stroke: "currentColor",
|
565
565
|
strokeWidth: "1.5",
|
566
566
|
strokeLinecap: "round",
|
567
567
|
strokeLinejoin: "round"
|
568
568
|
}), /*#__PURE__*/_jsx("path", {
|
569
569
|
d: "M3 5.85645L4 6.85645L7 3.85645",
|
570
|
-
stroke: "
|
570
|
+
stroke: "currentColor",
|
571
571
|
strokeWidth: "1.5",
|
572
572
|
strokeLinecap: "round",
|
573
573
|
strokeLinejoin: "round"
|
574
574
|
}), /*#__PURE__*/_jsx("path", {
|
575
575
|
d: "M3 12.8564L4 13.8564L7 10.8564",
|
576
|
-
stroke: "
|
576
|
+
stroke: "currentColor",
|
577
577
|
strokeWidth: "1.5",
|
578
578
|
strokeLinecap: "round",
|
579
579
|
strokeLinejoin: "round"
|
580
580
|
}), /*#__PURE__*/_jsx("path", {
|
581
581
|
d: "M3 19.8564L4 20.8564L7 17.8564",
|
582
|
-
stroke: "
|
582
|
+
stroke: "currentColor",
|
583
583
|
strokeWidth: "1.5",
|
584
584
|
strokeLinecap: "round",
|
585
585
|
strokeLinejoin: "round"
|
@@ -628,10 +628,9 @@ export const BoldTextFormatIcon = props => /*#__PURE__*/_jsx("svg", {
|
|
628
628
|
viewBox: "0 0 12 16",
|
629
629
|
fill: "none",
|
630
630
|
xmlns: "http://www.w3.org/2000/svg",
|
631
|
-
className: "fill-path",
|
632
631
|
children: /*#__PURE__*/_jsx("path", {
|
633
632
|
d: "M0.598011 15.3564V0.81099H5.92472C6.95691 0.81099 7.81155 0.981445 8.48864 1.32235C9.16572 1.65853 9.67235 2.11544 10.0085 2.69309C10.3447 3.26601 10.5128 3.91232 10.5128 4.63201C10.5128 5.23807 10.4015 5.74944 10.179 6.1661C9.95644 6.57804 9.65814 6.90948 9.28409 7.16042C8.91477 7.40663 8.50758 7.58656 8.0625 7.7002V7.84224C8.54545 7.86591 9.01657 8.02216 9.47585 8.31099C9.93987 8.59508 10.3234 8.99991 10.6264 9.52548C10.9295 10.051 11.081 10.6903 11.081 11.4431C11.081 12.1865 10.9058 12.8541 10.5554 13.4459C10.2098 14.0331 9.67472 14.4994 8.95028 14.8451C8.22585 15.186 7.30019 15.3564 6.1733 15.3564H0.598011ZM2.79261 13.4743H5.96023C7.01136 13.4743 7.7642 13.2707 8.21875 12.8635C8.6733 12.4564 8.90057 11.9474 8.90057 11.3366C8.90057 10.8773 8.78456 10.4559 8.55256 10.0724C8.32055 9.68883 7.98911 9.38343 7.55824 9.15616C7.1321 8.92889 6.62547 8.81525 6.03835 8.81525H2.79261V13.4743ZM2.79261 7.1036H5.73295C6.22538 7.1036 6.66809 7.00891 7.06108 6.81951C7.45881 6.63012 7.77367 6.36497 8.00568 6.02406C8.24242 5.67841 8.3608 5.27122 8.3608 4.80247C8.3608 4.20114 8.15009 3.69688 7.72869 3.28968C7.30729 2.88249 6.66099 2.67889 5.78977 2.67889H2.79261V7.1036Z",
|
634
|
-
fill: "
|
633
|
+
fill: "currentColor"
|
635
634
|
})
|
636
635
|
});
|
637
636
|
export const UnderlineTextFormatIcon = props => /*#__PURE__*/_jsxs("svg", {
|
@@ -642,13 +641,13 @@ export const UnderlineTextFormatIcon = props => /*#__PURE__*/_jsxs("svg", {
|
|
642
641
|
xmlns: "http://www.w3.org/2000/svg",
|
643
642
|
children: [/*#__PURE__*/_jsx("path", {
|
644
643
|
d: "M3.41406 1.58301V6.16634C3.41406 7.38192 3.89695 8.54771 4.75649 9.40725C5.61603 10.2668 6.78182 10.7497 7.9974 10.7497C9.21297 10.7497 10.3788 10.2668 11.2383 9.40725C12.0978 8.54771 12.5807 7.38192 12.5807 6.16634V1.58301",
|
645
|
-
stroke: "
|
644
|
+
stroke: "currentColor",
|
646
645
|
strokeWidth: "2",
|
647
646
|
strokeLinecap: "round",
|
648
647
|
strokeLinejoin: "round"
|
649
648
|
}), /*#__PURE__*/_jsx("path", {
|
650
649
|
d: "M1.58203 14.416H14.4154",
|
651
|
-
stroke: "
|
650
|
+
stroke: "currentColor",
|
652
651
|
strokeWidth: "2",
|
653
652
|
strokeLinecap: "round",
|
654
653
|
strokeLinejoin: "round"
|
@@ -662,19 +661,19 @@ export const ItalicTextFormatIcon = props => /*#__PURE__*/_jsxs("svg", {
|
|
662
661
|
xmlns: "http://www.w3.org/2000/svg",
|
663
662
|
children: [/*#__PURE__*/_jsx("path", {
|
664
663
|
d: "M4.71094 1.45801H9.46094",
|
665
|
-
stroke: "
|
664
|
+
stroke: "currentColor",
|
666
665
|
strokeWidth: "2",
|
667
666
|
strokeLinecap: "round",
|
668
667
|
strokeLinejoin: "round"
|
669
668
|
}), /*#__PURE__*/_jsx("path", {
|
670
669
|
d: "M1.54297 12.541H6.29297",
|
671
|
-
stroke: "
|
670
|
+
stroke: "currentColor",
|
672
671
|
strokeWidth: "2",
|
673
672
|
strokeLinecap: "round",
|
674
673
|
strokeLinejoin: "round"
|
675
674
|
}), /*#__PURE__*/_jsx("path", {
|
676
675
|
d: "M7.08464 1.45801L3.91797 12.5413",
|
677
|
-
stroke: "
|
676
|
+
stroke: "currentColor",
|
678
677
|
strokeWidth: "2",
|
679
678
|
strokeLinecap: "round",
|
680
679
|
strokeLinejoin: "round"
|
@@ -951,16 +950,16 @@ export function LeftAlignTextFormat() {
|
|
951
950
|
className: "textAlignIconSameStyles",
|
952
951
|
children: [/*#__PURE__*/_jsx("path", {
|
953
952
|
d: "M17.5 5.60547H2.5C2.15833 5.60547 1.875 5.26547 1.875 4.85547C1.875 4.44547 2.15833 4.10547 2.5 4.10547H17.5C17.8417 4.10547 18.125 4.44547 18.125 4.85547C18.125 5.26547 17.8417 5.60547 17.5 5.60547Z",
|
954
|
-
fill: "
|
953
|
+
fill: "currentColor"
|
955
954
|
}), /*#__PURE__*/_jsx("path", {
|
956
955
|
d: "M10.3917 10.6055H2.5C2.15833 10.6055 1.875 10.2655 1.875 9.85547C1.875 9.44547 2.15833 9.10547 2.5 9.10547H10.3917C10.7333 9.10547 11.0167 9.44547 11.0167 9.85547C11.0167 10.2655 10.7417 10.6055 10.3917 10.6055Z",
|
957
|
-
fill: "
|
956
|
+
fill: "currentColor"
|
958
957
|
}), /*#__PURE__*/_jsx("path", {
|
959
958
|
d: "M17.5 15.6055H2.5C2.15833 15.6055 1.875 15.2655 1.875 14.8555C1.875 14.4455 2.15833 14.1055 2.5 14.1055H17.5C17.8417 14.1055 18.125 14.4455 18.125 14.8555C18.125 15.2655 17.8417 15.6055 17.5 15.6055Z",
|
960
|
-
fill: "
|
959
|
+
fill: "currentColor"
|
961
960
|
}), /*#__PURE__*/_jsx("path", {
|
962
961
|
d: "M10.3917 20.6055H2.5C2.15833 20.6055 1.875 20.2655 1.875 19.8555C1.875 19.4455 2.15833 19.1055 2.5 19.1055H10.3917C10.7333 19.1055 11.0167 19.4455 11.0167 19.8555C11.0167 20.2655 10.7417 20.6055 10.3917 20.6055Z",
|
963
|
-
fill: "
|
962
|
+
fill: "currentColor"
|
964
963
|
})]
|
965
964
|
});
|
966
965
|
}
|
@@ -974,16 +973,16 @@ export function CenterAlignTextFormat() {
|
|
974
973
|
className: "textAlignIconSameStyles",
|
975
974
|
children: [/*#__PURE__*/_jsx("path", {
|
976
975
|
d: "M17.5 5.60547H2.5C2.15833 5.60547 1.875 5.26547 1.875 4.85547C1.875 4.44547 2.15833 4.10547 2.5 4.10547H17.5C17.8417 4.10547 18.125 4.44547 18.125 4.85547C18.125 5.26547 17.8417 5.60547 17.5 5.60547Z",
|
977
|
-
fill: "
|
976
|
+
fill: "currentColor"
|
978
977
|
}), /*#__PURE__*/_jsx("path", {
|
979
978
|
d: "M13.9508 10.6055H6.05078C5.70911 10.6055 5.42578 10.2655 5.42578 9.85547C5.42578 9.44547 5.70911 9.10547 6.05078 9.10547H13.9424C14.2841 9.10547 14.5674 9.44547 14.5674 9.85547C14.5674 10.2655 14.2924 10.6055 13.9508 10.6055Z",
|
980
|
-
fill: "
|
979
|
+
fill: "currentColor"
|
981
980
|
}), /*#__PURE__*/_jsx("path", {
|
982
981
|
d: "M17.5 15.6055H2.5C2.15833 15.6055 1.875 15.2655 1.875 14.8555C1.875 14.4455 2.15833 14.1055 2.5 14.1055H17.5C17.8417 14.1055 18.125 14.4455 18.125 14.8555C18.125 15.2655 17.8417 15.6055 17.5 15.6055Z",
|
983
|
-
fill: "
|
982
|
+
fill: "currentColor"
|
984
983
|
}), /*#__PURE__*/_jsx("path", {
|
985
984
|
d: "M13.9508 20.6055H6.05078C5.70911 20.6055 5.42578 20.2655 5.42578 19.8555C5.42578 19.4455 5.70911 19.1055 6.05078 19.1055H13.9424C14.2841 19.1055 14.5674 19.4455 14.5674 19.8555C14.5674 20.2655 14.2924 20.6055 13.9508 20.6055Z",
|
986
|
-
fill: "
|
985
|
+
fill: "currentColor"
|
987
986
|
})]
|
988
987
|
});
|
989
988
|
}
|
@@ -997,16 +996,16 @@ export function RightAlignTextFormat() {
|
|
997
996
|
className: "textAlignIconSameStyles",
|
998
997
|
children: [/*#__PURE__*/_jsx("path", {
|
999
998
|
d: "M17.5 5.60547H2.5C2.15833 5.60547 1.875 5.26547 1.875 4.85547C1.875 4.44547 2.15833 4.10547 2.5 4.10547H17.5C17.8417 4.10547 18.125 4.44547 18.125 4.85547C18.125 5.26547 17.8417 5.60547 17.5 5.60547Z",
|
1000
|
-
fill: "
|
999
|
+
fill: "currentColor"
|
1001
1000
|
}), /*#__PURE__*/_jsx("path", {
|
1002
1001
|
d: "M17.4991 10.6055H9.60742C9.26576 10.6055 8.98242 10.2655 8.98242 9.85547C8.98242 9.44547 9.26576 9.10547 9.60742 9.10547H17.4991C17.8408 9.10547 18.1241 9.44547 18.1241 9.85547C18.1241 10.2655 17.8408 10.6055 17.4991 10.6055Z",
|
1003
|
-
fill: "
|
1002
|
+
fill: "currentColor"
|
1004
1003
|
}), /*#__PURE__*/_jsx("path", {
|
1005
1004
|
d: "M17.5 15.6055H2.5C2.15833 15.6055 1.875 15.2655 1.875 14.8555C1.875 14.4455 2.15833 14.1055 2.5 14.1055H17.5C17.8417 14.1055 18.125 14.4455 18.125 14.8555C18.125 15.2655 17.8417 15.6055 17.5 15.6055Z",
|
1006
|
-
fill: "
|
1005
|
+
fill: "currentColor"
|
1007
1006
|
}), /*#__PURE__*/_jsx("path", {
|
1008
1007
|
d: "M17.4991 20.6055H9.60742C9.26576 20.6055 8.98242 20.2655 8.98242 19.8555C8.98242 19.4455 9.26576 19.1055 9.60742 19.1055H17.4991C17.8408 19.1055 18.1241 19.4455 18.1241 19.8555C18.1241 20.2655 17.8408 20.6055 17.4991 20.6055Z",
|
1009
|
-
fill: "
|
1008
|
+
fill: "currentColor"
|
1010
1009
|
})]
|
1011
1010
|
});
|
1012
1011
|
}
|
@@ -1021,25 +1020,25 @@ export function JustifyTextFormat() {
|
|
1021
1020
|
className: "justifyIcon",
|
1022
1021
|
children: [/*#__PURE__*/_jsx("path", {
|
1023
1022
|
d: "M2.5 4.85547H17.5",
|
1024
|
-
stroke: "
|
1023
|
+
stroke: "currentColor",
|
1025
1024
|
strokeWidth: "1.5",
|
1026
1025
|
strokeLinecap: "round",
|
1027
1026
|
strokeLinejoin: "round"
|
1028
1027
|
}), /*#__PURE__*/_jsx("path", {
|
1029
1028
|
d: "M2.5 9.85547H17.5",
|
1030
|
-
stroke: "
|
1029
|
+
stroke: "currentColor",
|
1031
1030
|
strokeWidth: "1.5",
|
1032
1031
|
strokeLinecap: "round",
|
1033
1032
|
strokeLinejoin: "round"
|
1034
1033
|
}), /*#__PURE__*/_jsx("path", {
|
1035
1034
|
d: "M2.5 14.8555H17.5",
|
1036
|
-
stroke: "
|
1035
|
+
stroke: "currentColor",
|
1037
1036
|
strokeWidth: "1.5",
|
1038
1037
|
strokeLinecap: "round",
|
1039
1038
|
strokeLinejoin: "round"
|
1040
1039
|
}), /*#__PURE__*/_jsx("path", {
|
1041
1040
|
d: "M2.5 19.8555H17.5",
|
1042
|
-
stroke: "
|
1041
|
+
stroke: "currentColor",
|
1043
1042
|
strokeWidth: "1.5",
|
1044
1043
|
strokeLinecap: "round",
|
1045
1044
|
strokeLinejoin: "round"
|
@@ -135,12 +135,11 @@ export const StrikethroughIcon = props => /*#__PURE__*/_jsx("svg", {
|
|
135
135
|
height: "15",
|
136
136
|
viewBox: "0 0 15 15",
|
137
137
|
fill: "none",
|
138
|
-
className: "fill-path",
|
139
138
|
children: /*#__PURE__*/_jsx("path", {
|
140
139
|
className: "strokeFillPath",
|
141
140
|
d: "M2.7607 11.125C2.7607 13.0718 4.33885 14.65 6.28568 14.65H8.21432C10.1611 14.65 11.7393 13.0718 11.7393 11.125V10.6429C11.7393 9.78254 11.4309 8.99403 10.9189 8.38214H13.5179C13.867 8.38214 14.15 8.0991 14.15 7.75C14.15 7.4009 13.867 7.11786 13.5179 7.11786H8.21597H8.21435H6.28579C5.03727 7.11786 4.02509 6.10568 4.02509 4.85714V4.375C4.02509 3.12647 5.03727 2.11429 6.28579 2.11429H8.21435C9.46288 2.11429 10.4751 3.12647 10.4751 4.375V4.84874C10.4751 5.19784 10.7581 5.48088 11.1072 5.48088C11.4563 5.48088 11.7393 5.19784 11.7393 4.84874V4.375C11.7393 2.42817 10.1612 0.85 8.21435 0.85H6.28579C4.33897 0.85 2.76081 2.42817 2.76081 4.375V4.85714C2.76081 5.71746 3.06916 6.50597 3.58108 7.11786H0.982141C0.633044 7.11786 0.35 7.4009 0.35 7.75C0.35 8.0991 0.633044 8.38214 0.982141 8.38214H8.21424L8.21556 8.38214C8.21559 8.38214 8.21562 8.38214 8.21564 8.38214C9.46353 8.38289 10.4749 9.39474 10.4749 10.6429V11.125C10.4749 12.3735 9.46276 13.3857 8.21424 13.3857H6.28568C5.03715 13.3857 4.02498 12.3735 4.02498 11.125V10.6429C4.02498 10.2938 3.74193 10.0107 3.39284 10.0107C3.04374 10.0107 2.7607 10.2938 2.7607 10.6429V11.125Z",
|
142
|
-
fill: "
|
143
|
-
stroke: "
|
141
|
+
fill: "currentColor",
|
142
|
+
stroke: "currentColor",
|
144
143
|
strokeWidth: "0.3"
|
145
144
|
})
|
146
145
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Editor, Transforms, Path } from "slate";
|
1
|
+
import { Editor, Transforms, Path, Element } from "slate";
|
2
2
|
import { ReactEditor } from "slate-react";
|
3
3
|
import html2canvas from "html2canvas";
|
4
4
|
import { rectIntersection, closestCenter } from "@dnd-kit/core";
|
@@ -322,4 +322,40 @@ export const getBorderColor = (borderColor = "") => {
|
|
322
322
|
borderStyle.borderColor = borderColor;
|
323
323
|
}
|
324
324
|
return borderStyle;
|
325
|
+
};
|
326
|
+
export const isCarouselSelected = editor => {
|
327
|
+
try {
|
328
|
+
if (!editor.selection) {
|
329
|
+
return false;
|
330
|
+
}
|
331
|
+
const [nodeEntry] = Editor.nodes(editor, {
|
332
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === 'carousel'
|
333
|
+
});
|
334
|
+
if (!nodeEntry) {
|
335
|
+
return false;
|
336
|
+
}
|
337
|
+
const [node] = nodeEntry;
|
338
|
+
const carouselDom = ReactEditor.toDOMNode(editor, node);
|
339
|
+
const isEdit = carouselDom.classList.contains('carousel_slider_edit');
|
340
|
+
return !isEdit;
|
341
|
+
} catch (err) {
|
342
|
+
console.log(err);
|
343
|
+
return false;
|
344
|
+
}
|
345
|
+
};
|
346
|
+
export const clearBrainText = editor => {
|
347
|
+
try {
|
348
|
+
const {
|
349
|
+
selection
|
350
|
+
} = editor;
|
351
|
+
if (selection) {
|
352
|
+
const [currentNode, currentPath] = Editor.node(editor, selection);
|
353
|
+
const cleanedText = Node.string(currentNode).replace(/\/b(?:rain|r|ra|rai)?/g, "").trim();
|
354
|
+
Transforms.insertText(editor, cleanedText, {
|
355
|
+
at: currentPath
|
356
|
+
});
|
357
|
+
}
|
358
|
+
} catch (err) {
|
359
|
+
console.log(err);
|
360
|
+
}
|
325
361
|
};
|
@@ -2,11 +2,12 @@ import { ClickAwayListener } from "@mui/material";
|
|
2
2
|
import { createContext, useContext, useEffect, useMemo, useState } from "react";
|
3
3
|
import { clearCellText } from "../utils/table";
|
4
4
|
import { Editor, Element, Transforms, Range } from "slate";
|
5
|
-
import { DndContext, PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
|
5
|
+
import { DndContext, DragOverlay, PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
|
6
6
|
import { encodeToBase64 } from "../utils/helper";
|
7
7
|
import { serializeToText } from "../utils/serializeToText";
|
8
8
|
import { createCopiedTableStructure, getRectangleBounds, tableNodeToDom } from "../Elements/Table/tableHelper";
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
11
|
const handleDragEnd = (dragData, editor, resetAll) => {
|
11
12
|
const {
|
12
13
|
active,
|
@@ -157,15 +158,15 @@ export const TableProvider = ({
|
|
157
158
|
}, [openSetttings]);
|
158
159
|
return /*#__PURE__*/_jsx(TableContext.Provider, {
|
159
160
|
value: values,
|
160
|
-
children: /*#__PURE__*/
|
161
|
+
children: /*#__PURE__*/_jsxs(DndContext, {
|
161
162
|
sensors: sensors,
|
162
163
|
onDragEnd: data => handleDragEnd(data, editor, resetAll),
|
163
|
-
children: /*#__PURE__*/_jsx(ClickAwayListener, {
|
164
|
+
children: [/*#__PURE__*/_jsx(ClickAwayListener, {
|
164
165
|
onClickAway: () => setTableSelection(getDefaultTableSelection()),
|
165
166
|
children: /*#__PURE__*/_jsx("div", {
|
166
167
|
children: children
|
167
168
|
})
|
168
|
-
})
|
169
|
+
}), /*#__PURE__*/_jsx(DragOverlay, {})]
|
169
170
|
})
|
170
171
|
});
|
171
172
|
};
|
@@ -246,7 +246,7 @@ export class TableUtil {
|
|
246
246
|
const isDuplicate = action === "duplicate";
|
247
247
|
const isInsertNext = action === "after" || isDuplicate;
|
248
248
|
const path = isInsertNext ? Path.next(currentRow) : currentRow;
|
249
|
-
const insertData = isDuplicate ? JSON.parse(JSON.stringify(currentRowData)) :
|
249
|
+
const insertData = isDuplicate ? JSON.parse(JSON.stringify(currentRowData)) : createRowOnInsertAbove(currentRowData, currentRow, this.editor);
|
250
250
|
Transforms.insertNodes(this.editor, insertData, {
|
251
251
|
at: path
|
252
252
|
});
|
@@ -492,16 +492,12 @@ export class TableUtil {
|
|
492
492
|
console.log(err);
|
493
493
|
}
|
494
494
|
};
|
495
|
-
resizeTableCell = (styleProps,
|
495
|
+
resizeTableCell = (styleProps, path) => {
|
496
496
|
const cellProps = parseByPrefixKey(styleProps, "col.");
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
...cellProps
|
502
|
-
}, {
|
503
|
-
at: cellPath
|
504
|
-
});
|
497
|
+
Transforms.setNodes(this.editor, {
|
498
|
+
...cellProps
|
499
|
+
}, {
|
500
|
+
at: path
|
505
501
|
});
|
506
502
|
};
|
507
503
|
getTableProps = () => {
|
@@ -626,14 +622,14 @@ export class TableUtil {
|
|
626
622
|
}
|
627
623
|
};
|
628
624
|
}
|
629
|
-
const createRow = cellText => {
|
630
|
-
const newRow = Array.from(cellText, value => createTableCell(value));
|
625
|
+
const createRow = (cellText, other) => {
|
626
|
+
const newRow = Array.from(cellText, value => createTableCell(value, other));
|
631
627
|
return {
|
632
628
|
type: "table-row",
|
633
629
|
children: newRow
|
634
630
|
};
|
635
631
|
};
|
636
|
-
export const createTableCell = text => {
|
632
|
+
export const createTableCell = (text, other = {}) => {
|
637
633
|
return {
|
638
634
|
type: "table-cell",
|
639
635
|
children: [{
|
@@ -644,7 +640,32 @@ export const createTableCell = text => {
|
|
644
640
|
}],
|
645
641
|
size: {
|
646
642
|
width: 120
|
643
|
+
},
|
644
|
+
...other
|
645
|
+
};
|
646
|
+
};
|
647
|
+
const createRowOnInsertAbove = (currentRow, currRowPath, editor) => {
|
648
|
+
const isFirstRow = currRowPath[currRowPath?.length - 1] === 0;
|
649
|
+
const rowChild = currentRow?.children?.map((cell, i) => {
|
650
|
+
let other = {};
|
651
|
+
|
652
|
+
// remove the current row's size and add it on the currently inserting cell
|
653
|
+
if (isFirstRow) {
|
654
|
+
const cellPath = [...currRowPath, i];
|
655
|
+
Transforms.setNodes(editor, {
|
656
|
+
size: null
|
657
|
+
}, {
|
658
|
+
at: cellPath
|
659
|
+
});
|
660
|
+
other = {
|
661
|
+
size: cell?.size
|
662
|
+
};
|
647
663
|
}
|
664
|
+
return createTableCell("", other);
|
665
|
+
});
|
666
|
+
return {
|
667
|
+
type: "table-row",
|
668
|
+
children: rowChild
|
648
669
|
};
|
649
670
|
};
|
650
671
|
|