@flozy/editor 4.5.8 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +8 -0
- package/dist/Editor/CommonEditor.js +16 -15
- package/dist/Editor/Editor.css +19 -1
- package/dist/Editor/Elements/AI/AIInput.js +4 -5
- package/dist/Editor/Elements/AI/PopoverAIInput.js +40 -29
- package/dist/Editor/Elements/AI/Styles.js +1 -1
- package/dist/Editor/Elements/Button/EditorButton.js +8 -4
- package/dist/Editor/Elements/Embed/Embed.css +1 -1
- package/dist/Editor/Elements/Embed/Image.js +4 -3
- package/dist/Editor/Elements/Embed/Video.js +9 -7
- package/dist/Editor/Elements/Form/Form.js +0 -1
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +30 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +2 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +3 -1
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +4 -0
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +5 -1
- package/dist/Editor/Elements/FreeGrid/styles.js +82 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +24 -7
- package/dist/Editor/Elements/Signature/Signed.js +1 -1
- package/dist/Editor/Elements/SimpleText/index.js +7 -8
- package/dist/Editor/Elements/Table/TableRow.js +1 -1
- package/dist/Editor/Styles/EditorStyles.js +2 -2
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +35 -29
- package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +35 -30
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -4
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +22 -38
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +0 -1
- package/dist/Editor/Toolbar/PopupTool/index.js +5 -5
- package/dist/Editor/common/FontLoader/FontLoader.js +6 -6
- package/dist/Editor/common/Icon.js +1 -1
- package/dist/Editor/common/LinkSettings/index.js +3 -2
- package/dist/Editor/common/LinkSettings/navOptions.js +4 -1
- package/dist/Editor/common/RnD/DragOver/index.js +0 -1
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +14 -1
- package/dist/Editor/common/RnD/ElementOptions/styles.js +5 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -1
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Signature.js +53 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +32 -2
- package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +2 -1
- package/dist/Editor/common/RnD/RnDCopy.js +2 -0
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +5 -3
- package/dist/Editor/common/RnD/VirtualElement/index.js +1 -1
- package/dist/Editor/common/RnD/index.js +67 -37
- package/dist/Editor/common/Section/index.js +11 -1
- package/dist/Editor/common/Section/styles.js +16 -0
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +19 -0
- package/dist/Editor/common/iconslist.js +23 -0
- package/dist/Editor/helper/RnD/focusNode.js +74 -0
- package/dist/Editor/helper/index.js +5 -2
- package/dist/Editor/helper/theme.js +2 -2
- package/dist/Editor/hooks/useBreakpoints.js +1 -1
- package/dist/Editor/hooks/useDragging.js +51 -0
- package/dist/Editor/hooks/useMouseMove.js +5 -4
- package/dist/Editor/hooks/withCommon.js +1 -0
- package/dist/Editor/hooks/withRestrictedNodes.js +48 -0
- package/dist/Editor/utils/Decorators/highlightSelection.js +16 -0
- package/dist/Editor/utils/Decorators/index.js +3 -2
- package/dist/Editor/utils/RnD/RnDCtrlCmds.js +16 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +33 -5
- package/dist/Editor/utils/customHooks/useResize.js +4 -5
- package/dist/Editor/utils/events.js +71 -0
- package/dist/Editor/utils/helper.js +16 -0
- package/package.json +1 -1
@@ -41,9 +41,10 @@ export default function LinkSettings(props) {
|
|
41
41
|
navType
|
42
42
|
} = props;
|
43
43
|
const {
|
44
|
-
isMobile
|
44
|
+
isMobile,
|
45
|
+
tagName
|
45
46
|
} = customProps;
|
46
|
-
const navOptions = getNavOptions(customProps.hideTools);
|
47
|
+
const navOptions = getNavOptions(customProps.hideTools, tagName);
|
47
48
|
const classes = LinkSettingsStyles(theme);
|
48
49
|
const [nav, setNav] = useState(getNav(navType, navOptions));
|
49
50
|
const [navValue, setNavValue] = useState(props?.navValue || "");
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export const getNavOptions = (hideTools = []) => {
|
1
|
+
export const getNavOptions = (hideTools = [], tagName = "") => {
|
2
2
|
let navOptions = [{
|
3
3
|
label: "None",
|
4
4
|
value: ""
|
@@ -33,5 +33,8 @@ export const getNavOptions = (hideTools = []) => {
|
|
33
33
|
placeholder: "phone"
|
34
34
|
}];
|
35
35
|
navOptions = navOptions.filter(n => !hideTools.includes(n.value));
|
36
|
+
if (tagName !== "Pages") {
|
37
|
+
navOptions = navOptions.filter(n => n.value !== "page");
|
38
|
+
}
|
36
39
|
return navOptions;
|
37
40
|
};
|
@@ -17,7 +17,6 @@ const DragOver = props => {
|
|
17
17
|
const open = Boolean(anchorEl);
|
18
18
|
const isSectionHover = status && type === "parent";
|
19
19
|
const isContainerHover = hover_on === path && type === "parent-container";
|
20
|
-
console.log(isSectionHover, isContainerHover);
|
21
20
|
useEffect(() => {
|
22
21
|
if (ref?.current) {
|
23
22
|
const getBoundingClientRect = () => ref?.current?.getBoundingClientRect();
|
@@ -12,7 +12,8 @@ import SaveIcon from "@mui/icons-material/Save";
|
|
12
12
|
import LinkIcon from "./Icons/LinkIcon";
|
13
13
|
import CodeIcon from "@mui/icons-material/Code";
|
14
14
|
import FilterFramesIcon from "@mui/icons-material/FilterFrames";
|
15
|
-
import { GridAddSectionIcon, WorkflowIcon } from "../../iconslist";
|
15
|
+
import { GridAddSectionIcon, SignatureIcon, WorkflowIcon } from "../../iconslist";
|
16
|
+
import Delete from "@mui/icons-material/Delete";
|
16
17
|
const Actions = {
|
17
18
|
ai: {
|
18
19
|
type: "ai",
|
@@ -45,6 +46,18 @@ const Actions = {
|
|
45
46
|
Icon: LinkIcon,
|
46
47
|
title: "Link"
|
47
48
|
},
|
49
|
+
signatureSettings: {
|
50
|
+
type: "signatureSettings",
|
51
|
+
Button: IconButton,
|
52
|
+
Icon: SignatureIcon,
|
53
|
+
title: "Signature"
|
54
|
+
},
|
55
|
+
removeSign: {
|
56
|
+
type: "removeSign",
|
57
|
+
Button: IconButton,
|
58
|
+
Icon: Delete,
|
59
|
+
title: "Remove Sign"
|
60
|
+
},
|
48
61
|
more: {
|
49
62
|
type: "more",
|
50
63
|
Button: IconButton,
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import SignaturePopup from "../../../../Elements/Signature/SignaturePopup";
|
2
|
+
import { Path, Transforms } from "slate";
|
3
|
+
import { formatDate } from "../../../../utils/helper";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
6
|
+
const Signature = props => {
|
7
|
+
const {
|
8
|
+
onClose,
|
9
|
+
customProps,
|
10
|
+
editor,
|
11
|
+
path
|
12
|
+
} = props;
|
13
|
+
const pPath = path?.split("|")?.map(m => parseInt(m));
|
14
|
+
const element_path = [...pPath, 0];
|
15
|
+
const onSave = (data = {}) => {
|
16
|
+
onClear();
|
17
|
+
Transforms.insertNodes(editor, [{
|
18
|
+
type: "sign",
|
19
|
+
signature: null,
|
20
|
+
fontFamily: "",
|
21
|
+
signedBy: "",
|
22
|
+
signedOn: formatDate(new Date(), "MM/DD/YYYY"),
|
23
|
+
signedText: "",
|
24
|
+
children: [{
|
25
|
+
text: ""
|
26
|
+
}],
|
27
|
+
...data
|
28
|
+
}], {
|
29
|
+
at: element_path
|
30
|
+
});
|
31
|
+
const parentPath = Path.parent(element_path);
|
32
|
+
Transforms.setNodes(editor, {
|
33
|
+
childType: "sign"
|
34
|
+
}, {
|
35
|
+
at: parentPath
|
36
|
+
});
|
37
|
+
};
|
38
|
+
const onClear = () => {
|
39
|
+
Transforms.removeNodes(editor, {
|
40
|
+
at: element_path
|
41
|
+
});
|
42
|
+
};
|
43
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
44
|
+
children: /*#__PURE__*/_jsx(SignaturePopup, {
|
45
|
+
onSave: onSave,
|
46
|
+
onClear: onClear,
|
47
|
+
handleClose: onClose,
|
48
|
+
customProps: customProps,
|
49
|
+
onlyPopup: true
|
50
|
+
})
|
51
|
+
});
|
52
|
+
};
|
53
|
+
export default Signature;
|
@@ -1,9 +1,39 @@
|
|
1
1
|
import Settings from "./Settings";
|
2
2
|
import Link from "./Link";
|
3
3
|
import SavePopup from "./SaveAsTemplate";
|
4
|
+
import Signature from "./Signature";
|
5
|
+
import { Path, Transforms } from "slate";
|
4
6
|
const OtherSettings = {
|
5
7
|
link: Link,
|
6
8
|
settings: Settings,
|
7
|
-
saveAsTemplate: SavePopup
|
9
|
+
saveAsTemplate: SavePopup,
|
10
|
+
signatureSettings: Signature
|
8
11
|
};
|
9
|
-
export default OtherSettings;
|
12
|
+
export default OtherSettings;
|
13
|
+
export const removeSign = (editor, path = []) => {
|
14
|
+
const pPath = path?.split("|")?.map(m => parseInt(m));
|
15
|
+
const element_path = [...pPath, 0];
|
16
|
+
Transforms.removeNodes(editor, {
|
17
|
+
at: element_path
|
18
|
+
}); // remove signature
|
19
|
+
|
20
|
+
Transforms.insertNodes(editor, [{
|
21
|
+
type: "signature",
|
22
|
+
children: [{
|
23
|
+
text: ""
|
24
|
+
}],
|
25
|
+
data: {
|
26
|
+
name: "",
|
27
|
+
email: "",
|
28
|
+
date: ""
|
29
|
+
}
|
30
|
+
}], {
|
31
|
+
at: element_path
|
32
|
+
});
|
33
|
+
const parentPath = Path.parent(element_path);
|
34
|
+
Transforms.setNodes(editor, {
|
35
|
+
childType: "signature"
|
36
|
+
}, {
|
37
|
+
at: parentPath
|
38
|
+
});
|
39
|
+
};
|
@@ -12,6 +12,8 @@ const RnDCopy = props => {
|
|
12
12
|
useEffect(() => {
|
13
13
|
if (selectedElement?.path) {
|
14
14
|
window.selectedRnDElement = selectedElement;
|
15
|
+
} else {
|
16
|
+
window.selectedRnDElement = {};
|
15
17
|
}
|
16
18
|
}, [selectedElement?.path, selectedElement?.enable]);
|
17
19
|
return !readOnly ? /*#__PURE__*/_jsx(Box, {
|
@@ -123,8 +123,8 @@ export function onDropItem(props, parentClass) {
|
|
123
123
|
dragOver,
|
124
124
|
parentPath,
|
125
125
|
path,
|
126
|
-
diffX,
|
127
|
-
x: cx,
|
126
|
+
// diffX,
|
127
|
+
// x: cx,
|
128
128
|
breakpoint
|
129
129
|
// calX,
|
130
130
|
} = props;
|
@@ -134,7 +134,9 @@ export function onDropItem(props, parentClass) {
|
|
134
134
|
let newPath = [];
|
135
135
|
newPath = moveTo;
|
136
136
|
const cCalx = isContainerElement(editor, moveTo, props);
|
137
|
-
const posX = parseInt(
|
137
|
+
// const posX = parseInt(
|
138
|
+
// cx - window.innerWidth / 2 + MARGIN_OF[breakpoint] - diffX
|
139
|
+
// );
|
138
140
|
const toSectionNode = Node.get(editor, newPath);
|
139
141
|
const addToSectionDOM = ReactEditor.toDOMNode(editor, toSectionNode);
|
140
142
|
const rect = addToSectionDOM.getBoundingClientRect();
|
@@ -11,12 +11,14 @@ import DragInfo from "./DragInfo";
|
|
11
11
|
import GuideLines from "./GuideLines";
|
12
12
|
import ShadowElement from "./ShadowElement";
|
13
13
|
import BoundaryLine from "./GuideLines/BoundaryLine";
|
14
|
-
import DragOver from "./DragOver";
|
15
14
|
import ContextMenu from "./ContextMenu";
|
16
15
|
import VirtualElement from "./VirtualElement";
|
17
16
|
import { ItemTypes } from "./ElementSettings/settingsConstants";
|
18
17
|
import { focusSelection, clearSelection } from "../../helper";
|
19
18
|
import { selectText } from "../../utils/helper";
|
19
|
+
import { removeSign } from "./ElementSettings/OtherSettings";
|
20
|
+
import useDragging from "../../hooks/useDragging";
|
21
|
+
import { dragOverOn } from "../../helper/RnD/focusNode";
|
20
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
21
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
22
24
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
@@ -57,7 +59,6 @@ const RnD = props => {
|
|
57
59
|
const {
|
58
60
|
isSelectedElement,
|
59
61
|
setSelectedElement,
|
60
|
-
dragging,
|
61
62
|
updateDragging,
|
62
63
|
contextMenu,
|
63
64
|
setContextMenu,
|
@@ -75,21 +76,25 @@ const RnD = props => {
|
|
75
76
|
const open = Boolean(enable);
|
76
77
|
const currentAction = str_path === sp ? selectedAction : null;
|
77
78
|
const positionRef = useRef();
|
79
|
+
const {
|
80
|
+
draggingRef,
|
81
|
+
startDragging,
|
82
|
+
stopDragging,
|
83
|
+
setDragOver
|
84
|
+
} = useDragging();
|
85
|
+
const dragging = draggingRef?.current;
|
78
86
|
const {
|
79
87
|
active,
|
80
88
|
id,
|
81
|
-
parentPath
|
82
|
-
dragOver
|
89
|
+
parentPath
|
83
90
|
} = dragging;
|
84
91
|
const dragInfoOpen = id === str_path;
|
85
|
-
const dragOverStatus = dragOver === str_path && parentPath !== str_path;
|
86
92
|
const [absPosition, setAbsPosition] = useState({});
|
87
93
|
const openContextMenu = contextMenu?.path === str_path;
|
88
94
|
const [position, setPosition] = useState({
|
89
95
|
x: 0,
|
90
96
|
y: 0
|
91
97
|
});
|
92
|
-
const pathIsDragging = dragOver === str_path && dragging?.isDragging;
|
93
98
|
const parentSectionPath = str_path?.split("|").slice(0, 2).join("_");
|
94
99
|
useEffect(() => {
|
95
100
|
if (ITEM_TYPES.includes(type)) {
|
@@ -146,12 +151,6 @@ const RnD = props => {
|
|
146
151
|
e.preventDefault();
|
147
152
|
e.stopPropagation();
|
148
153
|
}
|
149
|
-
|
150
|
-
// to prevent auto scroll to top
|
151
|
-
// when no editor.selection
|
152
|
-
if (!editor.selection) {
|
153
|
-
// Transforms.select(editor, Editor.end(editor, []));
|
154
|
-
}
|
155
154
|
switch (e.detail) {
|
156
155
|
case 1:
|
157
156
|
if (!enable) {
|
@@ -162,7 +161,9 @@ const RnD = props => {
|
|
162
161
|
anchorEl: rndRef?.current
|
163
162
|
});
|
164
163
|
}
|
165
|
-
|
164
|
+
focusSelection(editor, {
|
165
|
+
path
|
166
|
+
});
|
166
167
|
break;
|
167
168
|
case 2:
|
168
169
|
focusSelection(editor, {
|
@@ -225,6 +226,13 @@ const RnD = props => {
|
|
225
226
|
selectedActionPath: path
|
226
227
|
});
|
227
228
|
break;
|
229
|
+
case "signatureSettings":
|
230
|
+
setSelectedElement({
|
231
|
+
...selectedElementProps,
|
232
|
+
selectedAction: actionType,
|
233
|
+
selectedActionPath: path
|
234
|
+
});
|
235
|
+
break;
|
228
236
|
case "imageFrame":
|
229
237
|
setSelectedElement({
|
230
238
|
...selectedElementProps,
|
@@ -233,6 +241,9 @@ const RnD = props => {
|
|
233
241
|
selectedActionPath: path
|
234
242
|
});
|
235
243
|
break;
|
244
|
+
case "removeSign":
|
245
|
+
removeSign(editor, sp);
|
246
|
+
break;
|
236
247
|
case "saveAsTemplate":
|
237
248
|
const curPath = type === "parent" ? Path.parent(path) : path;
|
238
249
|
const currentNode = Node.get(editor, curPath);
|
@@ -270,6 +281,7 @@ const RnD = props => {
|
|
270
281
|
dragOver: null
|
271
282
|
}, null);
|
272
283
|
}
|
284
|
+
stopDragging();
|
273
285
|
};
|
274
286
|
const onDragStart = e => {
|
275
287
|
e.preventDefault();
|
@@ -288,6 +300,9 @@ const RnD = props => {
|
|
288
300
|
diffX: parseInt(Math.abs(Math.floor(left - e.clientX))),
|
289
301
|
diffY: parseInt(Math.abs(Math.floor(top - e.clientY)))
|
290
302
|
};
|
303
|
+
const parentPath = getParentSectionPath({
|
304
|
+
ref
|
305
|
+
}, ".freegrid-container-parent");
|
291
306
|
updateDragging({
|
292
307
|
...dragging,
|
293
308
|
active: true,
|
@@ -300,20 +315,25 @@ const RnD = props => {
|
|
300
315
|
height
|
301
316
|
},
|
302
317
|
isDragging: 1,
|
303
|
-
parentPath
|
304
|
-
ref
|
305
|
-
}, ".freegrid-container-parent")
|
318
|
+
parentPath
|
306
319
|
});
|
307
320
|
setPosition({
|
308
321
|
...updatedPosition
|
309
322
|
});
|
323
|
+
startDragging({
|
324
|
+
active: true,
|
325
|
+
id: str_path,
|
326
|
+
position: {
|
327
|
+
...updatedPosition
|
328
|
+
},
|
329
|
+
isDragging: 1,
|
330
|
+
parentPath
|
331
|
+
});
|
310
332
|
}
|
311
333
|
};
|
312
|
-
const onDrag =
|
334
|
+
const onDrag = e => {
|
313
335
|
e.preventDefault();
|
314
|
-
e.stopPropagation();
|
315
336
|
const lines = getClosestDraggable(e.clientX, e.clientY, `.freegrid-section_${parentSectionPath} .freegrid-container .freegrid-item.inactive-drag`.replace(/\|/g, "\\|"), ".freegrid-item.active-drag:not(.exclude-virtual)");
|
316
|
-
console.log(lines);
|
317
337
|
setAbsPosition({
|
318
338
|
...absPosition,
|
319
339
|
"--zIndex": 2000
|
@@ -333,16 +353,34 @@ const RnD = props => {
|
|
333
353
|
y: e.clientY,
|
334
354
|
lines: lines
|
335
355
|
});
|
356
|
+
const isDragOverOnParent = {};
|
357
|
+
let dragOverEle = e?.toElement?.dataset?.dragovertype !== "child" ? e?.toElement : e?.toElement?.closest(".freegrid-container-parent");
|
358
|
+
|
359
|
+
// some cases
|
360
|
+
if (dragOverEle?.dataset?.dragovertype === undefined) {
|
361
|
+
// means check for parent element
|
362
|
+
dragOverEle = e?.toElement?.parentElement;
|
363
|
+
}
|
364
|
+
if (dragOverEle?.dataset?.dragovertype !== "child") {
|
365
|
+
const oldPath = dragging.dragOver;
|
366
|
+
isDragOverOnParent.dragOver = dragOverEle?.dataset?.dragoverid;
|
367
|
+
isDragOverOnParent.dragOverType = dragOverEle?.dataset?.dragovertype;
|
368
|
+
dragOverOn(oldPath, dragOverEle?.dataset?.dragoverid);
|
369
|
+
}
|
370
|
+
startDragging({
|
371
|
+
isDragging: 2,
|
372
|
+
...isDragOverOnParent
|
373
|
+
});
|
336
374
|
};
|
337
375
|
const onDragStop = (e, d) => {
|
338
376
|
e.preventDefault();
|
339
377
|
e.stopPropagation();
|
340
|
-
if (dragging?.isDragging === 2 && dragging?.position?.strXY) {
|
378
|
+
if (dragging?.isDragging === 2 && dragging?.position?.strXY && dragging?.dragOver) {
|
341
379
|
d.x = e.x;
|
342
380
|
d.y = e.y;
|
343
381
|
d.offsetX = e.offsetX;
|
344
382
|
d.offsetY = e.offsetY;
|
345
|
-
d.dragOver = dragOver;
|
383
|
+
d.dragOver = dragging?.dragOver;
|
346
384
|
d.parentPath = parentPath;
|
347
385
|
d.diffX = position?.diffX;
|
348
386
|
d.diffY = position?.diffY;
|
@@ -370,17 +408,11 @@ const RnD = props => {
|
|
370
408
|
setAbsPosition({
|
371
409
|
...ud
|
372
410
|
});
|
411
|
+
stopDragging();
|
373
412
|
} else {
|
374
413
|
// invalid drags
|
375
414
|
// found in dev mode and in safari browser
|
376
|
-
|
377
|
-
isDragging: 0,
|
378
|
-
position: {},
|
379
|
-
lines: [],
|
380
|
-
active: false,
|
381
|
-
id: null
|
382
|
-
});
|
383
|
-
setPosition({});
|
415
|
+
onAfterDrop(path);
|
384
416
|
}
|
385
417
|
};
|
386
418
|
const onResizeStop = (e, direction, ref, d, position) => {
|
@@ -431,6 +463,9 @@ const RnD = props => {
|
|
431
463
|
e.stopPropagation();
|
432
464
|
}
|
433
465
|
if (type !== "child") {
|
466
|
+
setDragOver({
|
467
|
+
dragOver: str_path
|
468
|
+
});
|
434
469
|
updateDragging({
|
435
470
|
dragOver: str_path
|
436
471
|
}, str_path);
|
@@ -504,14 +539,9 @@ const RnD = props => {
|
|
504
539
|
"data-event": "rnd-click",
|
505
540
|
className: "editor-blocker",
|
506
541
|
"data-path": path,
|
507
|
-
contentEditable: false
|
508
|
-
|
509
|
-
|
510
|
-
hover_on: dragOver,
|
511
|
-
path: str_path,
|
512
|
-
parentPath: parentPath,
|
513
|
-
type: type,
|
514
|
-
childType: childType
|
542
|
+
contentEditable: false,
|
543
|
+
"data-dragoverid": str_path,
|
544
|
+
"data-dragovertype": type
|
515
545
|
}) : null]
|
516
546
|
}, eId), !active && rndRef?.current && open ? /*#__PURE__*/_jsx(ElementOptions, {
|
517
547
|
id: `opt_ref_${str_path}`,
|
@@ -104,6 +104,13 @@ const Section = props => {
|
|
104
104
|
};
|
105
105
|
const isFreeGrid = element?.children?.find(f => f.type === "freegrid");
|
106
106
|
const needHover = element?.children?.find(f => f.type === "grid" && !list_types.includes(element.type)) ? "needHover" : "";
|
107
|
+
let tempProps = {};
|
108
|
+
if (element?.type === "temp") {
|
109
|
+
tempProps = {
|
110
|
+
"--left": `${element?.left}px`,
|
111
|
+
"--top": `${element?.top}px`
|
112
|
+
};
|
113
|
+
}
|
107
114
|
const sectionBgImage = sectionBackgroundImage && sectionBackgroundImage !== "none" ? {
|
108
115
|
backgroundImage: `url(${sectionBackgroundImage})`
|
109
116
|
} : {};
|
@@ -122,7 +129,10 @@ const Section = props => {
|
|
122
129
|
}, theme);
|
123
130
|
return path.length === 1 && !isFreeGrid ? /*#__PURE__*/_jsxs(Box, {
|
124
131
|
component: "div",
|
125
|
-
className: `ed-section-wrapper ${readOnly ? "" : "hselect"} ${needHover}`,
|
132
|
+
className: `ed-section-wrapper ${readOnly ? "" : "hselect"} ${needHover} is-${element?.type}`,
|
133
|
+
style: {
|
134
|
+
...tempProps
|
135
|
+
},
|
126
136
|
sx: {
|
127
137
|
...classes.root,
|
128
138
|
background: sectionBgColor,
|
@@ -52,6 +52,22 @@ const SectionStyle = theme => ({
|
|
52
52
|
[theme.breakpoints.between("xs", "md")]: {
|
53
53
|
maxWidth: `320px !important`
|
54
54
|
}
|
55
|
+
},
|
56
|
+
"&.is-temp": {
|
57
|
+
position: "fixed",
|
58
|
+
background: "transparent",
|
59
|
+
padding: "12px",
|
60
|
+
width: "10px",
|
61
|
+
height: "10px",
|
62
|
+
left: 0,
|
63
|
+
top: 0,
|
64
|
+
bottom: 0,
|
65
|
+
right: 0,
|
66
|
+
margin: "auto",
|
67
|
+
// left: "var(--left)",
|
68
|
+
// top: "var(--top)",
|
69
|
+
zIndex: 1000,
|
70
|
+
pointerEvents: "none"
|
55
71
|
}
|
56
72
|
}
|
57
73
|
});
|
@@ -6,6 +6,25 @@ const embedVideoStyle = [{
|
|
6
6
|
label: "URL",
|
7
7
|
key: "url",
|
8
8
|
type: "text"
|
9
|
+
}, {
|
10
|
+
label: "Aspect Ratio",
|
11
|
+
key: "aspectRatio",
|
12
|
+
type: "textOptions",
|
13
|
+
options: [{
|
14
|
+
text: "Cover (Default)",
|
15
|
+
value: ""
|
16
|
+
}, {
|
17
|
+
text: "16:9",
|
18
|
+
value: "16 / 9"
|
19
|
+
}, {
|
20
|
+
text: "9:16",
|
21
|
+
value: "9 / 16"
|
22
|
+
}],
|
23
|
+
renderOption: option => {
|
24
|
+
return /*#__PURE__*/_jsx("span", {
|
25
|
+
children: option.text
|
26
|
+
});
|
27
|
+
}
|
9
28
|
}]
|
10
29
|
}, {
|
11
30
|
tab: "Position",
|
@@ -2337,4 +2337,27 @@ export const ResetIcon = () => /*#__PURE__*/_jsxs("svg", {
|
|
2337
2337
|
strokeLinecap: "round",
|
2338
2338
|
strokeLinejoin: "round"
|
2339
2339
|
})]
|
2340
|
+
});
|
2341
|
+
export const SignaturePlaceholderIcon = () => /*#__PURE__*/_jsxs("svg", {
|
2342
|
+
width: "39",
|
2343
|
+
height: "29",
|
2344
|
+
viewBox: "0 0 39 29",
|
2345
|
+
fill: "none",
|
2346
|
+
xmlns: "http://www.w3.org/2000/svg",
|
2347
|
+
children: [/*#__PURE__*/_jsx("path", {
|
2348
|
+
d: "M32.9361 2.30469L18.7107 16.5287C17.8881 17.3501 17.8881 18.6836 18.7107 19.5061L19.4967 20.2922C20.3182 21.1137 21.6528 21.1137 22.4742 20.2922L36.701 6.06677L32.9361 2.30469Z",
|
2349
|
+
fill: "#64748B"
|
2350
|
+
}), /*#__PURE__*/_jsx("path", {
|
2351
|
+
d: "M18.0898 20.1246C17.7023 19.7372 17.4549 19.2631 17.3415 18.7656L17.277 18.9424C17.1454 19.3043 16.9272 19.899 16.7945 20.2609L15.9122 22.6728C15.9074 22.6848 15.906 22.6972 15.9023 22.7056L16.9701 21.6392C17.0787 21.532 17.254 21.532 17.3626 21.6392C17.4711 21.7489 17.4711 21.9245 17.3626 22.0317L16.2962 23.1006C16.3083 23.0958 16.3181 23.0933 16.3304 23.0885L18.7423 22.2073C19.1042 22.0743 19.6978 21.8575 20.0608 21.7248L20.2376 21.6602C19.739 21.5458 19.2649 21.2983 18.8774 20.9132L18.0898 20.1246Z",
|
2352
|
+
fill: "#64748B"
|
2353
|
+
}), /*#__PURE__*/_jsx("path", {
|
2354
|
+
d: "M38.3842 1.40407L37.5982 0.617994C36.7756 -0.205998 35.4421 -0.205998 34.6207 0.617994L33.5664 1.67231L37.3299 5.43583L38.3842 4.38151C39.2057 3.55896 39.2057 2.22547 38.3842 1.40407Z",
|
2355
|
+
fill: "#64748B"
|
2356
|
+
}), /*#__PURE__*/_jsx("path", {
|
2357
|
+
d: "M36.7307 7.02477L30.3199 13.4356C30.0626 13.6928 30.0626 14.1095 30.3199 14.3667C30.5772 14.624 30.9938 14.624 31.251 14.3667L37.6604 7.95591C37.9177 7.69865 37.9177 7.28204 37.6604 7.02477C37.4034 6.76779 36.9865 6.76779 36.7307 7.02477Z",
|
2358
|
+
fill: "#64748B"
|
2359
|
+
}), /*#__PURE__*/_jsx("path", {
|
2360
|
+
d: "M19.034 24.3978H14.2468C12.5175 24.3978 11.4972 24.7574 10.8208 24.9951C10.0347 25.2742 9.97013 25.295 9.23397 24.6259C9.00841 24.4185 8.79632 24.1408 8.57216 23.8445C8.02117 23.1207 7.33161 22.2115 6.14206 22.2833C4.44193 22.3784 4.29183 24.1467 4.20291 25.2035C4.18833 25.3814 4.17121 25.58 4.14821 25.775C4.03234 25.4131 3.9204 25.0181 3.83511 24.7159C3.69624 24.221 3.55232 23.7116 3.39746 23.2826C3.07567 22.3966 2.51371 22.276 2.17738 22.2833C1.84465 22.2906 0.959808 22.3088 0.0410129 25.2229C-0.105155 25.6847 0.151831 26.1773 0.613894 26.3246C1.0782 26.4697 1.57054 26.2124 1.71698 25.7506C1.81208 25.4485 1.92907 25.134 2.04719 24.8512C2.07889 24.9634 2.11171 25.0779 2.14341 25.1912C2.59566 26.7976 2.95282 28.0638 3.9229 28.2955C3.99725 28.3126 4.08982 28.3261 4.19699 28.3261C4.47474 28.3261 4.84534 28.2285 5.20499 27.8337C5.79863 27.1843 5.88139 26.2102 5.95321 25.3534C5.98744 24.9438 6.05196 24.1796 6.23853 24.0371C6.49214 24.0273 6.76625 24.3724 7.17334 24.9085C7.42331 25.2376 7.70723 25.6104 8.05091 25.9224C9.46232 27.2081 10.2594 27.0558 11.4048 26.6512C12.0338 26.4293 12.8174 26.1541 14.2457 26.1541H19.0329C19.518 26.1541 19.9116 25.7591 19.9116 25.2754C19.9127 24.7915 19.5205 24.3979 19.034 24.3979L19.034 24.3978Z",
|
2361
|
+
fill: "#64748B"
|
2362
|
+
})]
|
2340
2363
|
});
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import { Editor, Transforms } from "slate";
|
2
|
+
import { ReactEditor } from "slate-react";
|
3
|
+
const TEMP_NODE_ID = "temp-focus-node";
|
4
|
+
const ensureTemporaryFocusNode = (editor, selectedDOM) => {
|
5
|
+
// Check if the temporary focus node already exists
|
6
|
+
const {
|
7
|
+
left,
|
8
|
+
top
|
9
|
+
} = selectedDOM?.getBoundingClientRect();
|
10
|
+
const [tempNodeEntry] = Editor.nodes(editor, {
|
11
|
+
at: [],
|
12
|
+
match: n => n.temp === TEMP_NODE_ID
|
13
|
+
});
|
14
|
+
if (!tempNodeEntry) {
|
15
|
+
// If not, insert the temporary focus node at the start of the editor
|
16
|
+
Transforms.insertNodes(editor, {
|
17
|
+
type: "temp",
|
18
|
+
temp: TEMP_NODE_ID,
|
19
|
+
children: [{
|
20
|
+
type: "restrictedType",
|
21
|
+
text: ""
|
22
|
+
}],
|
23
|
+
left,
|
24
|
+
top
|
25
|
+
}, {
|
26
|
+
at: [editor.children.length]
|
27
|
+
});
|
28
|
+
}
|
29
|
+
};
|
30
|
+
export const focusUsingTemporaryNode = (editor, selectedDOM) => {
|
31
|
+
Transforms.deselect(editor);
|
32
|
+
|
33
|
+
// Ensure the temporary node exists
|
34
|
+
ensureTemporaryFocusNode(editor, selectedDOM);
|
35
|
+
|
36
|
+
// Select the temporary node without causing scroll
|
37
|
+
const [tempNodeEntry] = Editor.nodes(editor, {
|
38
|
+
at: [],
|
39
|
+
match: n => n.temp === TEMP_NODE_ID
|
40
|
+
});
|
41
|
+
if (tempNodeEntry) {
|
42
|
+
const [, path] = tempNodeEntry;
|
43
|
+
Transforms.select(editor, path);
|
44
|
+
}
|
45
|
+
ReactEditor.focus(editor);
|
46
|
+
};
|
47
|
+
export const cleanupTemporaryFocusNode = editor => {
|
48
|
+
// Remove the temporary focus node if it exists
|
49
|
+
for (const [, path] of Editor.nodes(editor, {
|
50
|
+
at: [],
|
51
|
+
match: n => n.temp === TEMP_NODE_ID
|
52
|
+
})) {
|
53
|
+
Transforms.removeNodes(editor, {
|
54
|
+
at: path
|
55
|
+
});
|
56
|
+
}
|
57
|
+
};
|
58
|
+
export const dragOverOn = (previousPath, currentPath) => {
|
59
|
+
try {
|
60
|
+
const previousElement = document.querySelector(`[data-dragoverid="${previousPath}"]`);
|
61
|
+
const currentElement = document.querySelector(`[data-dragoverid="${currentPath}"]`);
|
62
|
+
// Remove 'dragOver' class from the current element, if it exists
|
63
|
+
if (previousElement && previousElement.classList.contains("rnd-dragOver")) {
|
64
|
+
previousElement.classList.remove("rnd-dragOver");
|
65
|
+
}
|
66
|
+
|
67
|
+
// Add 'dragOver' class to the new element
|
68
|
+
if (currentElement) {
|
69
|
+
currentElement.classList.add("rnd-dragOver");
|
70
|
+
}
|
71
|
+
} catch (err) {
|
72
|
+
console.log(err);
|
73
|
+
}
|
74
|
+
};
|
@@ -4,6 +4,8 @@ import html2canvas from "html2canvas";
|
|
4
4
|
import { rectIntersection, closestCenter } from "@dnd-kit/core";
|
5
5
|
import { getQueryStrings } from "../utils/SlateUtilityFunctions";
|
6
6
|
import { Node } from "slate";
|
7
|
+
import { focusUsingTemporaryNode } from "./RnD/focusNode";
|
8
|
+
// import { focusUsingTemporaryNode } from "./RnD/focusNode";
|
7
9
|
const HIDE_PLACHOLDERS = ["grid", "grid-item", "table"];
|
8
10
|
const PREVIEW_IMAGE_HIDE_CLASS = ["grid-container-toolbar", "grid-item-toolbar", "element-toolbar", "mini-tool-wrpr-ei", "element-selector", "element-selector-ctrl"];
|
9
11
|
const RND_ITEMS = ["freegridItem", "freegridBox"];
|
@@ -254,8 +256,9 @@ export const focusSelection = (editor, {
|
|
254
256
|
const selectedDOM = ReactEditor.toDOMNode(editor, selectedNode);
|
255
257
|
selectedDOM.scrollIntoView({
|
256
258
|
behavior: "smooth",
|
257
|
-
block: "
|
259
|
+
block: "nearest"
|
258
260
|
});
|
261
|
+
focusUsingTemporaryNode(editor, selectedDOM);
|
259
262
|
} catch (err) {
|
260
263
|
console.log(err);
|
261
264
|
}
|
@@ -302,7 +305,7 @@ export const getTextColor = (color = "") => {
|
|
302
305
|
WebkitTextFillColor: "transparent !important",
|
303
306
|
color: "transparent !important",
|
304
307
|
caretColor: "black",
|
305
|
-
|
308
|
+
"& span": {
|
306
309
|
color: "transparent !important"
|
307
310
|
}
|
308
311
|
} : {
|