@flozy/editor 1.3.4 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +5 -3
- package/dist/Editor/Editor.css +388 -314
- package/dist/Editor/Elements/Accordion/Accordion.js +31 -9
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +17 -5
- package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -1
- package/dist/Editor/Elements/Button/EditorButton.js +8 -2
- package/dist/Editor/Elements/Carousel/Carousel.js +38 -18
- package/dist/Editor/Elements/Embed/Video.js +3 -4
- package/dist/Editor/Elements/Form/FieldPopup.js +20 -0
- package/dist/Editor/Elements/Form/Form.js +268 -0
- package/dist/Editor/Elements/Form/FormButton.js +21 -0
- package/dist/Editor/Elements/Form/FormElements/FormText.js +48 -0
- package/dist/Editor/Elements/Form/FormElements/index.js +5 -0
- package/dist/Editor/Elements/Form/FormField.js +101 -0
- package/dist/Editor/Elements/Form/FormPopup.js +20 -0
- package/dist/Editor/Elements/Grid/Grid.js +10 -3
- package/dist/Editor/Elements/Grid/GridButton.js +24 -5
- package/dist/Editor/Elements/Grid/GridItem.js +11 -4
- package/dist/Editor/Toolbar/Toolbar.js +6 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +3 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +28 -2
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +71 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +28 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +7 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +3 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +35 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/textAlign.js +60 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +46 -0
- package/dist/Editor/common/StyleBuilder/formStyle.js +82 -0
- package/dist/Editor/service/formSubmit.js +16 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +12 -1
- package/dist/Editor/utils/form.js +24 -0
- package/dist/Editor/utils/formfield.js +20 -0
- package/dist/Editor/utils/grid.js +0 -1
- package/package.json +1 -1
@@ -0,0 +1,82 @@
|
|
1
|
+
const formStyle = [{
|
2
|
+
tab: "General",
|
3
|
+
value: "general",
|
4
|
+
fields: [{
|
5
|
+
label: "Form Name",
|
6
|
+
key: "formName",
|
7
|
+
type: "text"
|
8
|
+
}, {
|
9
|
+
label: "Send Form to Email",
|
10
|
+
key: "email",
|
11
|
+
type: "text",
|
12
|
+
placeholder: "Enter Email to send the response..."
|
13
|
+
}, {
|
14
|
+
label: "Save Response",
|
15
|
+
key: "saveResponse",
|
16
|
+
type: "selectBox",
|
17
|
+
placeholder: "Save Response"
|
18
|
+
}]
|
19
|
+
}, {
|
20
|
+
tab: "Banner Spacing",
|
21
|
+
value: "bannerSpacing",
|
22
|
+
fields: [{
|
23
|
+
label: "Banner Spacing",
|
24
|
+
key: "bannerSpacing",
|
25
|
+
type: "bannerSpacing"
|
26
|
+
}]
|
27
|
+
}, {
|
28
|
+
tab: "Border Radius",
|
29
|
+
value: "borderRadius",
|
30
|
+
fields: [{
|
31
|
+
label: "Border Radius",
|
32
|
+
key: "borderRadius",
|
33
|
+
type: "borderRadius"
|
34
|
+
}]
|
35
|
+
}, {
|
36
|
+
tab: "Colors",
|
37
|
+
value: "colors",
|
38
|
+
fields: [{
|
39
|
+
label: "Text",
|
40
|
+
key: "textColor",
|
41
|
+
type: "color",
|
42
|
+
needPreview: true
|
43
|
+
}, {
|
44
|
+
label: "Background",
|
45
|
+
key: "bgColor",
|
46
|
+
type: "color"
|
47
|
+
}, {
|
48
|
+
label: "Border",
|
49
|
+
key: "borderColor",
|
50
|
+
type: "color"
|
51
|
+
}]
|
52
|
+
}, {
|
53
|
+
tab: "Position",
|
54
|
+
value: "position",
|
55
|
+
fields: [{
|
56
|
+
label: "Set Postion (Vertical & Horizantal)",
|
57
|
+
key: "alignment",
|
58
|
+
type: "alignment"
|
59
|
+
}]
|
60
|
+
}, {
|
61
|
+
tab: "Background",
|
62
|
+
value: "backgroundImage",
|
63
|
+
fields: [{
|
64
|
+
label: "URL",
|
65
|
+
key: "backgroundImage",
|
66
|
+
type: "text"
|
67
|
+
}, {
|
68
|
+
label: "Background Image",
|
69
|
+
key: "backgroundImage",
|
70
|
+
type: "backgroundImage"
|
71
|
+
}]
|
72
|
+
}, {
|
73
|
+
tab: "Save As Template",
|
74
|
+
value: "saveAsTemplate",
|
75
|
+
needActions: false,
|
76
|
+
fields: [{
|
77
|
+
label: "Template Image",
|
78
|
+
key: "saveAsTemplate",
|
79
|
+
type: "saveAsTemplate"
|
80
|
+
}]
|
81
|
+
}];
|
82
|
+
export default formStyle;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export const formSubmit = async formData => {
|
2
|
+
try {
|
3
|
+
const response = await fetch(`/form/submit`, {
|
4
|
+
method: "POST",
|
5
|
+
headers: {
|
6
|
+
"Content-Type": "application/json"
|
7
|
+
},
|
8
|
+
body: JSON.stringify(formData)
|
9
|
+
});
|
10
|
+
const result = await response.json();
|
11
|
+
return result.data;
|
12
|
+
} catch (err) {
|
13
|
+
console.log(err);
|
14
|
+
return err;
|
15
|
+
}
|
16
|
+
};
|
@@ -26,6 +26,8 @@ import DrawerMenu from "../Elements/DrawerMenu/DrawerMenu";
|
|
26
26
|
import AppHeader from "../Elements/AppHeader/AppHeader";
|
27
27
|
import PageSettings from "../Elements/PageSettings/PageSettings";
|
28
28
|
import Title from "../Elements/Title/title";
|
29
|
+
import Form from "../Elements/Form/Form";
|
30
|
+
import FormField from "../Elements/Form/FormField";
|
29
31
|
import { jsx as _jsx } from "react/jsx-runtime";
|
30
32
|
const alignment = ["alignLeft", "alignRight", "alignCenter"];
|
31
33
|
const list_types = ["orderedList", "unorderedList"];
|
@@ -229,7 +231,8 @@ export const getBlock = props => {
|
|
229
231
|
display: "flex",
|
230
232
|
alignItems: "center",
|
231
233
|
listStylePosition: "inside",
|
232
|
-
flexDirection: "column"
|
234
|
+
flexDirection: "column",
|
235
|
+
textAlign: "center"
|
233
236
|
},
|
234
237
|
...attributes,
|
235
238
|
...element.attr,
|
@@ -368,6 +371,14 @@ export const getBlock = props => {
|
|
368
371
|
return /*#__PURE__*/_jsx(Title, {
|
369
372
|
...props
|
370
373
|
});
|
374
|
+
case "form":
|
375
|
+
return /*#__PURE__*/_jsx(Form, {
|
376
|
+
...props
|
377
|
+
});
|
378
|
+
case "form-field":
|
379
|
+
return /*#__PURE__*/_jsx(FormField, {
|
380
|
+
...props
|
381
|
+
});
|
371
382
|
default:
|
372
383
|
return /*#__PURE__*/_jsx("div", {
|
373
384
|
...element.attr,
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { Transforms } from "slate";
|
2
|
+
import { formField } from "./formfield";
|
3
|
+
export const insertForm = (editor, item) => {
|
4
|
+
const grid = !item ? {
|
5
|
+
type: "form",
|
6
|
+
grid: "container",
|
7
|
+
formName: `form_${new Date().getTime()}`,
|
8
|
+
props: {
|
9
|
+
onSubmit: null
|
10
|
+
},
|
11
|
+
children: [{
|
12
|
+
...formField()
|
13
|
+
}, {
|
14
|
+
text: ""
|
15
|
+
}]
|
16
|
+
} : item;
|
17
|
+
const {
|
18
|
+
selection
|
19
|
+
} = editor;
|
20
|
+
Transforms.insertNodes(editor, grid, {
|
21
|
+
at: selection.focus.path
|
22
|
+
});
|
23
|
+
Transforms.move(editor);
|
24
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { Transforms } from "slate";
|
2
|
+
export const formField = () => {
|
3
|
+
return {
|
4
|
+
type: "form-field",
|
5
|
+
grid: 6,
|
6
|
+
element: "text",
|
7
|
+
name: `field_${new Date().getTime()}`,
|
8
|
+
placeholder: "Placeholder...",
|
9
|
+
children: [{
|
10
|
+
text: ""
|
11
|
+
}],
|
12
|
+
bgColor: "rgba(255, 255, 255, 0)"
|
13
|
+
};
|
14
|
+
};
|
15
|
+
export const insertGridItem = editor => {
|
16
|
+
Transforms.insertNodes(editor, {
|
17
|
+
...formField()
|
18
|
+
});
|
19
|
+
Transforms.move(editor);
|
20
|
+
};
|