@flozy/editor 3.5.6 → 3.5.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -94,7 +94,7 @@ const Form = props => {
|
|
94
94
|
let user_email = "";
|
95
95
|
let meta_data = [];
|
96
96
|
const validations = [];
|
97
|
-
let metaFieldDataBoards = getFieldData(
|
97
|
+
let metaFieldDataBoards = getFieldData("element_metadatakey", "form-field", "board");
|
98
98
|
for (let pair of formData.entries()) {
|
99
99
|
const emailObject = getFieldProps("element", "email");
|
100
100
|
if (emailObject?.name === pair[0]) {
|
@@ -164,7 +164,7 @@ const Form = props => {
|
|
164
164
|
alert(isValidForm[0]);
|
165
165
|
} else {
|
166
166
|
const formRes = await formSubmit(params, customProps);
|
167
|
-
if (formRes?.hasOwnProperty(
|
167
|
+
if (formRes?.hasOwnProperty("form_id")) {
|
168
168
|
onFormSubmit(formRes);
|
169
169
|
setSubmittedSuccessfully(true);
|
170
170
|
setAnchorEl(null);
|
@@ -414,6 +414,7 @@ const Form = props => {
|
|
414
414
|
})]
|
415
415
|
}) : /*#__PURE__*/_jsx(Grid, {
|
416
416
|
item: true,
|
417
|
+
contentEditable: false,
|
417
418
|
children: /*#__PURE__*/_jsxs(Grid, {
|
418
419
|
container: true,
|
419
420
|
alignItems: "center",
|
@@ -435,11 +436,11 @@ const Form = props => {
|
|
435
436
|
...getTRBLBreakPoints(bannerSpacing)
|
436
437
|
},
|
437
438
|
minHeight: `${formHeight}px`,
|
438
|
-
display:
|
439
|
+
display: "flex",
|
439
440
|
alignItems: "center",
|
440
441
|
justifyContent: "center",
|
441
442
|
textAlign: "center",
|
442
|
-
position:
|
443
|
+
position: "relative"
|
443
444
|
},
|
444
445
|
children: "Form Submitted Successfully...!"
|
445
446
|
})
|
@@ -7,7 +7,8 @@ import withEquation from "../plugins/withEquation";
|
|
7
7
|
import withMentions from "../plugins/withMentions";
|
8
8
|
import withLayout from "../plugins/withLayout";
|
9
9
|
import withHtml from "../plugins/withHTML";
|
10
|
+
import withCustomDeleteBackward from "../plugins/withCustomDeleteBackward";
|
10
11
|
const withCommon = (props, rest = {}) => {
|
11
|
-
return rest.needLayout ? withHtml(withEquation(withLayout(withHistory(withEmbeds(withTables(withLinks(withMentions(withReact(props))))))))) : withHtml(withEquation(withHistory(withEmbeds(withTables(withLinks(withMentions(withReact(props))))))));
|
12
|
+
return rest.needLayout ? withHtml(withEquation(withLayout(withHistory(withEmbeds(withTables(withLinks(withMentions(withCustomDeleteBackward(withReact(props)))))))))) : withHtml(withEquation(withHistory(withEmbeds(withTables(withLinks(withMentions(withCustomDeleteBackward(withReact(props)))))))));
|
12
13
|
};
|
13
14
|
export default withCommon;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { Editor, Node, Path, Transforms } from "slate";
|
2
|
+
const isNodeTextEmpty = node => {
|
3
|
+
const nodeText = Node.string(node);
|
4
|
+
return nodeText.trim() === "";
|
5
|
+
};
|
6
|
+
const withCustomDeleteBackward = editor => {
|
7
|
+
const {
|
8
|
+
deleteBackward
|
9
|
+
} = editor;
|
10
|
+
|
11
|
+
// Override deleteBackward
|
12
|
+
editor.deleteBackward = (...args) => {
|
13
|
+
const {
|
14
|
+
selection
|
15
|
+
} = editor;
|
16
|
+
if (selection) {
|
17
|
+
// Check if current node is a list item and is the last one
|
18
|
+
const [node] = Editor.nodes(editor, {
|
19
|
+
match: n => n.type === "list-item" // Adjust based on your list item type
|
20
|
+
});
|
21
|
+
|
22
|
+
if (node) {
|
23
|
+
// Check if it is the last list item is empty text
|
24
|
+
const parentNodePath = Path.parent(node[1]);
|
25
|
+
const isLastChildren = Node.get(editor, parentNodePath);
|
26
|
+
const isEmpty = isNodeTextEmpty(node[0]) && isLastChildren?.children?.length === 1;
|
27
|
+
if (isEmpty) {
|
28
|
+
Transforms.setNodes(editor, {
|
29
|
+
type: "paragraph"
|
30
|
+
}, {
|
31
|
+
at: parentNodePath
|
32
|
+
});
|
33
|
+
Transforms.removeNodes(editor, {
|
34
|
+
at: node[1]
|
35
|
+
});
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
// Fall back to default delete behavior if conditions are not met
|
42
|
+
deleteBackward(...args);
|
43
|
+
};
|
44
|
+
return editor;
|
45
|
+
};
|
46
|
+
export default withCustomDeleteBackward;
|
@@ -30,7 +30,6 @@ import Title from "../Elements/Title/title";
|
|
30
30
|
import Form from "../Elements/Form/Form";
|
31
31
|
import FormField from "../Elements/Form/FormField";
|
32
32
|
import InlineIcon from "../Elements/InlineIcon/InlineIcon";
|
33
|
-
import EmbedLink from "../Elements/Embed/link";
|
34
33
|
import SimpleText from "../Elements/SimpleText";
|
35
34
|
import CheckList from "../Elements/List/CheckList";
|
36
35
|
import { isEmptyTextNode } from "../helper";
|
@@ -477,8 +476,6 @@ export const getBlock = props => {
|
|
477
476
|
return /*#__PURE__*/_jsx(InlineIcon, {
|
478
477
|
...props
|
479
478
|
});
|
480
|
-
// case "embed":
|
481
|
-
// return <EmbedLink {...props} />;
|
482
479
|
case "docs":
|
483
480
|
case "pdf":
|
484
481
|
case "xls":
|