@flozy/editor 3.5.2 → 3.5.3
Sign up to get free protection for your applications and to get access to all the features.
package/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import React, { useState, useRef } from "react";
|
1
|
+
import React, { useState, useRef, useEffect } from "react";
|
2
2
|
import { Transforms } from "slate";
|
3
3
|
import { useSlateStatic, ReactEditor } from "slate-react";
|
4
|
-
import { IconButton, Tooltip, Grid, Menu, MenuItem, CircularProgress, Box } from "@mui/material";
|
4
|
+
import { IconButton, Tooltip, Grid, Menu, MenuItem, CircularProgress, Box, Typography } from "@mui/material";
|
5
5
|
import DeleteIcon from "@mui/icons-material/Delete";
|
6
6
|
import BackupIcon from "@mui/icons-material/Backup";
|
7
7
|
import { GridSettingsIcon, GridAddSectionIcon, WorkflowIcon } from "../../common/iconslist";
|
@@ -60,7 +60,12 @@ const Form = props => {
|
|
60
60
|
const [anchorEl, setAnchorEl] = useState(null);
|
61
61
|
const [loading, setLoading] = useState(false);
|
62
62
|
const [showOptions, setShowOptions] = useState(false);
|
63
|
+
const [submittedSuccessfully, setSubmittedSuccessfully] = useState(false);
|
64
|
+
const [formHeight, setFormHeight] = useState();
|
63
65
|
const path = ReactEditor.findPath(editor, element);
|
66
|
+
useEffect(() => {
|
67
|
+
setFormHeight(formEle?.current?.clientHeight);
|
68
|
+
}, []);
|
64
69
|
const btnBorderStyle = buttonProps?.borderColor?.indexOf("linear") >= 0 ? {
|
65
70
|
borderImageSource: buttonProps?.borderColor,
|
66
71
|
borderImageSlice: 1
|
@@ -158,8 +163,10 @@ const Form = props => {
|
|
158
163
|
alert(isValidForm[0]);
|
159
164
|
} else {
|
160
165
|
const formRes = await formSubmit(params, customProps);
|
161
|
-
if (formRes) {
|
166
|
+
if (formRes?.hasOwnProperty('form_id')) {
|
162
167
|
onFormSubmit(formRes);
|
168
|
+
setSubmittedSuccessfully(true);
|
169
|
+
setAnchorEl(null);
|
163
170
|
}
|
164
171
|
}
|
165
172
|
setLoading(false);
|
@@ -306,7 +313,7 @@ const Form = props => {
|
|
306
313
|
},
|
307
314
|
onMouseOver: onMouseOver,
|
308
315
|
onMouseLeave: onMouseLeave,
|
309
|
-
children: [/*#__PURE__*/_jsxs(Box, {
|
316
|
+
children: [!submittedSuccessfully ? /*#__PURE__*/_jsxs(Box, {
|
310
317
|
component: "form",
|
311
318
|
id: `${formName}`,
|
312
319
|
onSubmit: handleSubmit,
|
@@ -401,6 +408,27 @@ const Form = props => {
|
|
401
408
|
}
|
402
409
|
})
|
403
410
|
})]
|
411
|
+
}) : /*#__PURE__*/_jsx(Typography, {
|
412
|
+
sx: {
|
413
|
+
color: textColor || "#A2A9B4",
|
414
|
+
borderColor: borderColor || "transparent",
|
415
|
+
borderWidth: borderWidth || "1px",
|
416
|
+
borderRadius: {
|
417
|
+
...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
|
418
|
+
},
|
419
|
+
borderStyle: borderStyle || "solid",
|
420
|
+
background: bgColor || "transparent",
|
421
|
+
padding: {
|
422
|
+
...getTRBLBreakPoints(bannerSpacing)
|
423
|
+
},
|
424
|
+
minHeight: `${formHeight}px`,
|
425
|
+
display: 'flex',
|
426
|
+
alignItems: "center",
|
427
|
+
justifyContent: "center",
|
428
|
+
textAlign: "center",
|
429
|
+
position: 'relative'
|
430
|
+
},
|
431
|
+
children: "Form Submitted Successfully...!"
|
404
432
|
}), openSetttings ? /*#__PURE__*/_jsx(FormPopup, {
|
405
433
|
element: element,
|
406
434
|
onSave: onSave,
|
@@ -129,31 +129,32 @@ const formStyle = [{
|
|
129
129
|
key: "backgroundImage",
|
130
130
|
type: "backgroundImage"
|
131
131
|
}]
|
132
|
-
},
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
},
|
132
|
+
},
|
133
|
+
// {
|
134
|
+
// tab: "Add to Boards",
|
135
|
+
// value: "metadatamapping",
|
136
|
+
// fields: [
|
137
|
+
// {
|
138
|
+
// label: "Add response to contacts board",
|
139
|
+
// key: "metadatamapping",
|
140
|
+
// type: "metadatamapping",
|
141
|
+
// compType: "card",
|
142
|
+
// content: "By default, form responses are added as separate cards on the default contact board.",
|
143
|
+
// value: "mappingToContactBoard",
|
144
|
+
// infoIcon: <Icon icon="info" />
|
145
|
+
// },
|
146
|
+
// {
|
147
|
+
// label: "Create a separate board",
|
148
|
+
// key: "metadatamapping",
|
149
|
+
// type: "metadatamapping",
|
150
|
+
// compType: "card",
|
151
|
+
// content: "By default, form responses are added as separate cards on a new board (Contact Us).",
|
152
|
+
// value: "mappingToSeparateBoard",
|
153
|
+
// infoIcon: <Icon icon="info" />
|
154
|
+
// },
|
155
|
+
// ],
|
156
|
+
// },
|
157
|
+
{
|
157
158
|
tab: "Save As Template",
|
158
159
|
value: "saveAsTemplate",
|
159
160
|
needActions: false,
|