@flozy/editor 5.7.1 → 5.7.3
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 +4 -4
- package/dist/Editor/Editor.css +8 -2
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +12 -9
- package/dist/Editor/Elements/Signature/SignaturePopup.js +3 -1
- package/dist/Editor/Elements/Table/DragButton.js +2 -1
- package/dist/Editor/Elements/Table/TableCell.js +4 -2
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +25 -7
- package/dist/Editor/utils/helper.js +12 -8
- package/package.json +1 -1
@@ -27,7 +27,7 @@ import DragAndDrop from "./common/DnD";
|
|
27
27
|
import Section from "./common/Section";
|
28
28
|
import decorators from "./utils/Decorators";
|
29
29
|
import { getTRBLBreakPoints } from "./helper/theme";
|
30
|
-
import { getInitialValue, handleInsertLastElement, isFreeGrid, isFreeGridFragment,
|
30
|
+
import { getInitialValue, handleInsertLastElement, isFreeGrid, isFreeGridFragment, isRestrictedNode, outsideEditorClickLabel } from "./utils/helper";
|
31
31
|
import useWindowResize from "./hooks/useWindowResize";
|
32
32
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
33
33
|
import RnDCopy from "./common/RnD/RnDCopy";
|
@@ -388,8 +388,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
388
388
|
} else if (event.key === "ArrowDown" && otherProps?.tagName !== "Pages") {
|
389
389
|
upDownArrowKeyEvents(event, editor);
|
390
390
|
} else if (event.key === "Backspace") {
|
391
|
-
const
|
392
|
-
if (
|
391
|
+
const isNodeRestricted = isRestrictedNode(event, editor);
|
392
|
+
if (isNodeRestricted) {
|
393
393
|
return;
|
394
394
|
}
|
395
395
|
const {
|
@@ -539,7 +539,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
539
539
|
transition: "all 0.3s",
|
540
540
|
minHeight: "87%",
|
541
541
|
maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto",
|
542
|
-
paddingTop: hasTopBanner() ?
|
542
|
+
paddingTop: hasTopBanner() ? "20px !important" : isMobile ? "10px !important" : ""
|
543
543
|
},
|
544
544
|
"data-info": outsideEditorClickLabel,
|
545
545
|
children: [/*#__PURE__*/_jsx(Editable, {
|
package/dist/Editor/Editor.css
CHANGED
@@ -397,6 +397,12 @@ blockquote {
|
|
397
397
|
padding: 0px 5px 0px 2px !important
|
398
398
|
}
|
399
399
|
|
400
|
+
.signatureActionBtnContainer {
|
401
|
+
display: flex;
|
402
|
+
align-items: center;
|
403
|
+
gap: 1rem;
|
404
|
+
}
|
405
|
+
|
400
406
|
.signature-tab {
|
401
407
|
display: flex;
|
402
408
|
align-items: center;
|
@@ -605,8 +611,8 @@ blockquote {
|
|
605
611
|
display: block !important;
|
606
612
|
}
|
607
613
|
|
608
|
-
.dialog-actions-si .
|
609
|
-
margin-top:
|
614
|
+
.dialog-actions-si .signatureActionBtnContainer {
|
615
|
+
margin-top: 1.4rem;
|
610
616
|
}
|
611
617
|
}
|
612
618
|
|
@@ -20,7 +20,7 @@ const useTableStyles = (theme, appTheme) => ({
|
|
20
20
|
"& .fillStroke": {
|
21
21
|
stroke: appTheme?.palette?.editor?.tv_stroke
|
22
22
|
},
|
23
|
-
|
23
|
+
"& path": {
|
24
24
|
stroke: appTheme?.palette?.editor?.tv_text
|
25
25
|
}
|
26
26
|
}
|
@@ -30,7 +30,10 @@ const useTableStyles = (theme, appTheme) => ({
|
|
30
30
|
"& input": {
|
31
31
|
color: appTheme?.palette?.editor?.tv_text_primary,
|
32
32
|
background: "transparent",
|
33
|
-
fontSize:
|
33
|
+
fontSize: "14px"
|
34
|
+
},
|
35
|
+
"& .Mui-disabled": {
|
36
|
+
"-webkit-text-fill-color": `${appTheme?.palette?.editor?.tv_text_primary} !important`
|
34
37
|
}
|
35
38
|
},
|
36
39
|
"& th, tr, td": {
|
@@ -39,19 +42,19 @@ const useTableStyles = (theme, appTheme) => ({
|
|
39
42
|
"& .tv-act-btn": {
|
40
43
|
color: appTheme?.palette?.editor?.tv_text,
|
41
44
|
textTransform: "none",
|
42
|
-
|
45
|
+
"& .MuiButton-startIcon": {
|
43
46
|
background: appTheme?.palette?.editor?.tv_ico_bg,
|
44
|
-
borderRadius:
|
45
|
-
padding:
|
47
|
+
borderRadius: "4px",
|
48
|
+
padding: "4px",
|
46
49
|
"& svg": {
|
47
|
-
width:
|
48
|
-
height:
|
50
|
+
width: "14px",
|
51
|
+
height: "14px"
|
49
52
|
}
|
50
53
|
},
|
51
54
|
"&.ico": {
|
52
55
|
"& svg": {
|
53
56
|
color: appTheme?.palette?.editor?.tv_text,
|
54
|
-
|
57
|
+
"& path": {
|
55
58
|
stroke: appTheme?.palette?.editor?.tv_text
|
56
59
|
}
|
57
60
|
}
|
@@ -60,7 +63,7 @@ const useTableStyles = (theme, appTheme) => ({
|
|
60
63
|
color: appTheme?.palette?.editor?.tv_hover_text,
|
61
64
|
"& svg": {
|
62
65
|
color: appTheme?.palette?.editor?.tv_hover_text,
|
63
|
-
|
66
|
+
"& path": {
|
64
67
|
stroke: appTheme?.palette?.editor?.tv_hover_text
|
65
68
|
}
|
66
69
|
}
|
@@ -512,7 +512,9 @@ const SignaturePopup = props => {
|
|
512
512
|
})
|
513
513
|
})
|
514
514
|
})]
|
515
|
-
}) : null, /*#__PURE__*/_jsxs(
|
515
|
+
}) : null, /*#__PURE__*/_jsxs(Box, {
|
516
|
+
component: "div",
|
517
|
+
className: "signatureActionBtnContainer",
|
516
518
|
children: [!readOnly ? /*#__PURE__*/_jsx(Button, {
|
517
519
|
onClick: handleClear,
|
518
520
|
className: `secondaryBtn actionBtn deleteBtn deleteButtonSignature`,
|
@@ -288,6 +288,8 @@ const TableCell = props => {
|
|
288
288
|
Transforms.select(editor, selection);
|
289
289
|
};
|
290
290
|
const onRowDrag = () => {
|
291
|
+
selectCurrentCell();
|
292
|
+
const [rowNode] = getNodeWithType(editor, "table-row", path);
|
291
293
|
const {
|
292
294
|
children
|
293
295
|
} = rowNode[0] || {};
|
@@ -299,9 +301,10 @@ const TableCell = props => {
|
|
299
301
|
endCellPath: rowEndCell,
|
300
302
|
isDragging: false
|
301
303
|
});
|
302
|
-
selectCurrentCell();
|
303
304
|
};
|
304
305
|
const onColDrag = () => {
|
306
|
+
selectCurrentCell();
|
307
|
+
const [tableNode] = getNodeWithType(editor, "table", path);
|
305
308
|
const [tableData, tablePath] = tableNode;
|
306
309
|
const {
|
307
310
|
rows
|
@@ -313,7 +316,6 @@ const TableCell = props => {
|
|
313
316
|
endCellPath: endColCell,
|
314
317
|
isDragging: false
|
315
318
|
});
|
316
|
-
selectCurrentCell();
|
317
319
|
};
|
318
320
|
const handleToolAction = (value, option, dragType) => {
|
319
321
|
const isRowDrag = dragType === "row";
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Transforms, Node, Path } from "slate";
|
2
2
|
import { ReactEditor } from "slate-react";
|
3
|
+
import { handleNegativeInteger } from "../../../utils/helper";
|
3
4
|
export const ROW_HEIGHT = 50;
|
4
5
|
const MARGIN_OF = {
|
5
6
|
xs: 160,
|
@@ -75,7 +76,7 @@ const reRenderChildNodes = (editor, path) => {
|
|
75
76
|
console.log(err);
|
76
77
|
}
|
77
78
|
};
|
78
|
-
function isContainerElement(editor, moveTopath, props) {
|
79
|
+
function isContainerElement(editor, moveTopath, props, appenBp) {
|
79
80
|
try {
|
80
81
|
const {
|
81
82
|
path,
|
@@ -91,21 +92,32 @@ function isContainerElement(editor, moveTopath, props) {
|
|
91
92
|
parentNode = Node.get(editor, Path.parent(dragItemPath));
|
92
93
|
}
|
93
94
|
const moveToNode = Node.get(editor, moveTopath);
|
95
|
+
const leftOfMoveToNode = moveToNode[`left${appenBp}`];
|
94
96
|
if (moveToNode.type === "freegridBox") {
|
95
97
|
if (parentNode.type === "freegridBox") {
|
96
98
|
// same box
|
97
99
|
if (parentPath === dragOver) {
|
98
100
|
return props.calX;
|
99
101
|
} else {
|
102
|
+
const moveToDom = ReactEditor.toDOMNode(editor, moveToNode);
|
103
|
+
const {
|
104
|
+
left
|
105
|
+
} = moveToDom?.getBoundingClientRect() || {};
|
106
|
+
const borderLeftWidth = getBorderWidth(moveToDom, "borderLeftWidth");
|
107
|
+
|
100
108
|
// for different box
|
101
|
-
return parseInt(props.x -
|
109
|
+
return parseInt(props.x - props.diffX - left - borderLeftWidth);
|
102
110
|
}
|
103
111
|
} else {
|
104
|
-
return props.calX -
|
112
|
+
return props.calX - leftOfMoveToNode;
|
105
113
|
}
|
106
114
|
} else if (moveToNode.type === "freegrid") {
|
107
115
|
if (parentNode.type === "freegridBox") {
|
108
|
-
|
116
|
+
const boundaryLineEle = document.querySelector(".rnd-guideline-lv");
|
117
|
+
const {
|
118
|
+
left
|
119
|
+
} = boundaryLineEle?.getBoundingClientRect() || {};
|
120
|
+
return parseInt(props.x - props.diffX - left);
|
109
121
|
} else {
|
110
122
|
return props.calX;
|
111
123
|
}
|
@@ -133,14 +145,16 @@ export function onDropItem(props, parentClass) {
|
|
133
145
|
const from = parentPath.split("|").map(m => parseInt(m));
|
134
146
|
let newPath = [];
|
135
147
|
newPath = moveTo;
|
136
|
-
const
|
148
|
+
const appenBp = breakpoint === "lg" ? "" : `_${breakpoint}`;
|
149
|
+
const cCalx = isContainerElement(editor, moveTo, props, appenBp);
|
137
150
|
// const posX = parseInt(
|
138
151
|
// cx - window.innerWidth / 2 + MARGIN_OF[breakpoint] - diffX
|
139
152
|
// );
|
140
153
|
const toSectionNode = Node.get(editor, newPath);
|
141
154
|
const addToSectionDOM = ReactEditor.toDOMNode(editor, toSectionNode);
|
155
|
+
const borderTopWidth = getBorderWidth(addToSectionDOM, "borderTopWidth");
|
142
156
|
const rect = addToSectionDOM.getBoundingClientRect();
|
143
|
-
const y = endPosition.y - startPosition.diffY - rect.top;
|
157
|
+
const y = handleNegativeInteger(endPosition.y - startPosition.diffY - rect.top - borderTopWidth);
|
144
158
|
|
145
159
|
// Calculate grid position
|
146
160
|
const row = Math.floor(y / ROW_HEIGHT) + 1;
|
@@ -150,7 +164,6 @@ export function onDropItem(props, parentClass) {
|
|
150
164
|
|
151
165
|
// Update grid area
|
152
166
|
const gridArea = `${row} / 1 / ${row + 1} / 2`;
|
153
|
-
const appenBp = breakpoint === "lg" ? "" : `_${breakpoint}`;
|
154
167
|
Transforms.setNodes(editor, {
|
155
168
|
[`gridArea${appenBp}`]: gridArea,
|
156
169
|
[`left${appenBp}`]: cCalx,
|
@@ -188,4 +201,9 @@ export function onDropItem(props, parentClass) {
|
|
188
201
|
export function calculateGridArea(y) {
|
189
202
|
const row = Math.floor(y / ROW_HEIGHT) + 1;
|
190
203
|
return `${row} / 1 / ${row + 1} / 2`;
|
204
|
+
}
|
205
|
+
export function getBorderWidth(dom, property) {
|
206
|
+
const styles = getComputedStyle(dom);
|
207
|
+
const borderWidth = parseFloat(styles[property]);
|
208
|
+
return borderWidth;
|
191
209
|
}
|
@@ -593,8 +593,9 @@ export const getPreviousNode = editor => {
|
|
593
593
|
return;
|
594
594
|
}
|
595
595
|
};
|
596
|
-
|
597
|
-
|
596
|
+
const isRestricted = node => node?.type === "page-settings" || node?.type === "site-settings" || node?.children?.some(child => child.type === "dataView");
|
597
|
+
export const isRestrictedNode = (event, editor) => {
|
598
|
+
let isNodeRestricted = false;
|
598
599
|
try {
|
599
600
|
const {
|
600
601
|
selection
|
@@ -607,21 +608,21 @@ export const isPageSettings = (event, editor) => {
|
|
607
608
|
previousNode,
|
608
609
|
previousPath
|
609
610
|
} = getPreviousNode(editor) || {};
|
610
|
-
if (previousNode
|
611
|
+
if (isRestricted(previousNode)) {
|
611
612
|
event.preventDefault(); // stops deleting backward
|
612
613
|
|
613
614
|
// move the cursor to node which is before page-settings node
|
614
615
|
const pathBeforePageSettings = Path.previous(previousPath);
|
615
616
|
const endPath = Editor.end(editor, pathBeforePageSettings);
|
616
617
|
Transforms.select(editor, endPath);
|
617
|
-
|
618
|
+
isNodeRestricted = true;
|
618
619
|
}
|
619
620
|
}
|
620
|
-
return
|
621
|
+
return isNodeRestricted;
|
621
622
|
} catch (err) {
|
622
623
|
// if there is no previous node error throws, user reached the starting node and startting position
|
623
|
-
|
624
|
-
return
|
624
|
+
isNodeRestricted = true;
|
625
|
+
return isNodeRestricted;
|
625
626
|
}
|
626
627
|
};
|
627
628
|
export const insertLineBreakAtEndOfPath = (editor, path) => {
|
@@ -711,4 +712,7 @@ export const getSlateDom = (editor, range) => {
|
|
711
712
|
} catch (err) {
|
712
713
|
console.log(err);
|
713
714
|
}
|
714
|
-
};
|
715
|
+
};
|
716
|
+
export function handleNegativeInteger(val) {
|
717
|
+
return val < 0 ? 0 : val;
|
718
|
+
}
|