@flozy/editor 3.5.2 → 3.5.4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/Editor/Elements/Form/Form.js +32 -4
- package/dist/Editor/Elements/SimpleText/style.js +1 -1
- package/dist/Editor/common/MentionsPopup/index.js +19 -15
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +1 -0
- package/dist/Editor/common/StyleBuilder/formStyle.js +26 -25
- package/dist/Editor/common/iconslist.js +3 -5
- package/dist/Editor/utils/embed.js +9 -5
- package/package.json +1 -1
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,
|
@@ -103,22 +103,26 @@ const MentionsPopup = /*#__PURE__*/forwardRef((props, ref) => {
|
|
103
103
|
}, 0);
|
104
104
|
};
|
105
105
|
const handleInsertMention = (char, e) => {
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
106
|
+
try {
|
107
|
+
if (!char.renderComponent) {
|
108
|
+
Transforms.select(editor, target);
|
109
|
+
if (char.type === "infinityAI") {
|
110
|
+
setOpenAI("fromElements");
|
111
|
+
}
|
112
|
+
insertMention(editor, char, type);
|
113
|
+
setMentions({
|
114
|
+
...mentions,
|
115
|
+
target: null
|
116
|
+
});
|
117
|
+
} else if (buttonRef && buttonRef?.current) {
|
118
|
+
if (e) {
|
119
|
+
e.preventDefault();
|
120
|
+
}
|
121
|
+
// trigger click of the ToolbarIcon button
|
122
|
+
buttonRef?.current?.triggerClick(target);
|
110
123
|
}
|
111
|
-
|
112
|
-
|
113
|
-
...mentions,
|
114
|
-
target: null
|
115
|
-
});
|
116
|
-
} else if (buttonRef && buttonRef?.current) {
|
117
|
-
if (e) {
|
118
|
-
e.preventDefault();
|
119
|
-
}
|
120
|
-
// trigger click of the ToolbarIcon button
|
121
|
-
buttonRef?.current?.triggerClick(target);
|
124
|
+
} catch (err) {
|
125
|
+
console.log(err);
|
122
126
|
}
|
123
127
|
};
|
124
128
|
return target && chars.length > 0 ? /*#__PURE__*/_jsx(Popper, {
|
@@ -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,
|
@@ -1536,19 +1536,17 @@ export const UploadImage = () => /*#__PURE__*/_jsx("svg", {
|
|
1536
1536
|
})
|
1537
1537
|
});
|
1538
1538
|
export const WorkflowIcon = () => {
|
1539
|
-
return /*#__PURE__*/
|
1539
|
+
return /*#__PURE__*/_jsx("svg", {
|
1540
1540
|
xmlns: "http://www.w3.org/2000/svg",
|
1541
1541
|
fill: "#000000",
|
1542
1542
|
width: "800px",
|
1543
1543
|
height: "800px",
|
1544
1544
|
viewBox: "0 0 32 32",
|
1545
1545
|
version: "1.1",
|
1546
|
-
children:
|
1547
|
-
children: "lightning-bolt"
|
1548
|
-
}), /*#__PURE__*/_jsx("path", {
|
1546
|
+
children: /*#__PURE__*/_jsx("path", {
|
1549
1547
|
d: "M23.5 13.187h-7.5v-12.187l-7.5 17.813h7.5v12.187l7.5-17.813z",
|
1550
1548
|
fill: "#f3b814"
|
1551
|
-
})
|
1549
|
+
})
|
1552
1550
|
});
|
1553
1551
|
};
|
1554
1552
|
export const LeftArrow = () => /*#__PURE__*/_jsx("svg", {
|
@@ -1,11 +1,15 @@
|
|
1
1
|
import { Transforms } from "slate";
|
2
2
|
import insertNewLine from "./insertNewLine";
|
3
3
|
export const insertDefaultEmbed = (editor, type, defaultURL = "") => {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
try {
|
5
|
+
const url = defaultURL ? defaultURL : type === "image" ? "" : "";
|
6
|
+
insertEmbed(editor, {
|
7
|
+
url,
|
8
|
+
images: []
|
9
|
+
}, type);
|
10
|
+
} catch (err) {
|
11
|
+
console.log(err);
|
12
|
+
}
|
9
13
|
};
|
10
14
|
export const createEmbedNode = (type, {
|
11
15
|
url,
|