@flozy/editor 4.2.1 → 4.2.2
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/CommonEditor.js +28 -12
- package/dist/Editor/Elements/Embed/Video.js +15 -6
- package/dist/Editor/Elements/Form/Form.js +1 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +7 -0
- package/dist/Editor/Elements/Table/Table.js +16 -3
- package/dist/Editor/common/FontLoader/FontLoader.js +2 -1
- package/dist/Editor/common/RnD/DragOver/index.js +1 -1
- package/dist/Editor/common/RnD/index.js +1 -1
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +12 -0
- package/dist/Editor/common/StyleBuilder/tableStyle.js +9 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
2
|
import React, { useRef, useCallback, useEffect, useMemo, useState, forwardRef, useImperativeHandle } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { createEditor, Transforms } from "slate";
|
|
4
|
+
import { createEditor, Transforms, Range } from "slate";
|
|
5
5
|
import { Slate, Editable, ReactEditor } from "slate-react";
|
|
6
6
|
import { useDebounce, useDebouncedCallback } from "use-debounce";
|
|
7
7
|
import { getMarked, getBlock } from "./utils/SlateUtilityFunctions";
|
|
@@ -365,6 +365,20 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
365
365
|
});
|
|
366
366
|
} else if (event.key === "Enter") {
|
|
367
367
|
enterEvent(event, editor, customProps?.isMobile);
|
|
368
|
+
} else if (event.key === 'Backspace') {
|
|
369
|
+
const {
|
|
370
|
+
selection
|
|
371
|
+
} = editor;
|
|
372
|
+
event.preventDefault();
|
|
373
|
+
if (selection) {
|
|
374
|
+
if (!Range.isCollapsed(selection)) {
|
|
375
|
+
editor.deleteFragment();
|
|
376
|
+
} else {
|
|
377
|
+
editor.deleteBackward({
|
|
378
|
+
unit: 'character'
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
}
|
|
368
382
|
}
|
|
369
383
|
}, [chars, editor, target, mentions, setMentions, search, type, mentionsRef]);
|
|
370
384
|
const Overlay = collaborativeEditor && !isReadOnly ? RemoteCursorOverlay : React.Fragment;
|
|
@@ -425,18 +439,20 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
425
439
|
};
|
|
426
440
|
const handleCursorScroll = container => {
|
|
427
441
|
try {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
442
|
+
if (!customProps?.isMobile) {
|
|
443
|
+
const selection = window?.getSelection();
|
|
444
|
+
if (selection && selection.rangeCount > 0) {
|
|
445
|
+
const cursorPosition = selection.getRangeAt(0)?.getBoundingClientRect();
|
|
446
|
+
const containerBottom = container?.getBoundingClientRect()?.bottom;
|
|
447
|
+
if (cursorPosition && cursorPosition.bottom > containerBottom - 250) {
|
|
448
|
+
container?.scrollBy({
|
|
449
|
+
top: 200,
|
|
450
|
+
behavior: "smooth"
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
} else {
|
|
454
|
+
console.warn('No valid selection range found');
|
|
437
455
|
}
|
|
438
|
-
} else {
|
|
439
|
-
console.warn('No valid selection range found');
|
|
440
456
|
}
|
|
441
457
|
} catch (err) {
|
|
442
458
|
console.log('handleCursorScroll', err);
|
|
@@ -10,7 +10,7 @@ import EmbedPopup from "./EmbedPopup";
|
|
|
10
10
|
import { GridSettingsIcon } from "../../common/iconslist";
|
|
11
11
|
import { gradientBorder } from "../../utils/helper";
|
|
12
12
|
import { getEmbedURL } from "../../helper";
|
|
13
|
-
import { getBreakPointsValue, groupByBreakpoint } from "../../helper/theme";
|
|
13
|
+
import { getBreakPointsValue, getTRBLBreakPoints, groupByBreakpoint } from "../../helper/theme";
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
const Video = ({
|
|
@@ -29,7 +29,9 @@ const Video = ({
|
|
|
29
29
|
borderStyle,
|
|
30
30
|
url,
|
|
31
31
|
xsHidden,
|
|
32
|
-
width: oldWidth
|
|
32
|
+
width: oldWidth,
|
|
33
|
+
bannerSpacing,
|
|
34
|
+
bgColor
|
|
33
35
|
} = element;
|
|
34
36
|
const editor = useSlateStatic();
|
|
35
37
|
const [openSetttings, setOpenSettings] = useState(false);
|
|
@@ -139,6 +141,14 @@ const Video = ({
|
|
|
139
141
|
}
|
|
140
142
|
};
|
|
141
143
|
const embedURL = getEmbedURL(element);
|
|
144
|
+
const videoSX = groupByBreakpoint({
|
|
145
|
+
borderRadius: {
|
|
146
|
+
...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
|
|
147
|
+
},
|
|
148
|
+
padding: {
|
|
149
|
+
...getTRBLBreakPoints(bannerSpacing)
|
|
150
|
+
}
|
|
151
|
+
}, theme);
|
|
142
152
|
const VideoContent = () => {
|
|
143
153
|
return resizing ? /*#__PURE__*/_jsx("div", {
|
|
144
154
|
style: {
|
|
@@ -164,10 +174,9 @@ const Video = ({
|
|
|
164
174
|
left: "0px",
|
|
165
175
|
...(gradientBorder(borderColor) || {}),
|
|
166
176
|
borderWidth: borderWidth || "1px",
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
borderStyle: borderStyle || "solid"
|
|
177
|
+
borderStyle: borderStyle || "solid",
|
|
178
|
+
background: bgColor || "transparent",
|
|
179
|
+
...videoSX
|
|
171
180
|
},
|
|
172
181
|
src: embedURL,
|
|
173
182
|
title: alt
|
|
@@ -194,6 +194,13 @@ const useFreeGridStyles = ({
|
|
|
194
194
|
}
|
|
195
195
|
},
|
|
196
196
|
"& .fgi_type_table": {
|
|
197
|
+
overflowX: "auto",
|
|
198
|
+
"& table": {
|
|
199
|
+
"&.readOnly": {
|
|
200
|
+
tableLayout: "fixed",
|
|
201
|
+
width: "100% !important"
|
|
202
|
+
}
|
|
203
|
+
},
|
|
197
204
|
"& .tableToolBar": {
|
|
198
205
|
right: "0px",
|
|
199
206
|
left: "auto",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { Transforms } from "slate";
|
|
3
3
|
import { useSelected, useSlateStatic } from "slate-react";
|
|
4
|
-
import { Box, IconButton, Tooltip, Table as TableComp, TableBody } from "@mui/material";
|
|
4
|
+
import { Box, IconButton, Tooltip, Table as TableComp, TableBody, useTheme } from "@mui/material";
|
|
5
5
|
import AlignHorizontalLeftIcon from "@mui/icons-material/AlignHorizontalLeft";
|
|
6
6
|
import AlignHorizontalRightIcon from "@mui/icons-material/AlignHorizontalRight";
|
|
7
7
|
import AlignVerticalTopIcon from "@mui/icons-material/AlignVerticalTop";
|
|
@@ -16,6 +16,7 @@ import TablePopup from "./TablePopup";
|
|
|
16
16
|
import { useEditorSelection } from "../../hooks/useMouseMove";
|
|
17
17
|
import TableStyles from "./Styles";
|
|
18
18
|
import "./table.css";
|
|
19
|
+
import { groupByBreakpoint } from "../../helper/theme";
|
|
19
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
22
|
const TABLE_MENUS = [{
|
|
@@ -72,6 +73,7 @@ const TABLE_MENUS = [{
|
|
|
72
73
|
}
|
|
73
74
|
}];
|
|
74
75
|
const Table = props => {
|
|
76
|
+
const theme = useTheme();
|
|
75
77
|
const {
|
|
76
78
|
element,
|
|
77
79
|
attributes,
|
|
@@ -86,7 +88,8 @@ const Table = props => {
|
|
|
86
88
|
const [exandTools, setExpandTools] = useState(false);
|
|
87
89
|
const {
|
|
88
90
|
bgColor,
|
|
89
|
-
borderColor
|
|
91
|
+
borderColor,
|
|
92
|
+
xsHidden
|
|
90
93
|
} = element;
|
|
91
94
|
const editor = useSlateStatic();
|
|
92
95
|
const selected = useSelected();
|
|
@@ -174,6 +177,12 @@ const Table = props => {
|
|
|
174
177
|
const onClose = () => {
|
|
175
178
|
setOpenSettings(false);
|
|
176
179
|
};
|
|
180
|
+
const tableSX = groupByBreakpoint({
|
|
181
|
+
display: {
|
|
182
|
+
xs: xsHidden ? "none" : "inline-block",
|
|
183
|
+
lg: "inline-block"
|
|
184
|
+
}
|
|
185
|
+
}, theme);
|
|
177
186
|
return /*#__PURE__*/_jsxs("div", {
|
|
178
187
|
style: {
|
|
179
188
|
minWidth: "100%",
|
|
@@ -181,7 +190,11 @@ const Table = props => {
|
|
|
181
190
|
position: "relative"
|
|
182
191
|
},
|
|
183
192
|
children: [/*#__PURE__*/_jsx(TableComp, {
|
|
184
|
-
|
|
193
|
+
className: readOnly ? "readOnly" : "",
|
|
194
|
+
sx: {
|
|
195
|
+
...classes.table,
|
|
196
|
+
...tableSX
|
|
197
|
+
},
|
|
185
198
|
style: {
|
|
186
199
|
background: bgColor,
|
|
187
200
|
border: borderColor ? `1px solid ${borderColor}` : "",
|
|
@@ -25,6 +25,7 @@ const FontLoader = props => {
|
|
|
25
25
|
families: [...batchWithWeights]
|
|
26
26
|
},
|
|
27
27
|
classes: false,
|
|
28
|
+
timeout: 2000,
|
|
28
29
|
active: () => {
|
|
29
30
|
console.log(`Fonts loaded successfully: ${batch}`);
|
|
30
31
|
currentIndex += batchSize;
|
|
@@ -78,7 +79,7 @@ const FontLoader = props => {
|
|
|
78
79
|
families = Array.from(fontSet);
|
|
79
80
|
loadFontsInBatches(families);
|
|
80
81
|
}
|
|
81
|
-
}, [
|
|
82
|
+
}, []);
|
|
82
83
|
return null;
|
|
83
84
|
};
|
|
84
85
|
export default FontLoader;
|
|
@@ -22,7 +22,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
22
22
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
23
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
24
|
const ITEM_TYPES = ["child", "parent-container"];
|
|
25
|
-
const EDIT_MODES = ["text", "form"];
|
|
25
|
+
const EDIT_MODES = ["text", "form", "table"];
|
|
26
26
|
let hover_on = new Set();
|
|
27
27
|
const RnD = props => {
|
|
28
28
|
const rndRef = useRef(null);
|
|
@@ -24,6 +24,10 @@ const embedVideoStyle = [{
|
|
|
24
24
|
tab: "Border",
|
|
25
25
|
value: "border",
|
|
26
26
|
fields: [{
|
|
27
|
+
label: "Background Color",
|
|
28
|
+
key: "bgColor",
|
|
29
|
+
type: "color"
|
|
30
|
+
}, {
|
|
27
31
|
label: "Border Color",
|
|
28
32
|
key: "borderColor",
|
|
29
33
|
type: "color"
|
|
@@ -56,5 +60,13 @@ const embedVideoStyle = [{
|
|
|
56
60
|
});
|
|
57
61
|
}
|
|
58
62
|
}]
|
|
63
|
+
}, {
|
|
64
|
+
tab: "Banner Spacing",
|
|
65
|
+
value: "bannerSpacing",
|
|
66
|
+
fields: [{
|
|
67
|
+
label: "Banner Spacing",
|
|
68
|
+
key: "bannerSpacing",
|
|
69
|
+
type: "bannerSpacing"
|
|
70
|
+
}]
|
|
59
71
|
}];
|
|
60
72
|
export default embedVideoStyle;
|
|
@@ -38,5 +38,14 @@ const tableStyle = [{
|
|
|
38
38
|
key: "col.borderColor",
|
|
39
39
|
type: "color"
|
|
40
40
|
}]
|
|
41
|
+
}, {
|
|
42
|
+
tab: "Visibility",
|
|
43
|
+
value: "visibility",
|
|
44
|
+
fields: [{
|
|
45
|
+
label: "Hide on Mobile",
|
|
46
|
+
key: "table.xsHidden",
|
|
47
|
+
type: "selectBox",
|
|
48
|
+
placeholder: "Hide on Mobile"
|
|
49
|
+
}]
|
|
41
50
|
}];
|
|
42
51
|
export default tableStyle;
|