@flozy/editor 1.7.1 → 1.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 +9 -79
- package/dist/Editor/Editor.css +123 -34
- package/dist/Editor/Elements/Button/EditorButton.js +7 -3
- package/dist/Editor/Elements/Carousel/Carousel.js +4 -4
- package/dist/Editor/Elements/Embed/Image.js +5 -1
- package/dist/Editor/Elements/Form/Form.js +3 -3
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -12
- package/dist/Editor/Elements/Form/Workflow/Styles.js +2 -1
- package/dist/Editor/Elements/Form/Workflow/index.js +23 -25
- package/dist/Editor/Elements/Grid/GridItem.js +3 -0
- package/dist/Editor/Elements/Link/Link.js +39 -32
- package/dist/Editor/Elements/Link/LinkButton.js +62 -80
- package/dist/Editor/Elements/Signature/SignaturePopup.js +8 -3
- package/dist/Editor/Elements/SimpleText.js +9 -4
- package/dist/Editor/MiniEditor.js +118 -0
- package/dist/Editor/Styles/EditorStyles.js +20 -0
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +1 -1
- package/dist/Editor/common/DnD/DragHandle.js +99 -0
- package/dist/Editor/common/DnD/Draggable.js +41 -0
- package/dist/Editor/common/DnD/Droppable.js +28 -0
- package/dist/Editor/common/DnD/index.js +48 -0
- package/dist/Editor/common/ImageSelector/Options/AddLink.js +3 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +4 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +4 -1
- package/dist/Editor/common/iconslist.js +17 -1
- package/dist/Editor/hooks/useMouseMove.js +9 -1
- package/dist/Editor/utils/embed.js +1 -0
- package/dist/Editor/utils/helper.js +1 -0
- package/dist/Editor/utils/pageSettings.js +2 -2
- package/dist/Editor/utils/serializeToHTML.js +5 -0
- package/dist/Editor/utils/{serializer.js → serializeToText.js} +3 -3
- package/dist/index.js +2 -0
- package/package.json +1 -1
- package/dist/Editor/Elements/Section.js +0 -42
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import React, { useRef, useCallback, useEffect, useMemo, useState, forwardRef, useImperativeHandle } from "react";
|
|
3
3
|
import { createEditor, Transforms } from "slate";
|
|
4
4
|
import { Slate, Editable, ReactEditor } from "slate-react";
|
|
5
|
-
import { DndContext, DragOverlay } from "@dnd-kit/core";
|
|
6
5
|
import { useDebounce } from "use-debounce";
|
|
7
6
|
import { getMarked, getBlock } from "./utils/SlateUtilityFunctions";
|
|
8
7
|
import CodeToText from "./Elements/CodeToText/CodeToText";
|
|
@@ -13,9 +12,9 @@ import { RemoteCursorOverlay } from "./RemoteCursorOverlay/Overlay";
|
|
|
13
12
|
import { mentionsEvent, commands, indentation, escapeEvent } from "./utils/events";
|
|
14
13
|
import withCommon from "./hooks/withCommon";
|
|
15
14
|
import DialogWrapper from "./DialogWrapper";
|
|
16
|
-
import {
|
|
15
|
+
import { serializeToText } from "./utils/serializeToText";
|
|
17
16
|
import { getPageSettings } from "./utils/pageSettings";
|
|
18
|
-
import {
|
|
17
|
+
import { getThumbnailImage } from "./helper";
|
|
19
18
|
import PopupTool from "./Toolbar/PopupTool";
|
|
20
19
|
import "./font.css";
|
|
21
20
|
import "./Editor.css";
|
|
@@ -25,8 +24,9 @@ import MiniToolbar from "./Toolbar/Mini/MiniToolbar";
|
|
|
25
24
|
import { EditorProvider } from "./hooks/useMouseMove";
|
|
26
25
|
import TopBanner from "./Elements/TopBanner/TopBanner";
|
|
27
26
|
import editorStyles from "./Styles/EditorStyles";
|
|
27
|
+
import DragHandle from "./common/DnD/DragHandle";
|
|
28
|
+
import DragAndDrop from "./common/DnD";
|
|
28
29
|
import "animate.css";
|
|
29
|
-
import Section from "./Elements/Section";
|
|
30
30
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
31
31
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
32
|
const PREVIEW_IMAGE_HIDE_CLASS = ["grid-container-toolbar", "grid-item-toolbar", "element-toolbar"];
|
|
@@ -135,12 +135,12 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
135
135
|
}
|
|
136
136
|
}, [deboundedValue]);
|
|
137
137
|
const getOnSaveData = val => {
|
|
138
|
-
const text =
|
|
138
|
+
const text = serializeToText(val);
|
|
139
139
|
const title = val?.find(f => f.type === "title");
|
|
140
140
|
return {
|
|
141
141
|
value: JSON.stringify(val),
|
|
142
142
|
text: text,
|
|
143
|
-
title:
|
|
143
|
+
title: serializeToText(title?.children) || "Untitled"
|
|
144
144
|
};
|
|
145
145
|
};
|
|
146
146
|
const getPreviewImage = async (needBackground = false, options = {}) => {
|
|
@@ -299,61 +299,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
301
|
}, [chars, editor, target, mentions, setMentions, search, type, mentionsRef]);
|
|
302
|
-
const handleDragStart = e => {
|
|
303
|
-
try {
|
|
304
|
-
const {
|
|
305
|
-
active: {
|
|
306
|
-
data: {
|
|
307
|
-
current: {
|
|
308
|
-
element
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
} = e;
|
|
313
|
-
const dragEle = ReactEditor.toDOMNode(editor, element);
|
|
314
|
-
const {
|
|
315
|
-
width,
|
|
316
|
-
height
|
|
317
|
-
} = dragEle.getBoundingClientRect();
|
|
318
|
-
setDrag({
|
|
319
|
-
style: {
|
|
320
|
-
width,
|
|
321
|
-
height
|
|
322
|
-
},
|
|
323
|
-
dom: dragEle.outerHTML
|
|
324
|
-
});
|
|
325
|
-
} catch (err) {
|
|
326
|
-
console.log(err);
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
const handleDragEnd = e => {
|
|
330
|
-
try {
|
|
331
|
-
const {
|
|
332
|
-
active: {
|
|
333
|
-
data: {
|
|
334
|
-
current: {
|
|
335
|
-
element,
|
|
336
|
-
onDragEnd
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
over: {
|
|
341
|
-
data: {
|
|
342
|
-
current: {
|
|
343
|
-
onDrop
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
} = e;
|
|
348
|
-
onDrop(JSON.stringify(element));
|
|
349
|
-
setTimeout(() => {
|
|
350
|
-
onDragEnd();
|
|
351
|
-
}, 100);
|
|
352
|
-
setDrag(null);
|
|
353
|
-
} catch (err) {
|
|
354
|
-
console.log(err);
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
302
|
const Overlay = collaborativeEditor && !isReadOnly ? RemoteCursorOverlay : React.Fragment;
|
|
358
303
|
const dotBg = needDotsBG ? {
|
|
359
304
|
background: "white",
|
|
@@ -389,11 +334,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
389
334
|
editor: editor,
|
|
390
335
|
initialValue: value,
|
|
391
336
|
onChange: handleEditorChange,
|
|
392
|
-
children: [/*#__PURE__*/
|
|
393
|
-
|
|
394
|
-
onDragStart: handleDragStart,
|
|
395
|
-
onDragEnd: handleDragEnd,
|
|
396
|
-
children: [/*#__PURE__*/_jsx(Overlay, {
|
|
337
|
+
children: [/*#__PURE__*/_jsx(DragAndDrop, {
|
|
338
|
+
children: /*#__PURE__*/_jsx(Overlay, {
|
|
397
339
|
children: /*#__PURE__*/_jsx(Box, {
|
|
398
340
|
className: `${hasTopBanner() ? "has-topbanner" : ""}`,
|
|
399
341
|
sx: classes.slateWrapper,
|
|
@@ -448,19 +390,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
448
390
|
}) : null]
|
|
449
391
|
})
|
|
450
392
|
})
|
|
451
|
-
})
|
|
452
|
-
className: "drag-overlay",
|
|
453
|
-
style: {
|
|
454
|
-
...(drag?.style || {})
|
|
455
|
-
},
|
|
456
|
-
children: drag ? /*#__PURE__*/_jsx(Item, {
|
|
457
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
458
|
-
dangerouslySetInnerHTML: {
|
|
459
|
-
__html: drag?.dom
|
|
460
|
-
}
|
|
461
|
-
})
|
|
462
|
-
}) : null
|
|
463
|
-
})]
|
|
393
|
+
})
|
|
464
394
|
}), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
|
|
465
395
|
...htmlAction,
|
|
466
396
|
handleCodeToText: handleCodeToText
|
package/dist/Editor/Editor.css
CHANGED
|
@@ -136,9 +136,14 @@ blockquote {
|
|
|
136
136
|
z-index: 1000;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
.element-toolbar a {
|
|
140
|
+
margin-right: 4px;
|
|
141
|
+
}
|
|
142
|
+
|
|
139
143
|
.grid-container-toolbar button,
|
|
140
144
|
.grid-item-toolbar button,
|
|
141
|
-
.element-toolbar button
|
|
145
|
+
.element-toolbar button,
|
|
146
|
+
.element-toolbar a {
|
|
142
147
|
border-radius: 10px;
|
|
143
148
|
border: 1px solid rgba(37, 99, 235, 0.32);
|
|
144
149
|
background: #fff;
|
|
@@ -148,6 +153,7 @@ blockquote {
|
|
|
148
153
|
padding: 6px;
|
|
149
154
|
}
|
|
150
155
|
.element-toolbar button svg,
|
|
156
|
+
.element-toolbar a svg,
|
|
151
157
|
.grid-container-toolbar button svg,
|
|
152
158
|
.grid-item-toolbar button svg {
|
|
153
159
|
width: 16px;
|
|
@@ -156,7 +162,8 @@ blockquote {
|
|
|
156
162
|
|
|
157
163
|
.grid-container-toolbar button:hover,
|
|
158
164
|
.grid-item-toolbar button:hover,
|
|
159
|
-
.element-toolbar button:hover
|
|
165
|
+
.element-toolbar button:hover,
|
|
166
|
+
.element-toolbar a:hover {
|
|
160
167
|
background-color: #ffffff;
|
|
161
168
|
color: #2684ff;
|
|
162
169
|
border: 1px solid #2684ff;
|
|
@@ -413,6 +420,13 @@ blockquote {
|
|
|
413
420
|
width: auto !important;
|
|
414
421
|
}
|
|
415
422
|
|
|
423
|
+
.MuiButton-root.primaryBtn.disabled,
|
|
424
|
+
.MuiButton-root.secondaryBtn.disabled {
|
|
425
|
+
background: #eee !important;
|
|
426
|
+
color: #ccc !important;
|
|
427
|
+
border: 1px solid #ccc !important;
|
|
428
|
+
}
|
|
429
|
+
|
|
416
430
|
.MuiButton-root.secondaryBtn {
|
|
417
431
|
background: #ffffff;
|
|
418
432
|
border: 1px solid #2563eb !important;
|
|
@@ -478,7 +492,7 @@ blockquote {
|
|
|
478
492
|
}
|
|
479
493
|
|
|
480
494
|
.embed {
|
|
481
|
-
justify-content: center;
|
|
495
|
+
justify-content: center;
|
|
482
496
|
}
|
|
483
497
|
|
|
484
498
|
.embed img {
|
|
@@ -822,7 +836,10 @@ blockquote {
|
|
|
822
836
|
font-weight: 400;
|
|
823
837
|
width: 200px;
|
|
824
838
|
cursor: pointer;
|
|
825
|
-
color
|
|
839
|
+
color: #464646;
|
|
840
|
+
background-color: #fff;
|
|
841
|
+
padding: 4px 6px;
|
|
842
|
+
border-radius: 12px;
|
|
826
843
|
span {
|
|
827
844
|
text-transform: capitalize;
|
|
828
845
|
}
|
|
@@ -859,38 +876,110 @@ blockquote {
|
|
|
859
876
|
|
|
860
877
|
/* HTML: <div class="loader"></div> */
|
|
861
878
|
.img-loader-wrapper {
|
|
862
|
-
width:28px;
|
|
879
|
+
width: 28px;
|
|
863
880
|
aspect-ratio: 1;
|
|
864
881
|
border-radius: 50%;
|
|
865
|
-
background: #
|
|
882
|
+
background: #f10c49;
|
|
866
883
|
animation: l9 2s infinite;
|
|
867
884
|
}
|
|
868
885
|
@keyframes l9 {
|
|
869
|
-
0%
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
886
|
+
0% {
|
|
887
|
+
box-shadow:
|
|
888
|
+
0 -16px #f4dd51,
|
|
889
|
+
calc(16px * 0.707) calc(-16px * 0.707) #e3aad6,
|
|
890
|
+
0 0 #f4dd51,
|
|
891
|
+
0 0 #e3aad6,
|
|
892
|
+
0 0 #f4dd51,
|
|
893
|
+
0 0 #e3aad6,
|
|
894
|
+
0 0 #f4dd51,
|
|
895
|
+
0 0 #e3aad6;
|
|
896
|
+
}
|
|
897
|
+
12.5% {
|
|
898
|
+
box-shadow:
|
|
899
|
+
0 0 #f4dd51,
|
|
900
|
+
calc(16px * 0.707) calc(-16px * 0.707) #e3aad6,
|
|
901
|
+
16px 0 #f4dd51,
|
|
902
|
+
0 0 #e3aad6,
|
|
903
|
+
0 0 #f4dd51,
|
|
904
|
+
0 0 #e3aad6,
|
|
905
|
+
0 0 #f4dd51,
|
|
906
|
+
0 0 #e3aad6;
|
|
907
|
+
}
|
|
908
|
+
25% {
|
|
909
|
+
box-shadow:
|
|
910
|
+
0 0 #f4dd51,
|
|
911
|
+
0 0 #e3aad6,
|
|
912
|
+
16px 0 #f4dd51,
|
|
913
|
+
calc(16px * 0.707) calc(16px * 0.707) #e3aad6,
|
|
914
|
+
0 0 #f4dd51,
|
|
915
|
+
0 0 #e3aad6,
|
|
916
|
+
0 0 #f4dd51,
|
|
917
|
+
0 0 #e3aad6;
|
|
918
|
+
}
|
|
919
|
+
37.5% {
|
|
920
|
+
box-shadow:
|
|
921
|
+
0 0 #f4dd51,
|
|
922
|
+
0 0 #e3aad6,
|
|
923
|
+
0 0 #f4dd51,
|
|
924
|
+
calc(16px * 0.707) calc(16px * 0.707) #e3aad6,
|
|
925
|
+
0 16px #f4dd51,
|
|
926
|
+
0 0 #e3aad6,
|
|
927
|
+
0 0 #f4dd51,
|
|
928
|
+
0 0 #e3aad6;
|
|
929
|
+
}
|
|
930
|
+
50% {
|
|
931
|
+
box-shadow:
|
|
932
|
+
0 0 #f4dd51,
|
|
933
|
+
0 0 #e3aad6,
|
|
934
|
+
0 0 #f4dd51,
|
|
935
|
+
0 0 #e3aad6,
|
|
936
|
+
0 16px #f4dd51,
|
|
937
|
+
calc(-16px * 0.707) calc(16px * 0.707) #e3aad6,
|
|
938
|
+
0 0 #f4dd51,
|
|
939
|
+
0 0 #e3aad6;
|
|
940
|
+
}
|
|
941
|
+
62.5% {
|
|
942
|
+
box-shadow:
|
|
943
|
+
0 0 #f4dd51,
|
|
944
|
+
0 0 #e3aad6,
|
|
945
|
+
0 0 #f4dd51,
|
|
946
|
+
0 0 #e3aad6,
|
|
947
|
+
0 0 #f4dd51,
|
|
948
|
+
calc(-16px * 0.707) calc(16px * 0.707) #e3aad6,
|
|
949
|
+
-16px 0 #f4dd51,
|
|
950
|
+
0 0 #e3aad6;
|
|
951
|
+
}
|
|
952
|
+
75% {
|
|
953
|
+
box-shadow:
|
|
954
|
+
0 0 #f4dd51,
|
|
955
|
+
0 0 #e3aad6,
|
|
956
|
+
0 0 #f4dd51,
|
|
957
|
+
0 0 #e3aad6,
|
|
958
|
+
0 0 #f4dd51,
|
|
959
|
+
0 0 #e3aad6,
|
|
960
|
+
-16px 0 #f4dd51,
|
|
961
|
+
calc(-16px * 0.707) calc(-16px * 0.707) #e3aad6;
|
|
962
|
+
}
|
|
963
|
+
87.5% {
|
|
964
|
+
box-shadow:
|
|
965
|
+
0 -16px #f4dd51,
|
|
966
|
+
0 0 #e3aad6,
|
|
967
|
+
0 0 #f4dd51,
|
|
968
|
+
0 0 #e3aad6,
|
|
969
|
+
0 0 #f4dd51,
|
|
970
|
+
0 0 #e3aad6,
|
|
971
|
+
0 0 #f4dd51,
|
|
972
|
+
calc(-16px * 0.707) calc(-16px * 0.707) #e3aad6;
|
|
973
|
+
}
|
|
974
|
+
100% {
|
|
975
|
+
box-shadow:
|
|
976
|
+
0 -16px #f4dd51,
|
|
977
|
+
calc(16px * 0.707) calc(-16px * 0.707) #e3aad6,
|
|
978
|
+
0 0 #f4dd51,
|
|
979
|
+
0 0 #e3aad6,
|
|
980
|
+
0 0 #f4dd51,
|
|
981
|
+
0 0 #e3aad6,
|
|
982
|
+
0 0 #f4dd51,
|
|
983
|
+
0 0 #e3aad6;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
@@ -8,6 +8,7 @@ import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
|
|
8
8
|
import DeleteIcon from "@mui/icons-material/Delete";
|
|
9
9
|
import ButtonPopup from "./ButtonPopup";
|
|
10
10
|
import { actionButtonRedirect } from "../../service/actionTrigger";
|
|
11
|
+
import { WorkflowIcon } from "../../common/iconslist";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
14
|
const EditorButton = props => {
|
|
@@ -47,6 +48,7 @@ const EditorButton = props => {
|
|
|
47
48
|
linkType,
|
|
48
49
|
redirectOnURLResult
|
|
49
50
|
} = buttonLink || {};
|
|
51
|
+
const isTrigger = linkType === "actionTrigger";
|
|
50
52
|
const {
|
|
51
53
|
topLeft,
|
|
52
54
|
topRight,
|
|
@@ -62,7 +64,7 @@ const EditorButton = props => {
|
|
|
62
64
|
const BtnIcon = buttonIcon ? fIcons[buttonIcon] : null;
|
|
63
65
|
const onClick = async e => {
|
|
64
66
|
if (readOnly) {
|
|
65
|
-
if (
|
|
67
|
+
if (isTrigger) {
|
|
66
68
|
if (metadata?.buttonLink?.handler) {
|
|
67
69
|
metadata.buttonLink.handler("click");
|
|
68
70
|
} else if (redirectOnURLResult) {
|
|
@@ -162,7 +164,6 @@ const EditorButton = props => {
|
|
|
162
164
|
sx: {
|
|
163
165
|
background: bgColor || "rgb(30, 75, 122)",
|
|
164
166
|
borderBlockStyle: "solid",
|
|
165
|
-
// ...borderStyleColor,
|
|
166
167
|
borderColor: borderColor || "transparent",
|
|
167
168
|
borderWidth: borderWidth || "1px",
|
|
168
169
|
borderRadius: `${topLeft}px ${topRight}px ${bottomLeft}px ${bottomRight}px`,
|
|
@@ -199,7 +200,10 @@ const EditorButton = props => {
|
|
|
199
200
|
paddingLeft: "4px",
|
|
200
201
|
paddingRight: "4px"
|
|
201
202
|
}
|
|
202
|
-
}), /*#__PURE__*/_jsx(
|
|
203
|
+
}), !readOnly && isTrigger ? /*#__PURE__*/_jsx(IconButton, {
|
|
204
|
+
className: "workflow-icon-btn",
|
|
205
|
+
children: /*#__PURE__*/_jsx(WorkflowIcon, {})
|
|
206
|
+
}) : null, /*#__PURE__*/_jsx(Toolbar, {})]
|
|
203
207
|
})
|
|
204
208
|
}), /*#__PURE__*/_jsx("div", {
|
|
205
209
|
contentEditable: false,
|
|
@@ -51,14 +51,14 @@ const Carousel = props => {
|
|
|
51
51
|
}
|
|
52
52
|
}, [edit]);
|
|
53
53
|
const onAddSlide = () => {
|
|
54
|
-
|
|
55
|
-
if (insertPath[0] !== undefined) {
|
|
56
|
-
insertPath[insertPath.length - 1] = element.children.length;
|
|
54
|
+
try {
|
|
57
55
|
Transforms.insertNodes(editor, [{
|
|
58
56
|
...carouselItem()
|
|
59
57
|
}], {
|
|
60
|
-
at:
|
|
58
|
+
at: [...path, children.length]
|
|
61
59
|
});
|
|
60
|
+
} catch (err) {
|
|
61
|
+
console.log(err);
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
const onEdit = () => {
|
|
@@ -148,6 +148,7 @@ const Image = ({
|
|
|
148
148
|
},
|
|
149
149
|
...element.attr,
|
|
150
150
|
"data-path": path.join(","),
|
|
151
|
+
contentEditable: false,
|
|
151
152
|
children: [openSetttings ? /*#__PURE__*/_jsx(EmbedPopup, {
|
|
152
153
|
element: element,
|
|
153
154
|
onSave: onSave,
|
|
@@ -188,7 +189,10 @@ const Image = ({
|
|
|
188
189
|
className: "resize-br visible-on-hover",
|
|
189
190
|
children: /*#__PURE__*/_jsx(AspectRatioIcon, {})
|
|
190
191
|
})]
|
|
191
|
-
}),
|
|
192
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
193
|
+
contentEditable: false,
|
|
194
|
+
children: children
|
|
195
|
+
})]
|
|
192
196
|
});
|
|
193
197
|
};
|
|
194
198
|
export default Image;
|
|
@@ -4,8 +4,7 @@ import { useSlateStatic, ReactEditor } from "slate-react";
|
|
|
4
4
|
import { IconButton, Tooltip, Grid, Menu, MenuItem, CircularProgress } from "@mui/material";
|
|
5
5
|
import DeleteIcon from "@mui/icons-material/Delete";
|
|
6
6
|
import BackupIcon from "@mui/icons-material/Backup";
|
|
7
|
-
import { GridSettingsIcon, GridAddSectionIcon } from "../../common/iconslist";
|
|
8
|
-
import SendTimeExtensionIcon from '@mui/icons-material/SendTimeExtension';
|
|
7
|
+
import { GridSettingsIcon, GridAddSectionIcon, WorkflowIcon } from "../../common/iconslist";
|
|
9
8
|
import FormPopup from "./FormPopup";
|
|
10
9
|
import ButtonPopup from "../Button/ButtonPopup";
|
|
11
10
|
import { formField } from "../../utils/formfield";
|
|
@@ -222,8 +221,9 @@ const Form = props => {
|
|
|
222
221
|
title: "Workflow",
|
|
223
222
|
arrow: true,
|
|
224
223
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
224
|
+
className: "svg-big-btn",
|
|
225
225
|
onClick: onWorkflow,
|
|
226
|
-
children: /*#__PURE__*/_jsx(
|
|
226
|
+
children: /*#__PURE__*/_jsx(WorkflowIcon, {})
|
|
227
227
|
})
|
|
228
228
|
})]
|
|
229
229
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Grid, Radio, RadioGroup, Typography, FormControlLabel, Select, MenuItem, FormControl, TextField } from "@mui/material";
|
|
3
3
|
import FormStyles from "./Styles";
|
|
4
|
-
import KeyboardArrowDownIcon from
|
|
4
|
+
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
5
5
|
import UserInputs from "./UserInputs";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -61,26 +61,26 @@ const FormWorkflow = props => {
|
|
|
61
61
|
value: schedule,
|
|
62
62
|
defaultValue: 1,
|
|
63
63
|
children: [/*#__PURE__*/_jsx(FormControlLabel, {
|
|
64
|
-
value:
|
|
64
|
+
value: "immediately",
|
|
65
65
|
label: "Immediately",
|
|
66
66
|
onChange: () => {
|
|
67
|
-
setSchedule(
|
|
67
|
+
setSchedule("immediately");
|
|
68
68
|
},
|
|
69
69
|
control: /*#__PURE__*/_jsx(Radio, {
|
|
70
70
|
size: "small"
|
|
71
71
|
})
|
|
72
72
|
}), /*#__PURE__*/_jsx(FormControlLabel, {
|
|
73
|
-
value:
|
|
73
|
+
value: "after",
|
|
74
74
|
label: "After",
|
|
75
75
|
onChange: () => {
|
|
76
|
-
setSchedule(
|
|
76
|
+
setSchedule("after");
|
|
77
77
|
},
|
|
78
78
|
control: /*#__PURE__*/_jsx(Radio, {
|
|
79
79
|
size: "small"
|
|
80
80
|
})
|
|
81
81
|
})]
|
|
82
82
|
})
|
|
83
|
-
}), schedule ===
|
|
83
|
+
}), schedule === "after" && /*#__PURE__*/_jsx(Grid, {
|
|
84
84
|
item: true,
|
|
85
85
|
children: /*#__PURE__*/_jsxs(Grid, {
|
|
86
86
|
container: true,
|
|
@@ -113,19 +113,19 @@ const FormWorkflow = props => {
|
|
|
113
113
|
sx: classes.select,
|
|
114
114
|
IconComponent: KeyboardArrowDownIcon,
|
|
115
115
|
style: {
|
|
116
|
-
minWidth:
|
|
116
|
+
minWidth: "160px"
|
|
117
117
|
},
|
|
118
118
|
children: [/*#__PURE__*/_jsx(MenuItem, {
|
|
119
119
|
sx: classes.selectList,
|
|
120
|
-
value:
|
|
120
|
+
value: "min",
|
|
121
121
|
children: "Minutes"
|
|
122
122
|
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
123
123
|
sx: classes.selectList,
|
|
124
|
-
value:
|
|
124
|
+
value: "hr",
|
|
125
125
|
children: "Hours"
|
|
126
126
|
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
127
127
|
sx: classes.selectList,
|
|
128
|
-
value:
|
|
128
|
+
value: "day",
|
|
129
129
|
children: "Day"
|
|
130
130
|
})]
|
|
131
131
|
})
|
|
@@ -149,11 +149,11 @@ const FormWorkflow = props => {
|
|
|
149
149
|
maxRows: 5,
|
|
150
150
|
sx: {
|
|
151
151
|
"& fieldset": {
|
|
152
|
-
border:
|
|
152
|
+
border: "1px solid #6F6F6F33",
|
|
153
153
|
borderRadius: "8px"
|
|
154
154
|
},
|
|
155
155
|
"& textarea": {
|
|
156
|
-
fontSize:
|
|
156
|
+
fontSize: "16px",
|
|
157
157
|
fontWeight: 500
|
|
158
158
|
},
|
|
159
159
|
"& textarea:focus-visible": {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
2
|
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, IconButton } from "@mui/material";
|
|
3
|
-
import ArrowBackIcon from
|
|
3
|
+
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
|
4
4
|
import FormStyles from "./Styles";
|
|
5
5
|
import FormWorkflow from "./FormWorkflow";
|
|
6
6
|
|
|
7
7
|
//Constants
|
|
8
|
-
import { minutes, hours, days } from
|
|
8
|
+
import { minutes, hours, days } from "./constant";
|
|
9
9
|
import ListWorkflow from "./ListWorkflow";
|
|
10
10
|
import { PlusIcon } from "../../../common/iconslist";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -23,12 +23,12 @@ const Workflow = props => {
|
|
|
23
23
|
const classes = FormStyles();
|
|
24
24
|
const [workflowList, setWorkflowList] = useState([]);
|
|
25
25
|
const [formData, setFormData] = useState(false);
|
|
26
|
-
const [schedule, setSchedule] = useState(
|
|
27
|
-
const [scheduleEvery, setScheduleEvery] = useState(
|
|
28
|
-
const currentInstant = scheduleEvery ===
|
|
26
|
+
const [schedule, setSchedule] = useState("immediately");
|
|
27
|
+
const [scheduleEvery, setScheduleEvery] = useState("min");
|
|
28
|
+
const currentInstant = scheduleEvery === "min" ? minutes : scheduleEvery === "hr" ? hours : scheduleEvery === "day" ? days : [];
|
|
29
29
|
const [scheduleOn, setScheduleOn] = useState(currentInstant[0]);
|
|
30
|
-
const [subject, setSubject] = useState(
|
|
31
|
-
const [bodyData, setBodyData] = useState(
|
|
30
|
+
const [subject, setSubject] = useState("Welcome to Flozy!");
|
|
31
|
+
const [bodyData, setBodyData] = useState("Hey %field_name% \n\nThanks for attending the event called %Event Name% at %Event Time% on %Event Time%.");
|
|
32
32
|
const [flowEdited, setFlowEdited] = useState({
|
|
33
33
|
isEdited: false,
|
|
34
34
|
listIndex: null
|
|
@@ -44,16 +44,16 @@ const Workflow = props => {
|
|
|
44
44
|
};
|
|
45
45
|
const onFormBack = () => {
|
|
46
46
|
setFormData(false);
|
|
47
|
-
setBodyData(
|
|
48
|
-
setSubject(
|
|
49
|
-
setSchedule(
|
|
47
|
+
setBodyData("");
|
|
48
|
+
setSubject("");
|
|
49
|
+
setSchedule("immediately");
|
|
50
50
|
};
|
|
51
51
|
const saveFormWorkflow = () => {
|
|
52
52
|
let workflowData = [...workflowList];
|
|
53
53
|
let data = {
|
|
54
54
|
schedule_type: schedule,
|
|
55
|
-
schedule_every: schedule ===
|
|
56
|
-
schedule_on: schedule ===
|
|
55
|
+
schedule_every: schedule === "after" ? scheduleEvery : 0,
|
|
56
|
+
schedule_on: schedule === "after" ? scheduleOn : 0,
|
|
57
57
|
subject_data: subject,
|
|
58
58
|
body_data: bodyData
|
|
59
59
|
};
|
|
@@ -67,9 +67,9 @@ const Workflow = props => {
|
|
|
67
67
|
};
|
|
68
68
|
onSave(saveData);
|
|
69
69
|
setFormData(false);
|
|
70
|
-
setBodyData(
|
|
71
|
-
setSubject(
|
|
72
|
-
setSchedule(
|
|
70
|
+
setBodyData("");
|
|
71
|
+
setSubject("");
|
|
72
|
+
setSchedule("immediately");
|
|
73
73
|
setFlowEdited({
|
|
74
74
|
isEdited: false,
|
|
75
75
|
listIndex: null
|
|
@@ -117,26 +117,25 @@ const Workflow = props => {
|
|
|
117
117
|
children: [/*#__PURE__*/_jsxs(DialogTitle, {
|
|
118
118
|
sx: classes.popupTitle,
|
|
119
119
|
style: {
|
|
120
|
-
padding: formData ?
|
|
120
|
+
padding: formData ? "16px 12px" : "16px 24px",
|
|
121
121
|
justifyContent: !formData ? "space-between" : ""
|
|
122
122
|
},
|
|
123
123
|
children: [formData && /*#__PURE__*/_jsx(IconButton, {
|
|
124
124
|
onClick: onFormBack,
|
|
125
125
|
children: /*#__PURE__*/_jsx(ArrowBackIcon, {})
|
|
126
|
-
}), "Follow-Up Email", !formData && workflowList?.length > 0 && /*#__PURE__*/
|
|
126
|
+
}), "Follow-Up Email", !formData && workflowList?.length > 0 && /*#__PURE__*/_jsxs(Button, {
|
|
127
127
|
variant: "outlined",
|
|
128
128
|
sx: {
|
|
129
|
-
textTransform:
|
|
130
|
-
background:
|
|
131
|
-
padding:
|
|
129
|
+
textTransform: "none",
|
|
130
|
+
background: "#EBF1F9",
|
|
131
|
+
padding: "7px 15px"
|
|
132
132
|
},
|
|
133
133
|
onClick: handleAddFormWorkflow,
|
|
134
134
|
size: "small",
|
|
135
135
|
startIcon: /*#__PURE__*/_jsx(PlusIcon, {}),
|
|
136
|
-
children: " New Email"
|
|
136
|
+
children: [" ", "New Email"]
|
|
137
137
|
})]
|
|
138
138
|
}), /*#__PURE__*/_jsxs(DialogContent, {
|
|
139
|
-
dividers: true,
|
|
140
139
|
children: [!formData && workflowList?.length > 0 && /*#__PURE__*/_jsx(ListWorkflow, {
|
|
141
140
|
workflow: workflowList,
|
|
142
141
|
handleEditFormWorkflow: handleEditFormWorkflow,
|
|
@@ -161,15 +160,14 @@ const Workflow = props => {
|
|
|
161
160
|
}), /*#__PURE__*/_jsxs(DialogActions, {
|
|
162
161
|
sx: classes.dialogFooter,
|
|
163
162
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
164
|
-
|
|
163
|
+
className: "secondaryBtn",
|
|
165
164
|
sx: classes.closeBtn,
|
|
166
|
-
variant: "outlined",
|
|
167
165
|
onClick: closeWorkflow,
|
|
168
166
|
size: "small",
|
|
169
167
|
children: "Close"
|
|
170
168
|
}), (formData || workflowList?.length === 0) && /*#__PURE__*/_jsx(Button, {
|
|
169
|
+
className: "primaryBtn",
|
|
171
170
|
sx: classes.saveBtn,
|
|
172
|
-
variant: "contained",
|
|
173
171
|
onClick: saveFormWorkflow,
|
|
174
172
|
size: "small",
|
|
175
173
|
children: "Save"
|
|
@@ -150,6 +150,9 @@ const GridItem = props => {
|
|
|
150
150
|
children: [!readOnly && /*#__PURE__*/_jsxs("div", {
|
|
151
151
|
className: `element-selector ${selected ? "selected" : ""}`,
|
|
152
152
|
contentEditable: false,
|
|
153
|
+
style: {
|
|
154
|
+
zIndex: 1000
|
|
155
|
+
},
|
|
153
156
|
children: [/*#__PURE__*/_jsx("div", {
|
|
154
157
|
className: "element-selector-dots tl",
|
|
155
158
|
children: " "
|