@flozy/editor 1.3.5 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +4 -2
- package/dist/Editor/Editor.css +64 -20
- package/dist/Editor/Elements/AppHeader/AppHeader.js +41 -13
- package/dist/Editor/Elements/Button/ButtonPopup.js +5 -3
- package/dist/Editor/Elements/Button/EditorButton.js +29 -6
- package/dist/Editor/Elements/Embed/Image.js +5 -21
- package/dist/Editor/Elements/Embed/Video.js +2 -2
- package/dist/Editor/Elements/Form/FieldPopup.js +20 -0
- package/dist/Editor/Elements/Form/Form.js +289 -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 +6 -8
- package/dist/Editor/Elements/Grid/GridItem.js +6 -13
- package/dist/Editor/Elements/Grid/GridItemPopup.js +4 -2
- package/dist/Editor/Elements/Grid/GridPopup.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/index.js +3 -0
- package/dist/Editor/Toolbar/Toolbar.js +6 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +3 -0
- package/dist/Editor/assets/fonts/poppins/OFL.txt +93 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-Black.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-BlackItalic.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-Bold.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-BoldItalic.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-ExtraBold.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-ExtraBoldItalic.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-ExtraLight.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-ExtraLightItalic.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-Italic.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-Light.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-LightItalic.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-Medium.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-MediumItalic.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-Regular.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-SemiBold.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-SemiBoldItalic.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-Thin.ttf +0 -0
- package/dist/Editor/assets/fonts/poppins/Poppins-ThinItalic.ttf +0 -0
- package/dist/Editor/common/StyleBuilder/appHeaderStyle.js +26 -5
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +35 -8
- package/dist/Editor/common/StyleBuilder/embedImageStyle.js +12 -12
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +71 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +2 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +5 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +15 -9
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +35 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +44 -0
- package/dist/Editor/common/StyleBuilder/formButtonStyle.js +93 -0
- package/dist/Editor/common/StyleBuilder/formStyle.js +82 -0
- package/dist/Editor/common/StyleBuilder/gridStyle.js +9 -0
- package/dist/Editor/font.css +9 -0
- package/dist/Editor/service/formSubmit.js +16 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +11 -1
- package/dist/Editor/utils/customHooks/useFormat.js +11 -4
- package/dist/Editor/utils/font.js +3 -1
- package/dist/Editor/utils/form.js +24 -0
- package/dist/Editor/utils/formfield.js +20 -0
- package/package.json +1 -1
@@ -0,0 +1,289 @@
|
|
1
|
+
import React, { useState, useRef } from "react";
|
2
|
+
import { Transforms } from "slate";
|
3
|
+
import { useSlateStatic, ReactEditor } from "slate-react";
|
4
|
+
import { IconButton, Tooltip, Grid, Menu, MenuItem, CircularProgress } from "@mui/material";
|
5
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
6
|
+
import SettingsIcon from "@mui/icons-material/Settings";
|
7
|
+
import AddIcon from "@mui/icons-material/Add";
|
8
|
+
import BackupIcon from "@mui/icons-material/Backup";
|
9
|
+
import FormPopup from "./FormPopup";
|
10
|
+
import ButtonPopup from "../Button/ButtonPopup";
|
11
|
+
import { formField } from "../../utils/formfield";
|
12
|
+
import { formSubmit } from "../../service/formSubmit";
|
13
|
+
import formButtonStyle from "../../common/StyleBuilder/formButtonStyle";
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
16
|
+
const Form = props => {
|
17
|
+
const {
|
18
|
+
attributes,
|
19
|
+
children,
|
20
|
+
element,
|
21
|
+
customProps
|
22
|
+
} = props;
|
23
|
+
const {
|
24
|
+
readOnly,
|
25
|
+
page_id
|
26
|
+
} = customProps;
|
27
|
+
const {
|
28
|
+
buttonProps,
|
29
|
+
textColor,
|
30
|
+
formName
|
31
|
+
} = element;
|
32
|
+
const btnR = buttonProps?.borderRadius || {};
|
33
|
+
const btnSpacing = buttonProps?.bannerSpacing || {};
|
34
|
+
const btnAlign = buttonProps?.alignment || {};
|
35
|
+
const btnM = buttonProps?.marginSpacing || {};
|
36
|
+
const editor = useSlateStatic();
|
37
|
+
const formEle = useRef();
|
38
|
+
const [openSetttings, setOpenSettings] = useState(false);
|
39
|
+
const [editButton, setEditButton] = useState(false);
|
40
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
41
|
+
const [loading, setLoading] = useState(false);
|
42
|
+
const path = ReactEditor.findPath(editor, element);
|
43
|
+
const btnBorderStyle = buttonProps?.borderColor?.indexOf("linear") >= 0 ? {
|
44
|
+
borderImageSource: buttonProps?.borderColor,
|
45
|
+
borderImageSlice: 1
|
46
|
+
} : {
|
47
|
+
borderColor: buttonProps?.borderColor || "none"
|
48
|
+
};
|
49
|
+
const handleSubmit = async (event, test = false) => {
|
50
|
+
if (event) {
|
51
|
+
event.preventDefault();
|
52
|
+
}
|
53
|
+
if ((readOnly || test) && formEle && formEle?.current) {
|
54
|
+
const formData = new FormData(formEle?.current);
|
55
|
+
setLoading(true);
|
56
|
+
let response = {};
|
57
|
+
for (let pair of formData.entries()) {
|
58
|
+
response = {
|
59
|
+
...response,
|
60
|
+
[pair[0]]: pair[1]
|
61
|
+
};
|
62
|
+
}
|
63
|
+
let params = {
|
64
|
+
page_id: page_id,
|
65
|
+
form_id: `${formName}`,
|
66
|
+
response,
|
67
|
+
form_data: {
|
68
|
+
email: element?.email,
|
69
|
+
save_response: element?.saveResponse
|
70
|
+
}
|
71
|
+
};
|
72
|
+
await formSubmit(params, customProps);
|
73
|
+
setLoading(false);
|
74
|
+
}
|
75
|
+
};
|
76
|
+
const onSettings = () => {
|
77
|
+
setOpenSettings(true);
|
78
|
+
};
|
79
|
+
const onSave = data => {
|
80
|
+
const path = ReactEditor.findPath(editor, element);
|
81
|
+
const updateData = {
|
82
|
+
...data
|
83
|
+
};
|
84
|
+
delete updateData.children;
|
85
|
+
Transforms.setNodes(editor, {
|
86
|
+
...updateData
|
87
|
+
}, {
|
88
|
+
at: path
|
89
|
+
});
|
90
|
+
onClose();
|
91
|
+
};
|
92
|
+
const onClose = () => {
|
93
|
+
setOpenSettings(false);
|
94
|
+
};
|
95
|
+
const onAddFormField = () => {
|
96
|
+
try {
|
97
|
+
Transforms.insertNodes(editor, {
|
98
|
+
...formField()
|
99
|
+
}, {
|
100
|
+
at: [...path, children.length]
|
101
|
+
});
|
102
|
+
} catch (err) {
|
103
|
+
console.log(err, "Add Field Error in Form Builder");
|
104
|
+
}
|
105
|
+
};
|
106
|
+
const onDelete = () => {
|
107
|
+
if (path) {
|
108
|
+
Transforms.removeNodes(editor, {
|
109
|
+
at: path
|
110
|
+
});
|
111
|
+
}
|
112
|
+
};
|
113
|
+
const onSaveButtonSettings = data => {
|
114
|
+
onSave({
|
115
|
+
buttonProps: {
|
116
|
+
...data
|
117
|
+
}
|
118
|
+
});
|
119
|
+
onCloseButtonSettings();
|
120
|
+
};
|
121
|
+
const onCloseButtonSettings = () => {
|
122
|
+
setAnchorEl(null);
|
123
|
+
setEditButton(false);
|
124
|
+
};
|
125
|
+
const handleClose = () => {
|
126
|
+
setAnchorEl(null);
|
127
|
+
};
|
128
|
+
const onMenuClick = menuName => () => {
|
129
|
+
switch (menuName) {
|
130
|
+
case "edit":
|
131
|
+
setEditButton(true);
|
132
|
+
break;
|
133
|
+
case "close":
|
134
|
+
setEditButton(false);
|
135
|
+
break;
|
136
|
+
case "test":
|
137
|
+
// test submit form
|
138
|
+
handleSubmit(null, true);
|
139
|
+
break;
|
140
|
+
default:
|
141
|
+
return;
|
142
|
+
}
|
143
|
+
};
|
144
|
+
const onSubmitClick = e => {
|
145
|
+
if (readOnly) {
|
146
|
+
// submit the form
|
147
|
+
} else {
|
148
|
+
setAnchorEl(e.currentTarget);
|
149
|
+
}
|
150
|
+
};
|
151
|
+
const FormToolbar = () => {
|
152
|
+
return /*#__PURE__*/_jsxs("div", {
|
153
|
+
className: "",
|
154
|
+
contentEditable: false,
|
155
|
+
children: [/*#__PURE__*/_jsx(Tooltip, {
|
156
|
+
title: "Form Settings",
|
157
|
+
arrow: true,
|
158
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
159
|
+
onClick: onSettings,
|
160
|
+
children: /*#__PURE__*/_jsx(SettingsIcon, {})
|
161
|
+
})
|
162
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
163
|
+
title: "Add Form Field",
|
164
|
+
arrow: true,
|
165
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
166
|
+
onClick: onAddFormField,
|
167
|
+
children: /*#__PURE__*/_jsx(AddIcon, {})
|
168
|
+
})
|
169
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
170
|
+
title: "Delete Form",
|
171
|
+
arrow: true,
|
172
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
173
|
+
onClick: onDelete,
|
174
|
+
children: /*#__PURE__*/_jsx(DeleteIcon, {})
|
175
|
+
})
|
176
|
+
})]
|
177
|
+
});
|
178
|
+
};
|
179
|
+
return /*#__PURE__*/_jsxs("div", {
|
180
|
+
...attributes,
|
181
|
+
className: "form-wrapper element-root",
|
182
|
+
style: {
|
183
|
+
border: !readOnly ? "1px dotted red" : "none",
|
184
|
+
padding: "10px"
|
185
|
+
},
|
186
|
+
children: [!readOnly && /*#__PURE__*/_jsx(FormToolbar, {}), /*#__PURE__*/_jsxs("form", {
|
187
|
+
id: `${formName}`,
|
188
|
+
onSubmit: handleSubmit,
|
189
|
+
style: {
|
190
|
+
color: textColor || "#FFF"
|
191
|
+
},
|
192
|
+
ref: formEle,
|
193
|
+
children: [/*#__PURE__*/_jsxs(Grid, {
|
194
|
+
container: true,
|
195
|
+
spacing: 2,
|
196
|
+
children: [children, /*#__PURE__*/_jsx(Grid, {
|
197
|
+
item: true,
|
198
|
+
className: "form-btn-wrpr",
|
199
|
+
contentEditable: false,
|
200
|
+
style: {
|
201
|
+
display: "flex",
|
202
|
+
justifyContent: btnAlign?.horizantal || "start",
|
203
|
+
alignItems: btnAlign?.vertical || "start",
|
204
|
+
marginLeft: "0px"
|
205
|
+
},
|
206
|
+
children: /*#__PURE__*/_jsx("button", {
|
207
|
+
onClick: onSubmitClick,
|
208
|
+
disabled: loading,
|
209
|
+
style: {
|
210
|
+
background: buttonProps?.bgColor || "rgb(30, 75, 122)",
|
211
|
+
borderWidth: "1px",
|
212
|
+
borderBlockStyle: "solid",
|
213
|
+
...btnBorderStyle,
|
214
|
+
borderRadius: `${btnR?.topLeft}px ${btnR?.topRight}px ${btnR?.bottomLeft}px ${btnR?.bottomRight}px`,
|
215
|
+
paddingLeft: `${btnSpacing?.left || 8}px`,
|
216
|
+
paddingRight: `${btnSpacing?.right || 8}px`,
|
217
|
+
paddingTop: `${btnSpacing?.top || 8}px`,
|
218
|
+
paddingBottom: `${btnSpacing?.bottom || 8}px`,
|
219
|
+
marginLeft: `${btnM?.left || 0}px`,
|
220
|
+
marginRight: `${btnM?.right || 0}px`,
|
221
|
+
marginTop: `${btnM?.top || 0}px`,
|
222
|
+
marginBottom: `${btnM?.bottom || 0}px`,
|
223
|
+
color: `${buttonProps?.textColor || "#FFFFFF"}`,
|
224
|
+
fontSize: buttonProps?.textSize || "inherit",
|
225
|
+
height: "fit-content",
|
226
|
+
fontFamily: buttonProps?.fontFamily || "PoppinsRegular"
|
227
|
+
},
|
228
|
+
children: buttonProps?.label || "Submit"
|
229
|
+
})
|
230
|
+
})]
|
231
|
+
}), loading && /*#__PURE__*/_jsx("div", {
|
232
|
+
style: {
|
233
|
+
position: "absolute",
|
234
|
+
top: 0,
|
235
|
+
left: 0,
|
236
|
+
width: "100%",
|
237
|
+
height: "100%",
|
238
|
+
background: "rgba(255,255,255,0.5)"
|
239
|
+
},
|
240
|
+
children: /*#__PURE__*/_jsx(CircularProgress, {
|
241
|
+
style: {
|
242
|
+
position: "absolute",
|
243
|
+
left: 0,
|
244
|
+
right: 0,
|
245
|
+
top: 0,
|
246
|
+
bottom: 0,
|
247
|
+
margin: "auto"
|
248
|
+
}
|
249
|
+
})
|
250
|
+
})]
|
251
|
+
}), openSetttings ? /*#__PURE__*/_jsx(FormPopup, {
|
252
|
+
element: element,
|
253
|
+
onSave: onSave,
|
254
|
+
onClose: onClose
|
255
|
+
}) : null, !readOnly ? /*#__PURE__*/_jsxs(Menu, {
|
256
|
+
className: "editor-btn-options",
|
257
|
+
open: anchorEl !== null,
|
258
|
+
anchorEl: anchorEl,
|
259
|
+
onClose: handleClose,
|
260
|
+
children: [/*#__PURE__*/_jsx(MenuItem, {
|
261
|
+
onClick: onMenuClick("edit"),
|
262
|
+
children: /*#__PURE__*/_jsx(Tooltip, {
|
263
|
+
title: "Button Settings",
|
264
|
+
arrow: true,
|
265
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
266
|
+
children: /*#__PURE__*/_jsx(SettingsIcon, {})
|
267
|
+
})
|
268
|
+
})
|
269
|
+
}), /*#__PURE__*/_jsx(MenuItem, {
|
270
|
+
onClick: onMenuClick("test"),
|
271
|
+
children: /*#__PURE__*/_jsx(Tooltip, {
|
272
|
+
title: "Test Submit",
|
273
|
+
arrow: true,
|
274
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
275
|
+
children: /*#__PURE__*/_jsx(BackupIcon, {})
|
276
|
+
})
|
277
|
+
})
|
278
|
+
})]
|
279
|
+
}) : null, editButton && /*#__PURE__*/_jsx(ButtonPopup, {
|
280
|
+
element: buttonProps || {},
|
281
|
+
onSave: onSaveButtonSettings,
|
282
|
+
onClose: onCloseButtonSettings,
|
283
|
+
customProps: customProps,
|
284
|
+
style: formButtonStyle,
|
285
|
+
styleName: "formButtonStyle"
|
286
|
+
})]
|
287
|
+
});
|
288
|
+
};
|
289
|
+
export default Form;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { useSlateStatic } from "slate-react";
|
3
|
+
import { IconButton, Tooltip } from "@mui/material";
|
4
|
+
import FeedIcon from "@mui/icons-material/Feed";
|
5
|
+
import { insertForm } from "../../utils/form";
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
const FormButton = props => {
|
8
|
+
const editor = useSlateStatic();
|
9
|
+
const onClick = () => {
|
10
|
+
insertForm(editor);
|
11
|
+
};
|
12
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
13
|
+
title: "Form",
|
14
|
+
arrow: true,
|
15
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
16
|
+
onClick: onClick,
|
17
|
+
children: /*#__PURE__*/_jsx(FeedIcon, {})
|
18
|
+
})
|
19
|
+
});
|
20
|
+
};
|
21
|
+
export default FormButton;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Grid } from "@mui/material";
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
4
|
+
const FormText = props => {
|
5
|
+
const {
|
6
|
+
fieldProps
|
7
|
+
} = props;
|
8
|
+
const {
|
9
|
+
borderColor,
|
10
|
+
bannerSpacing,
|
11
|
+
borderRadius
|
12
|
+
} = fieldProps;
|
13
|
+
const {
|
14
|
+
left,
|
15
|
+
top,
|
16
|
+
right,
|
17
|
+
bottom
|
18
|
+
} = bannerSpacing || {};
|
19
|
+
const {
|
20
|
+
topLeft,
|
21
|
+
topRight,
|
22
|
+
bottomLeft,
|
23
|
+
bottomRight
|
24
|
+
} = borderRadius || {};
|
25
|
+
console.log(fieldProps);
|
26
|
+
const onChange = e => {
|
27
|
+
e.preventDefault();
|
28
|
+
};
|
29
|
+
return /*#__PURE__*/_jsx(Grid, {
|
30
|
+
item: true,
|
31
|
+
xs: 12,
|
32
|
+
contentEditable: false,
|
33
|
+
children: /*#__PURE__*/_jsx("input", {
|
34
|
+
...fieldProps,
|
35
|
+
onChange: onChange,
|
36
|
+
style: {
|
37
|
+
width: "100%",
|
38
|
+
border: `1px solid ${borderColor || "#FFF"}`,
|
39
|
+
borderRadius: `${topLeft}px ${topRight}px ${bottomLeft}px ${bottomRight}px`,
|
40
|
+
paddingLeft: `${left || 8}px`,
|
41
|
+
paddingRight: `${right || 8}px`,
|
42
|
+
paddingTop: `${top || 8}px`,
|
43
|
+
paddingBottom: `${bottom || 8}px`
|
44
|
+
}
|
45
|
+
})
|
46
|
+
});
|
47
|
+
};
|
48
|
+
export default FormText;
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Transforms } from "slate";
|
3
|
+
import { useSlateStatic, ReactEditor } from "slate-react";
|
4
|
+
import { IconButton, Tooltip, Grid } from "@mui/material";
|
5
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
6
|
+
import SettingsIcon from "@mui/icons-material/Settings";
|
7
|
+
import FormElements from "./FormElements";
|
8
|
+
import FieldPopup from "./FieldPopup";
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
11
|
+
const FormField = props => {
|
12
|
+
const {
|
13
|
+
attributes,
|
14
|
+
element,
|
15
|
+
customProps
|
16
|
+
} = props;
|
17
|
+
const {
|
18
|
+
readOnly
|
19
|
+
} = customProps;
|
20
|
+
const {
|
21
|
+
element: elementType,
|
22
|
+
grid,
|
23
|
+
children,
|
24
|
+
...elementProps
|
25
|
+
} = element;
|
26
|
+
const FormElement = FormElements[elementType];
|
27
|
+
const editor = useSlateStatic();
|
28
|
+
const path = ReactEditor.findPath(editor, element);
|
29
|
+
const [openSetttings, setOpenSettings] = useState(false);
|
30
|
+
const itemWidth = (grid || 6) / 12 * 100;
|
31
|
+
const onSettings = () => {
|
32
|
+
setOpenSettings(true);
|
33
|
+
};
|
34
|
+
const onSave = data => {
|
35
|
+
const updateData = {
|
36
|
+
...data
|
37
|
+
};
|
38
|
+
delete updateData.children;
|
39
|
+
Transforms.setNodes(editor, {
|
40
|
+
...updateData
|
41
|
+
}, {
|
42
|
+
at: path
|
43
|
+
});
|
44
|
+
onClose();
|
45
|
+
};
|
46
|
+
const onDelete = () => {
|
47
|
+
Transforms.removeNodes(editor, {
|
48
|
+
at: path
|
49
|
+
});
|
50
|
+
};
|
51
|
+
const onClose = () => {
|
52
|
+
setOpenSettings(false);
|
53
|
+
};
|
54
|
+
const FieldToolbar = () => {
|
55
|
+
return /*#__PURE__*/_jsxs("div", {
|
56
|
+
className: "",
|
57
|
+
contentEditable: false,
|
58
|
+
style: {
|
59
|
+
position: "absolute",
|
60
|
+
right: "0px",
|
61
|
+
top: "16px",
|
62
|
+
bottom: 0,
|
63
|
+
margin: "auto",
|
64
|
+
height: "42px",
|
65
|
+
zIndex: 101
|
66
|
+
},
|
67
|
+
children: [/*#__PURE__*/_jsx(Tooltip, {
|
68
|
+
title: "Field Settings",
|
69
|
+
arrow: true,
|
70
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
71
|
+
onClick: onSettings,
|
72
|
+
children: /*#__PURE__*/_jsx(SettingsIcon, {})
|
73
|
+
})
|
74
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
75
|
+
title: "Delete Field",
|
76
|
+
arrow: true,
|
77
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
78
|
+
onClick: onDelete,
|
79
|
+
children: /*#__PURE__*/_jsx(DeleteIcon, {})
|
80
|
+
})
|
81
|
+
})]
|
82
|
+
});
|
83
|
+
};
|
84
|
+
return /*#__PURE__*/_jsxs(Grid, {
|
85
|
+
item: true,
|
86
|
+
...attributes,
|
87
|
+
className: "form-field",
|
88
|
+
style: {
|
89
|
+
position: "relative",
|
90
|
+
width: `${itemWidth}%`
|
91
|
+
},
|
92
|
+
children: [!readOnly && /*#__PURE__*/_jsx(FieldToolbar, {}), /*#__PURE__*/_jsx(FormElement, {
|
93
|
+
fieldProps: elementProps
|
94
|
+
}), openSetttings ? /*#__PURE__*/_jsx(FieldPopup, {
|
95
|
+
element: element,
|
96
|
+
onSave: onSave,
|
97
|
+
onClose: onClose
|
98
|
+
}) : null]
|
99
|
+
});
|
100
|
+
};
|
101
|
+
export default FormField;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import StyleBuilder from "../../common/StyleBuilder";
|
3
|
+
import formStyle from "../../common/StyleBuilder/formStyle";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
const FormPopup = props => {
|
6
|
+
const {
|
7
|
+
element,
|
8
|
+
onSave,
|
9
|
+
onClose
|
10
|
+
} = props;
|
11
|
+
return /*#__PURE__*/_jsx(StyleBuilder, {
|
12
|
+
title: "Form",
|
13
|
+
type: "formStyle",
|
14
|
+
element: element,
|
15
|
+
onSave: onSave,
|
16
|
+
onClose: onClose,
|
17
|
+
renderTabs: formStyle
|
18
|
+
});
|
19
|
+
};
|
20
|
+
export default FormPopup;
|
@@ -4,7 +4,6 @@ import { useSelected, useSlateStatic, ReactEditor } from "slate-react";
|
|
4
4
|
import { gridItem } from "../../utils/gridItem";
|
5
5
|
import GridPopup from "./GridPopup";
|
6
6
|
import { IconButton, Tooltip } from "@mui/material";
|
7
|
-
import DeleteIcon from "@mui/icons-material/Delete";
|
8
7
|
import SettingsIcon from "@mui/icons-material/Settings";
|
9
8
|
import AddIcon from "@mui/icons-material/Add";
|
10
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
@@ -21,6 +20,7 @@ const Grid = props => {
|
|
21
20
|
} = customProps;
|
22
21
|
const [openSetttings, setOpenSettings] = useState(false);
|
23
22
|
const {
|
23
|
+
id,
|
24
24
|
grid,
|
25
25
|
bannerSpacing,
|
26
26
|
bgColor,
|
@@ -109,19 +109,16 @@ const Grid = props => {
|
|
109
109
|
onClick: onAddGridItem,
|
110
110
|
children: /*#__PURE__*/_jsx(AddIcon, {})
|
111
111
|
})
|
112
|
-
}), /*#__PURE__*/_jsx(Tooltip, {
|
113
|
-
title: "Delete Grid",
|
114
|
-
arrow: true,
|
115
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
116
|
-
onClick: onDelete,
|
117
|
-
children: /*#__PURE__*/_jsx(DeleteIcon, {})
|
118
|
-
})
|
119
112
|
})]
|
120
113
|
}) : null;
|
121
114
|
};
|
115
|
+
const sectionId = id ? {
|
116
|
+
id
|
117
|
+
} : {};
|
122
118
|
return /*#__PURE__*/_jsxs("div", {
|
123
119
|
className: `grid-container ${grid} element-root`,
|
124
120
|
...attributes,
|
121
|
+
...sectionId,
|
125
122
|
style: {
|
126
123
|
background: bgColor,
|
127
124
|
alignContent: vertical,
|
@@ -136,6 +133,7 @@ const Grid = props => {
|
|
136
133
|
element: element,
|
137
134
|
onSave: onSave,
|
138
135
|
onClose: onClose,
|
136
|
+
onDelete: onDelete,
|
139
137
|
customProps: customProps
|
140
138
|
}) : null, /*#__PURE__*/_jsx("div", {
|
141
139
|
style: {
|
@@ -3,7 +3,6 @@ import { Transforms } from "slate";
|
|
3
3
|
import { useSelected, useSlateStatic, ReactEditor } from "slate-react";
|
4
4
|
import GridItemPopup from "./GridItemPopup";
|
5
5
|
import { IconButton, Tooltip } from "@mui/material";
|
6
|
-
import DeleteIcon from "@mui/icons-material/Delete";
|
7
6
|
import SettingsIcon from "@mui/icons-material/Settings";
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -39,28 +38,21 @@ const GridItem = props => {
|
|
39
38
|
const itemWidth = (grid || 6) / 12 * 100;
|
40
39
|
const path = ReactEditor.findPath(editor, element);
|
41
40
|
const GridItemToolbar = () => {
|
42
|
-
return selected ? /*#__PURE__*/
|
41
|
+
return selected ? /*#__PURE__*/_jsx("div", {
|
43
42
|
contentEditable: false,
|
44
43
|
className: "grid-item-toolbar",
|
45
44
|
style: {
|
46
45
|
top: "0px"
|
47
46
|
},
|
48
|
-
children:
|
49
|
-
title: "Grid Settings",
|
47
|
+
children: /*#__PURE__*/_jsx(Tooltip, {
|
48
|
+
title: "Grid Item Settings",
|
50
49
|
arrow: true,
|
51
50
|
children: /*#__PURE__*/_jsx(IconButton, {
|
52
51
|
size: "small",
|
53
52
|
onClick: onSettings,
|
54
53
|
children: /*#__PURE__*/_jsx(SettingsIcon, {})
|
55
54
|
})
|
56
|
-
})
|
57
|
-
title: "Delete Grid",
|
58
|
-
arrow: true,
|
59
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
60
|
-
onClick: onDelete,
|
61
|
-
children: /*#__PURE__*/_jsx(DeleteIcon, {})
|
62
|
-
})
|
63
|
-
})]
|
55
|
+
})
|
64
56
|
}) : null;
|
65
57
|
};
|
66
58
|
const onSettings = () => {
|
@@ -118,7 +110,8 @@ const GridItem = props => {
|
|
118
110
|
}), openSetttings ? /*#__PURE__*/_jsx(GridItemPopup, {
|
119
111
|
element: element,
|
120
112
|
onSave: onSave,
|
121
|
-
onClose: onClose
|
113
|
+
onClose: onClose,
|
114
|
+
onDelete: onDelete
|
122
115
|
}) : null]
|
123
116
|
});
|
124
117
|
};
|
@@ -6,7 +6,8 @@ const GridItemPopup = props => {
|
|
6
6
|
const {
|
7
7
|
element,
|
8
8
|
onSave,
|
9
|
-
onClose
|
9
|
+
onClose,
|
10
|
+
onDelete
|
10
11
|
} = props;
|
11
12
|
return /*#__PURE__*/_jsx(StyleBuilder, {
|
12
13
|
title: "Grid Item",
|
@@ -14,7 +15,8 @@ const GridItemPopup = props => {
|
|
14
15
|
element: element,
|
15
16
|
onSave: onSave,
|
16
17
|
onClose: onClose,
|
17
|
-
renderTabs: gridItemStyle
|
18
|
+
renderTabs: gridItemStyle,
|
19
|
+
onDelete: onDelete
|
18
20
|
});
|
19
21
|
};
|
20
22
|
export default GridItemPopup;
|
@@ -7,6 +7,7 @@ const GridPopup = props => {
|
|
7
7
|
element,
|
8
8
|
onSave,
|
9
9
|
onClose,
|
10
|
+
onDelete,
|
10
11
|
customProps
|
11
12
|
} = props;
|
12
13
|
return /*#__PURE__*/_jsx(StyleBuilder, {
|
@@ -16,7 +17,8 @@ const GridPopup = props => {
|
|
16
17
|
onSave: onSave,
|
17
18
|
onClose: onClose,
|
18
19
|
renderTabs: gridStyle,
|
19
|
-
customProps: customProps
|
20
|
+
customProps: customProps,
|
21
|
+
onDelete: onDelete
|
20
22
|
});
|
21
23
|
};
|
22
24
|
export default GridPopup;
|
@@ -5,6 +5,7 @@ import { Editor, Range } from "slate";
|
|
5
5
|
import { useSlate, useFocused } from "slate-react";
|
6
6
|
import TextFormat from "./TextFormat";
|
7
7
|
import usePopupStyle from "./PopupToolStyle";
|
8
|
+
import useFormat from "../../utils/customHooks/useFormat";
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
11
|
const PopupTool = () => {
|
@@ -17,7 +18,9 @@ const PopupTool = () => {
|
|
17
18
|
} = editor;
|
18
19
|
const open = Boolean(anchorEl);
|
19
20
|
const id = open ? "popup-edit-tool" : "";
|
21
|
+
console.log(useFormat(editor, null));
|
20
22
|
useEffect(() => {
|
23
|
+
console.log(selection, inFocus);
|
21
24
|
if (!selection || !inFocus || Range.isCollapsed(selection) || Editor.string(editor, selection) === "") {
|
22
25
|
setAnchorEl(null);
|
23
26
|
} else {
|
@@ -21,6 +21,7 @@ import PageSettingsButton from "../Elements/PageSettings/PageSettingsButton";
|
|
21
21
|
import CarouselButton from "../Elements/Carousel/CarouselButton";
|
22
22
|
import AppHeaderButton from "../Elements/AppHeader/AppHeaderButton";
|
23
23
|
import "./styles.css";
|
24
|
+
import FormButton from "../Elements/Form/FormButton.js";
|
24
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
25
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
26
27
|
const Toolbar = props => {
|
@@ -148,6 +149,11 @@ const Toolbar = props => {
|
|
148
149
|
editor: editor,
|
149
150
|
customProps: customProps
|
150
151
|
}, element.id);
|
152
|
+
case "form":
|
153
|
+
return /*#__PURE__*/_jsx(FormButton, {
|
154
|
+
editor: editor,
|
155
|
+
customProps: customProps
|
156
|
+
}, element.id);
|
151
157
|
default:
|
152
158
|
return null;
|
153
159
|
}
|