@flozy/editor 1.1.2 → 1.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.
- package/dist/Editor/CollaborativeEditor.js +7 -2
- package/dist/Editor/CommonEditor.js +53 -34
- package/dist/Editor/Editor.css +93 -17
- package/dist/Editor/Elements/Accordion/Accordion.js +67 -2
- package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +20 -0
- package/dist/Editor/Elements/Accordion/AccordionButton.js +2 -1
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +59 -4
- package/dist/Editor/Elements/Accordion/AccordionTitlePopup.js +20 -0
- package/dist/Editor/Elements/Button/ButtonPopup.js +20 -0
- package/dist/Editor/Elements/Button/ButtonToolIcon.js +19 -0
- package/dist/Editor/Elements/Button/EditorButton.js +124 -0
- package/dist/Editor/Elements/Carousel/Arrows.js +39 -0
- package/dist/Editor/Elements/Carousel/Carousel.js +82 -0
- package/dist/Editor/Elements/Carousel/CarouselButton.js +19 -0
- package/dist/Editor/Elements/Carousel/CarouselItem.js +13 -0
- package/dist/Editor/Elements/Carousel/slick-theme.min.css +143 -0
- package/dist/Editor/Elements/Carousel/slick.min.css +83 -0
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +1 -1
- package/dist/Editor/Elements/Embed/Embed.css +22 -2
- package/dist/Editor/Elements/Embed/Embed.js +89 -74
- package/dist/Editor/Elements/Embed/EmbedPopup.js +23 -0
- package/dist/Editor/Elements/Embed/Image.js +92 -10
- package/dist/Editor/Elements/Embed/Video.js +1 -0
- package/dist/Editor/Elements/Equation/EquationButton.js +12 -12
- package/dist/Editor/Elements/Grid/Grid.js +64 -8
- package/dist/Editor/Elements/Grid/GridButton.js +2 -4
- package/dist/Editor/Elements/Grid/GridItem.js +59 -5
- package/dist/Editor/Elements/Grid/GridItemPopup.js +20 -0
- package/dist/Editor/Elements/Grid/GridPopup.js +22 -0
- package/dist/Editor/Elements/ID/Id.js +1 -1
- package/dist/Editor/Elements/ImageText/ImageText.js +14 -0
- package/dist/Editor/Elements/ImageText/ImageTextWrapper.js +14 -0
- package/dist/Editor/Elements/Link/LinkButton.js +1 -1
- package/dist/Editor/Elements/NewLine/NewLineButton.js +2 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +88 -0
- package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +22 -0
- package/dist/Editor/Elements/Signature/Signature.js +4 -2
- package/dist/Editor/Elements/Signature/SignatureButton.js +2 -1
- package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +7 -2
- package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -1
- package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +50 -0
- package/dist/Editor/Elements/Signature/SignatureOptions/index.js +2 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +79 -10
- package/dist/Editor/Elements/Table/DeleteCellIcon.js +24 -0
- package/dist/Editor/Elements/Table/DeleteRowIcon.js +24 -0
- package/dist/Editor/Elements/Table/Table.js +9 -1
- package/dist/Editor/Elements/Table/TableCell.js +181 -0
- package/dist/Editor/Elements/Table/TablePopup.js +22 -0
- package/dist/Editor/Elements/Table/TableRow.js +31 -0
- package/dist/Editor/Elements/Table/TableSelector.js +62 -68
- package/dist/Editor/Toolbar/Toolbar.js +22 -7
- package/dist/Editor/Toolbar/styles.css +20 -11
- package/dist/Editor/Toolbar/toolbarGroups.js +9 -9
- package/dist/Editor/common/Button.js +4 -8
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +23 -0
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +35 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +47 -0
- package/dist/Editor/common/StyleBuilder/embedImageStyle.js +63 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +88 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +87 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +136 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +126 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +89 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/elementSize.js +110 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +42 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/imageTexts.js +75 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +21 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +46 -0
- package/dist/Editor/common/StyleBuilder/gridItemStyle.js +51 -0
- package/dist/Editor/common/StyleBuilder/gridStyle.js +51 -0
- package/dist/Editor/common/StyleBuilder/index.js +114 -0
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +10 -0
- package/dist/Editor/common/StyleBuilder/tableStyle.js +38 -0
- package/dist/Editor/common/Uploader.js +87 -0
- package/dist/Editor/plugins/withEmbeds.js +12 -5
- package/dist/Editor/plugins/withTable.js +5 -4
- package/dist/Editor/service/fileupload.js +17 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +46 -12
- package/dist/Editor/utils/button.js +11 -0
- package/dist/Editor/utils/carousel.js +13 -0
- package/dist/Editor/utils/carouselItem.js +19 -0
- package/dist/Editor/utils/customHooks/useContextMenu.js +8 -8
- package/dist/Editor/utils/customHooks/useResize.js +1 -1
- package/dist/Editor/utils/font.js +4 -4
- package/dist/Editor/utils/helper.js +16 -0
- package/dist/Editor/utils/imageText.js +19 -0
- package/dist/Editor/utils/table.js +172 -0
- package/package.json +2 -1
|
@@ -6,6 +6,8 @@ import Video from "../Elements/Embed/Video";
|
|
|
6
6
|
import Equation from "../Elements/Equation/Equation";
|
|
7
7
|
import HtmlCode from "../Elements/CodeToText/HtmlCode";
|
|
8
8
|
import Table from "../Elements/Table/Table";
|
|
9
|
+
import TableRow from "../Elements/Table/TableRow";
|
|
10
|
+
import TableCell from "../Elements/Table/TableCell";
|
|
9
11
|
import Mentions from "../Elements/Mentions/Mentions";
|
|
10
12
|
import Grid from "../Elements/Grid/Grid";
|
|
11
13
|
import GridItem from "../Elements/Grid/GridItem";
|
|
@@ -14,6 +16,11 @@ import AccordionSummary from "../Elements/Accordion/AccordionSummary";
|
|
|
14
16
|
import AccordionDetails from "../Elements/Accordion/AccordionDetails";
|
|
15
17
|
import Signature from "../Elements/Signature/Signature";
|
|
16
18
|
import Signed from "../Elements/Signature/Signed";
|
|
19
|
+
import EditorButton from "../Elements/Button/EditorButton";
|
|
20
|
+
import Carousel from "../Elements/Carousel/Carousel";
|
|
21
|
+
import CarouselItem from "../Elements/Carousel/CarouselItem";
|
|
22
|
+
import ImageTextWrapper from "../Elements/ImageText/ImageTextWrapper";
|
|
23
|
+
import ImageText from "../Elements/ImageText/ImageText";
|
|
17
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
25
|
const alignment = ["alignLeft", "alignRight", "alignCenter"];
|
|
19
26
|
const list_types = ["orderedList", "unorderedList"];
|
|
@@ -66,8 +73,13 @@ export const toggleMark = (editor, format) => {
|
|
|
66
73
|
}
|
|
67
74
|
};
|
|
68
75
|
export const isMarkActive = (editor, format) => {
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
try {
|
|
77
|
+
const marks = Editor.marks(editor);
|
|
78
|
+
return marks ? marks[format] === true : false;
|
|
79
|
+
} catch (err) {
|
|
80
|
+
console.log(err);
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
71
83
|
};
|
|
72
84
|
export const isBlockActive = (editor, format) => {
|
|
73
85
|
const [match] = Editor.nodes(editor, {
|
|
@@ -82,9 +94,14 @@ export const activeMark = (editor, format) => {
|
|
|
82
94
|
fontSize: "normal",
|
|
83
95
|
fontFamily: "sans"
|
|
84
96
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
97
|
+
try {
|
|
98
|
+
const marks = Editor.marks(editor);
|
|
99
|
+
const defaultValue = defaultMarkData[format];
|
|
100
|
+
return marks?.[format] ?? defaultValue;
|
|
101
|
+
} catch (err) {
|
|
102
|
+
console.log(err);
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
88
105
|
};
|
|
89
106
|
export const getMarked = (leaf, children) => {
|
|
90
107
|
if (leaf.bold) {
|
|
@@ -251,20 +268,25 @@ export const getBlock = props => {
|
|
|
251
268
|
...props
|
|
252
269
|
});
|
|
253
270
|
case "table-row":
|
|
254
|
-
return /*#__PURE__*/_jsx(
|
|
255
|
-
...
|
|
256
|
-
children: children
|
|
271
|
+
return /*#__PURE__*/_jsx(TableRow, {
|
|
272
|
+
...props
|
|
257
273
|
});
|
|
258
274
|
case "table-cell":
|
|
259
|
-
return /*#__PURE__*/_jsx(
|
|
260
|
-
...
|
|
261
|
-
...attributes,
|
|
262
|
-
children: children
|
|
275
|
+
return /*#__PURE__*/_jsx(TableCell, {
|
|
276
|
+
...props
|
|
263
277
|
});
|
|
264
278
|
case "image":
|
|
265
279
|
return /*#__PURE__*/_jsx(Image, {
|
|
266
280
|
...props
|
|
267
281
|
});
|
|
282
|
+
case "image-text-wrapper":
|
|
283
|
+
return /*#__PURE__*/_jsx(ImageTextWrapper, {
|
|
284
|
+
...props
|
|
285
|
+
});
|
|
286
|
+
case "image-text":
|
|
287
|
+
return /*#__PURE__*/_jsx(ImageText, {
|
|
288
|
+
...props
|
|
289
|
+
});
|
|
268
290
|
case "video":
|
|
269
291
|
return /*#__PURE__*/_jsx(Video, {
|
|
270
292
|
...props
|
|
@@ -309,6 +331,18 @@ export const getBlock = props => {
|
|
|
309
331
|
return /*#__PURE__*/_jsx(Signed, {
|
|
310
332
|
...props
|
|
311
333
|
});
|
|
334
|
+
case "button":
|
|
335
|
+
return /*#__PURE__*/_jsx(EditorButton, {
|
|
336
|
+
...props
|
|
337
|
+
});
|
|
338
|
+
case "carousel":
|
|
339
|
+
return /*#__PURE__*/_jsx(Carousel, {
|
|
340
|
+
...props
|
|
341
|
+
});
|
|
342
|
+
case "carousel-item":
|
|
343
|
+
return /*#__PURE__*/_jsx(CarouselItem, {
|
|
344
|
+
...props
|
|
345
|
+
});
|
|
312
346
|
default:
|
|
313
347
|
return /*#__PURE__*/_jsx("div", {
|
|
314
348
|
...element.attr,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Transforms } from "slate";
|
|
2
|
+
import { carouselItem } from "./carouselItem";
|
|
3
|
+
export const insertCarousel = editor => {
|
|
4
|
+
const grid = {
|
|
5
|
+
type: "carousel",
|
|
6
|
+
grid: "container",
|
|
7
|
+
children: [{
|
|
8
|
+
...carouselItem()
|
|
9
|
+
}]
|
|
10
|
+
};
|
|
11
|
+
Transforms.insertNodes(editor, grid);
|
|
12
|
+
Transforms.move(editor);
|
|
13
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Transforms } from "slate";
|
|
2
|
+
export const carouselItem = () => {
|
|
3
|
+
return {
|
|
4
|
+
type: "carousel-item",
|
|
5
|
+
image: null,
|
|
6
|
+
children: [{
|
|
7
|
+
type: "paragraph",
|
|
8
|
+
children: [{
|
|
9
|
+
text: `Carousel Item Text - ${new Date().getTime()}`
|
|
10
|
+
}]
|
|
11
|
+
}]
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export const insertCarouselItem = editor => {
|
|
15
|
+
Transforms.insertNodes(editor, {
|
|
16
|
+
...carouselItem()
|
|
17
|
+
});
|
|
18
|
+
Transforms.move(editor);
|
|
19
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useState, useEffect } from
|
|
2
|
-
import useFormat from
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
import useFormat from "./useFormat.js";
|
|
3
3
|
|
|
4
4
|
//This hook returns should we show the custom context menu and where to show it.
|
|
5
5
|
const useContextMenu = (editor, format, setSelection) => {
|
|
6
6
|
const isFormat = useFormat(editor, format);
|
|
7
7
|
const [showMenu, setShowMenu] = useState(false);
|
|
8
8
|
const [menuLocation, setMenuLocation] = useState({
|
|
9
|
-
top:
|
|
10
|
-
left:
|
|
9
|
+
top: "0px",
|
|
10
|
+
left: "0px"
|
|
11
11
|
});
|
|
12
12
|
const handleClick = () => {
|
|
13
13
|
setShowMenu(false);
|
|
@@ -25,11 +25,11 @@ const useContextMenu = (editor, format, setSelection) => {
|
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
27
|
useEffect(() => {
|
|
28
|
-
document.addEventListener(
|
|
29
|
-
document.addEventListener(
|
|
28
|
+
document.addEventListener("click", handleClick);
|
|
29
|
+
document.addEventListener("contextmenu", handleContextMenu);
|
|
30
30
|
return () => {
|
|
31
|
-
document.removeEventListener(
|
|
32
|
-
document.removeEventListener(
|
|
31
|
+
document.removeEventListener("click", handleClick);
|
|
32
|
+
document.removeEventListener("contextmenu", handleContextMenu);
|
|
33
33
|
};
|
|
34
34
|
}, [isFormat]);
|
|
35
35
|
return [showMenu, menuLocation];
|
|
@@ -13,4 +13,20 @@ export const formatDate = (date, format = "MM/DD/YYYY") => {
|
|
|
13
13
|
default:
|
|
14
14
|
return [year, month, day].join("-");
|
|
15
15
|
}
|
|
16
|
+
};
|
|
17
|
+
export const convertBase64 = file => {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
if (file) {
|
|
20
|
+
const fileReader = new FileReader();
|
|
21
|
+
fileReader.readAsDataURL(file);
|
|
22
|
+
fileReader.onload = () => {
|
|
23
|
+
resolve(fileReader.result);
|
|
24
|
+
};
|
|
25
|
+
fileReader.onerror = error => {
|
|
26
|
+
reject(error);
|
|
27
|
+
};
|
|
28
|
+
} else {
|
|
29
|
+
resolve("");
|
|
30
|
+
}
|
|
31
|
+
});
|
|
16
32
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Transforms } from "slate";
|
|
2
|
+
export const insertImageText = (editor, path) => {
|
|
3
|
+
const imageText = {
|
|
4
|
+
type: "image-text",
|
|
5
|
+
grid: "container",
|
|
6
|
+
children: [{
|
|
7
|
+
type: "paragraph",
|
|
8
|
+
children: [{
|
|
9
|
+
text: "sample text"
|
|
10
|
+
}]
|
|
11
|
+
}]
|
|
12
|
+
};
|
|
13
|
+
if (path) {
|
|
14
|
+
Transforms.insertNodes(editor, imageText, {
|
|
15
|
+
at: path
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return imageText;
|
|
19
|
+
};
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { Transforms, Editor, Range, Element, Path } from "slate";
|
|
2
|
+
const prefixKey = (obj, pk = "") => {
|
|
3
|
+
return Object.keys(obj).reduce((a, b) => {
|
|
4
|
+
a[`${pk}${b}`] = obj[b];
|
|
5
|
+
return a;
|
|
6
|
+
}, {});
|
|
7
|
+
};
|
|
8
|
+
const parseByPrefixKey = (obj, pk = "") => {
|
|
9
|
+
return Object.keys(obj).reduce((a, b) => {
|
|
10
|
+
if (b.indexOf(pk) !== -1 && pk) {
|
|
11
|
+
const key = b.split(pk)[1];
|
|
12
|
+
a[key] = obj[b];
|
|
13
|
+
}
|
|
14
|
+
return a;
|
|
15
|
+
}, {});
|
|
16
|
+
};
|
|
2
17
|
export class TableUtil {
|
|
3
18
|
constructor(editor) {
|
|
4
19
|
this.editor = editor;
|
|
@@ -64,6 +79,31 @@ export class TableUtil {
|
|
|
64
79
|
}
|
|
65
80
|
}
|
|
66
81
|
};
|
|
82
|
+
deleteRow = () => {
|
|
83
|
+
const {
|
|
84
|
+
selection
|
|
85
|
+
} = this.editor;
|
|
86
|
+
if (!!selection && Range.isCollapsed(selection)) {
|
|
87
|
+
const [tableNode] = Editor.nodes(this.editor, {
|
|
88
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-row"
|
|
89
|
+
});
|
|
90
|
+
if (tableNode) {
|
|
91
|
+
const [[table, tablePath]] = Editor.nodes(this.editor, {
|
|
92
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
|
93
|
+
});
|
|
94
|
+
const [, currentRow] = tableNode;
|
|
95
|
+
const path = currentRow;
|
|
96
|
+
Transforms.removeNodes(this.editor, {
|
|
97
|
+
at: path
|
|
98
|
+
});
|
|
99
|
+
Transforms.setNodes(this.editor, {
|
|
100
|
+
rows: table.rows - 1
|
|
101
|
+
}, {
|
|
102
|
+
at: tablePath
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
67
107
|
insertColumn = action => {
|
|
68
108
|
const {
|
|
69
109
|
selection
|
|
@@ -95,6 +135,138 @@ export class TableUtil {
|
|
|
95
135
|
}
|
|
96
136
|
}
|
|
97
137
|
};
|
|
138
|
+
deleteColumn = () => {
|
|
139
|
+
const {
|
|
140
|
+
selection
|
|
141
|
+
} = this.editor;
|
|
142
|
+
if (!!selection && Range.isCollapsed(selection)) {
|
|
143
|
+
const [tableNode] = Editor.nodes(this.editor, {
|
|
144
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
|
|
145
|
+
});
|
|
146
|
+
if (tableNode) {
|
|
147
|
+
const [[table, tablePath]] = Editor.nodes(this.editor, {
|
|
148
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
|
149
|
+
});
|
|
150
|
+
const [, currentCell] = tableNode;
|
|
151
|
+
const startPath = currentCell;
|
|
152
|
+
|
|
153
|
+
// The last two indices of the path represents the row and column. We need to add one cell to each row starting from the first row
|
|
154
|
+
startPath[startPath.length - 2] = 0;
|
|
155
|
+
for (let row = 0; row < table.rows; row++) {
|
|
156
|
+
Transforms.removeNodes(this.editor, {
|
|
157
|
+
at: startPath
|
|
158
|
+
});
|
|
159
|
+
startPath[startPath.length - 2]++;
|
|
160
|
+
}
|
|
161
|
+
Transforms.setNodes(this.editor, {
|
|
162
|
+
columns: table.columns - 1
|
|
163
|
+
}, {
|
|
164
|
+
at: tablePath
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
updateTableStyle = (styleProps, paths) => {
|
|
170
|
+
try {
|
|
171
|
+
const {
|
|
172
|
+
selection
|
|
173
|
+
} = this.editor;
|
|
174
|
+
if (!!selection && Range.isCollapsed(selection)) {
|
|
175
|
+
console.log("styleProps", styleProps);
|
|
176
|
+
const tableProps = parseByPrefixKey(styleProps, "table.");
|
|
177
|
+
const rowProps = parseByPrefixKey(styleProps, "row.");
|
|
178
|
+
const cellProps = parseByPrefixKey(styleProps, "col.");
|
|
179
|
+
const {
|
|
180
|
+
currentCellPath,
|
|
181
|
+
currentRowPath,
|
|
182
|
+
currentTablePath
|
|
183
|
+
} = paths;
|
|
184
|
+
console.log(tableProps, rowProps, cellProps);
|
|
185
|
+
Transforms.setNodes(this.editor, {
|
|
186
|
+
...tableProps
|
|
187
|
+
}, {
|
|
188
|
+
at: currentTablePath
|
|
189
|
+
});
|
|
190
|
+
Transforms.setNodes(this.editor, {
|
|
191
|
+
...rowProps,
|
|
192
|
+
tableBorder: tableProps?.borderColor
|
|
193
|
+
}, {
|
|
194
|
+
at: currentRowPath
|
|
195
|
+
});
|
|
196
|
+
Transforms.setNodes(this.editor, {
|
|
197
|
+
...cellProps,
|
|
198
|
+
rowBorder: rowProps?.borderColor,
|
|
199
|
+
tableBorder: tableProps?.borderColor
|
|
200
|
+
}, {
|
|
201
|
+
at: currentCellPath
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
} catch (err) {
|
|
205
|
+
console.log(err);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
getTableProps = () => {
|
|
209
|
+
const {
|
|
210
|
+
selection
|
|
211
|
+
} = this.editor;
|
|
212
|
+
if (!!selection && Range.isCollapsed(selection)) {
|
|
213
|
+
const [tableNode] = Editor.nodes(this.editor, {
|
|
214
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
|
215
|
+
});
|
|
216
|
+
const [tableCellNode] = Editor.nodes(this.editor, {
|
|
217
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
|
|
218
|
+
});
|
|
219
|
+
const [tableRowNode] = Editor.nodes(this.editor, {
|
|
220
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-row"
|
|
221
|
+
});
|
|
222
|
+
if (tableNode && tableCellNode && tableRowNode) {
|
|
223
|
+
const [currentTable, currentTablePath] = tableNode;
|
|
224
|
+
const [currentCell, currentCellPath] = tableCellNode;
|
|
225
|
+
const [currentRow, currentRowPath] = tableRowNode;
|
|
226
|
+
const startPath = currentCell;
|
|
227
|
+
Transforms.setNodes(this.editor, {
|
|
228
|
+
cellBgColor: "#FFFFFF"
|
|
229
|
+
}, {
|
|
230
|
+
at: startPath
|
|
231
|
+
});
|
|
232
|
+
if (currentTable && currentCell && currentRow) {
|
|
233
|
+
const currentTableProps = {
|
|
234
|
+
...currentTable
|
|
235
|
+
};
|
|
236
|
+
delete currentTableProps.children;
|
|
237
|
+
delete currentTableProps.type;
|
|
238
|
+
const currentCellProps = {
|
|
239
|
+
...currentCell
|
|
240
|
+
};
|
|
241
|
+
delete currentCellProps.children;
|
|
242
|
+
delete currentCellProps.type;
|
|
243
|
+
const currentRowProps = {
|
|
244
|
+
...currentRow
|
|
245
|
+
};
|
|
246
|
+
delete currentRowProps.children;
|
|
247
|
+
delete currentRowProps.type;
|
|
248
|
+
return {
|
|
249
|
+
styleProps: {
|
|
250
|
+
...prefixKey({
|
|
251
|
+
...currentTableProps
|
|
252
|
+
}, "table."),
|
|
253
|
+
...prefixKey({
|
|
254
|
+
...currentRowProps
|
|
255
|
+
}, "row."),
|
|
256
|
+
...prefixKey({
|
|
257
|
+
...currentCellProps
|
|
258
|
+
}, "col.")
|
|
259
|
+
},
|
|
260
|
+
currentCellPath,
|
|
261
|
+
currentRowPath,
|
|
262
|
+
currentTablePath
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
};
|
|
98
270
|
}
|
|
99
271
|
const createRow = cellText => {
|
|
100
272
|
const newRow = Array.from(cellText, value => createTableCell(value));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flozy/editor",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "An Editor for flozy app brain",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"react-katex": "^3.0.1",
|
|
28
28
|
"react-scripts": "5.0.1",
|
|
29
29
|
"react-signature-canvas": "^1.0.6",
|
|
30
|
+
"react-slick": "^0.29.0",
|
|
30
31
|
"slate": "^0.94.1",
|
|
31
32
|
"slate-history": "^0.93.0",
|
|
32
33
|
"slate-react": "^0.98.3",
|