@flozy/editor 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor/CommonEditor.js +7 -4
- package/dist/Editor/Editor.css +25 -3
- package/dist/Editor/Elements/Button/EditorButton.js +9 -1
- package/dist/Editor/Elements/Embed/EmbedPopup.js +4 -3
- package/dist/Editor/Elements/Embed/Image.js +45 -11
- package/dist/Editor/Elements/Embed/Video.js +70 -11
- package/dist/Editor/Elements/Grid/Grid.js +39 -17
- package/dist/Editor/Elements/Grid/GridButton.js +36 -12
- package/dist/Editor/Elements/Grid/GridItem.js +27 -11
- package/dist/Editor/Elements/Grid/full_grid.png +0 -0
- package/dist/Editor/Elements/Grid/templates/image_banner_text.js +56 -0
- package/dist/Editor/Elements/Grid/templates/index.js +13 -1
- package/dist/Editor/Elements/Grid/templates/right_image_left_text.js +81 -0
- package/dist/Editor/Elements/Grid/templates/white_LTRI.js +116 -0
- package/dist/Editor/Elements/Mentions/Mentions.js +2 -2
- package/dist/Editor/Toolbar/Toolbar.js +2 -1
- package/dist/Editor/common/MentionsPopup.js +1 -1
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +9 -0
- package/dist/Editor/common/StyleBuilder/embedImageStyle.js +8 -0
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +10 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +163 -0
- package/dist/Editor/common/StyleBuilder/gridStyle.js +13 -0
- package/dist/Editor/common/StyleBuilder/index.js +17 -5
- package/dist/Editor/hooks/withCommon.js +2 -2
- package/dist/Editor/utils/grid.js +10 -4
- package/dist/Editor/utils/gridItem.js +3 -2
- package/dist/Editor/utils/insertAppHeader.js +28 -23
- package/package.json +1 -1
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
import image_banner_text from "./image_banner_text";
|
|
2
|
+
import right_image_left_text from "./right_image_left_text";
|
|
3
|
+
import white_LTRI from "./white_LTRI";
|
|
1
4
|
const GRID_TEMPLATES = [{
|
|
2
5
|
title: "Image Banner with Text",
|
|
3
|
-
img: require("./full_grid.png")
|
|
6
|
+
img: require("./full_grid.png"),
|
|
7
|
+
content: image_banner_text
|
|
8
|
+
}, {
|
|
9
|
+
title: "Right Image and Left Text",
|
|
10
|
+
img: require("./full_grid.png"),
|
|
11
|
+
content: right_image_left_text
|
|
12
|
+
}, {
|
|
13
|
+
title: "White - Right Image and Left Text",
|
|
14
|
+
img: require("./full_grid.png"),
|
|
15
|
+
content: white_LTRI
|
|
4
16
|
}];
|
|
5
17
|
export default GRID_TEMPLATES;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const right_image_left_text = {
|
|
2
|
+
type: "grid",
|
|
3
|
+
grid: "container",
|
|
4
|
+
backgroundImage: "https://t4.ftcdn.net/jpg/05/06/47/83/360_F_506478399_l0jgZ5ZWj80o8XYdEJtYfQhVYMU56qDJ.jpg",
|
|
5
|
+
children: [{
|
|
6
|
+
type: "grid-item",
|
|
7
|
+
grid: 6,
|
|
8
|
+
children: [{
|
|
9
|
+
type: "paragraph",
|
|
10
|
+
children: [{
|
|
11
|
+
text: ""
|
|
12
|
+
}]
|
|
13
|
+
}, {
|
|
14
|
+
type: "paragraph",
|
|
15
|
+
children: [{
|
|
16
|
+
text: ""
|
|
17
|
+
}]
|
|
18
|
+
}, {
|
|
19
|
+
type: "paragraph",
|
|
20
|
+
children: [{
|
|
21
|
+
text: "About Us",
|
|
22
|
+
fontSize: "huge",
|
|
23
|
+
color: "#ffffff"
|
|
24
|
+
}]
|
|
25
|
+
}, {
|
|
26
|
+
type: "paragraph",
|
|
27
|
+
children: [{
|
|
28
|
+
fontSize: "medium",
|
|
29
|
+
text: "",
|
|
30
|
+
color: "#ffffff"
|
|
31
|
+
}]
|
|
32
|
+
}, {
|
|
33
|
+
type: "paragraph",
|
|
34
|
+
children: [{
|
|
35
|
+
fontSize: "medium",
|
|
36
|
+
text: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type.",
|
|
37
|
+
color: "#ffffff"
|
|
38
|
+
}]
|
|
39
|
+
}],
|
|
40
|
+
bgColor: "rgba(255, 255, 255, 0)",
|
|
41
|
+
alignment: {
|
|
42
|
+
vertical: "center"
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
type: "grid-item",
|
|
46
|
+
grid: 6,
|
|
47
|
+
children: [{
|
|
48
|
+
type: "paragraph",
|
|
49
|
+
children: [{
|
|
50
|
+
text: ""
|
|
51
|
+
}]
|
|
52
|
+
}, {
|
|
53
|
+
type: "image",
|
|
54
|
+
alt: "",
|
|
55
|
+
url: "https://www.boardeffect.com/wp-content/uploads/2020/01/Sample-Letter-to-Remove-a-Board-Member.jpg",
|
|
56
|
+
children: [{
|
|
57
|
+
text: ""
|
|
58
|
+
}],
|
|
59
|
+
size: {
|
|
60
|
+
width: 769.0000000000003,
|
|
61
|
+
height: 471,
|
|
62
|
+
widthInPercent: 100.26075619295962
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
type: "paragraph",
|
|
66
|
+
children: [{
|
|
67
|
+
text: ""
|
|
68
|
+
}],
|
|
69
|
+
size: {
|
|
70
|
+
height: 300,
|
|
71
|
+
widthInPercent: 100
|
|
72
|
+
}
|
|
73
|
+
}],
|
|
74
|
+
bgColor: "rgba(255, 255, 255, 0)"
|
|
75
|
+
}],
|
|
76
|
+
alignment: {
|
|
77
|
+
horizantal: "center",
|
|
78
|
+
vertical: "center"
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
export default right_image_left_text;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
const white_LTRI = {
|
|
2
|
+
type: "grid",
|
|
3
|
+
grid: "container",
|
|
4
|
+
children: [{
|
|
5
|
+
type: "grid-item",
|
|
6
|
+
grid: 6,
|
|
7
|
+
children: [{
|
|
8
|
+
type: "paragraph",
|
|
9
|
+
children: [{
|
|
10
|
+
text: ""
|
|
11
|
+
}]
|
|
12
|
+
}, {
|
|
13
|
+
type: "paragraph",
|
|
14
|
+
children: [{
|
|
15
|
+
text: ""
|
|
16
|
+
}]
|
|
17
|
+
}, {
|
|
18
|
+
type: "paragraph",
|
|
19
|
+
children: [{
|
|
20
|
+
text: "",
|
|
21
|
+
fontSize: "huge",
|
|
22
|
+
color: "#000000"
|
|
23
|
+
}]
|
|
24
|
+
}, {
|
|
25
|
+
type: "paragraph",
|
|
26
|
+
children: [{
|
|
27
|
+
fontSize: "huge",
|
|
28
|
+
color: "#000000",
|
|
29
|
+
text: ""
|
|
30
|
+
}]
|
|
31
|
+
}, {
|
|
32
|
+
type: "paragraph",
|
|
33
|
+
children: [{
|
|
34
|
+
fontSize: "huge",
|
|
35
|
+
color: "#000000",
|
|
36
|
+
text: "Solution for Your"
|
|
37
|
+
}]
|
|
38
|
+
}, {
|
|
39
|
+
type: "paragraph",
|
|
40
|
+
children: [{
|
|
41
|
+
fontSize: "huge",
|
|
42
|
+
color: "#000000",
|
|
43
|
+
text: "Digital Success",
|
|
44
|
+
bold: true
|
|
45
|
+
}]
|
|
46
|
+
}, {
|
|
47
|
+
type: "paragraph",
|
|
48
|
+
children: [{
|
|
49
|
+
fontSize: "huge",
|
|
50
|
+
color: "#000000",
|
|
51
|
+
bold: true,
|
|
52
|
+
text: ""
|
|
53
|
+
}]
|
|
54
|
+
}, {
|
|
55
|
+
type: "button",
|
|
56
|
+
children: [{
|
|
57
|
+
text: ""
|
|
58
|
+
}],
|
|
59
|
+
buttonLink: {
|
|
60
|
+
linkType: "webAddress"
|
|
61
|
+
},
|
|
62
|
+
label: "Book a Demo",
|
|
63
|
+
textColor: "rgba(255, 255, 255, 1)",
|
|
64
|
+
bgColor: "rgba(37, 99, 235, 1)",
|
|
65
|
+
lockSpacing: false,
|
|
66
|
+
bannerSpacing: {
|
|
67
|
+
top: "12",
|
|
68
|
+
left: "24",
|
|
69
|
+
right: "24",
|
|
70
|
+
bottom: "12"
|
|
71
|
+
}
|
|
72
|
+
}],
|
|
73
|
+
bgColor: "rgba(255, 255, 255, 0)",
|
|
74
|
+
alignment: {
|
|
75
|
+
vertical: "center"
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
type: "grid-item",
|
|
79
|
+
grid: 6,
|
|
80
|
+
children: [{
|
|
81
|
+
type: "paragraph",
|
|
82
|
+
children: [{
|
|
83
|
+
text: ""
|
|
84
|
+
}]
|
|
85
|
+
}, {
|
|
86
|
+
type: "image",
|
|
87
|
+
alt: "",
|
|
88
|
+
url: "https://sweetp-user-uploads.s3.eu-west-2.amazonaws.com/stage%20/%201704194091991_notes",
|
|
89
|
+
children: [{
|
|
90
|
+
text: ""
|
|
91
|
+
}],
|
|
92
|
+
size: {
|
|
93
|
+
width: 769.0000000000003,
|
|
94
|
+
height: 471,
|
|
95
|
+
widthInPercent: 100.26075619295962
|
|
96
|
+
}
|
|
97
|
+
}, {
|
|
98
|
+
type: "paragraph",
|
|
99
|
+
children: [{
|
|
100
|
+
text: ""
|
|
101
|
+
}],
|
|
102
|
+
size: {
|
|
103
|
+
height: 471,
|
|
104
|
+
widthInPercent: 100.26075619295962,
|
|
105
|
+
width: 769.0000000000003
|
|
106
|
+
}
|
|
107
|
+
}],
|
|
108
|
+
bgColor: "rgba(255, 255, 255, 0)"
|
|
109
|
+
}],
|
|
110
|
+
alignment: {
|
|
111
|
+
horizantal: "center",
|
|
112
|
+
vertical: "center"
|
|
113
|
+
},
|
|
114
|
+
bgColor: "rgba(254, 254, 255, 1)"
|
|
115
|
+
};
|
|
116
|
+
export default white_LTRI;
|
|
@@ -28,9 +28,9 @@ const Mentions = ({
|
|
|
28
28
|
return /*#__PURE__*/_jsxs("span", {
|
|
29
29
|
...attributes,
|
|
30
30
|
contentEditable: false,
|
|
31
|
-
"data-cy": `mention-${element.character.replace(" ", "-")}`,
|
|
31
|
+
"data-cy": `mention-${element.character.name.replace(" ", "-")}`,
|
|
32
32
|
style: style,
|
|
33
|
-
children: ["@", element.character, children]
|
|
33
|
+
children: ["@", element.character.name, children]
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
export default Mentions;
|
|
@@ -100,7 +100,8 @@ const Toolbar = props => {
|
|
|
100
100
|
}, `gi_codeToText_${gi}`);
|
|
101
101
|
case "grid":
|
|
102
102
|
return /*#__PURE__*/_jsx(GridButton, {
|
|
103
|
-
editor: editor
|
|
103
|
+
editor: editor,
|
|
104
|
+
customProps: customProps
|
|
104
105
|
}, element.id);
|
|
105
106
|
case "newLine":
|
|
106
107
|
return /*#__PURE__*/_jsx(NewLineButton, {
|
|
@@ -47,5 +47,14 @@ const buttonStyle = [{
|
|
|
47
47
|
key: "borderColor",
|
|
48
48
|
type: "color"
|
|
49
49
|
}]
|
|
50
|
+
}, {
|
|
51
|
+
tab: "Save As Template",
|
|
52
|
+
value: "saveAsTemplate",
|
|
53
|
+
needActions: false,
|
|
54
|
+
fields: [{
|
|
55
|
+
label: "Template Image",
|
|
56
|
+
key: "saveAsTemplate",
|
|
57
|
+
type: "saveAsTemplate"
|
|
58
|
+
}]
|
|
50
59
|
}];
|
|
51
60
|
export default buttonStyle;
|
|
@@ -6,6 +6,14 @@ const embedImageStyle = [{
|
|
|
6
6
|
key: "bannerSpacing",
|
|
7
7
|
type: "bannerSpacing"
|
|
8
8
|
}]
|
|
9
|
+
}, {
|
|
10
|
+
tab: "Border Radius",
|
|
11
|
+
value: "borderRadius",
|
|
12
|
+
fields: [{
|
|
13
|
+
label: "Border Radius",
|
|
14
|
+
key: "borderRadius",
|
|
15
|
+
type: "borderRadius"
|
|
16
|
+
}]
|
|
9
17
|
}, {
|
|
10
18
|
tab: "Position",
|
|
11
19
|
value: "position",
|
|
@@ -9,6 +9,7 @@ import ElementSize from "./elementSize";
|
|
|
9
9
|
import ImageTexts from "./imageTexts";
|
|
10
10
|
import MenusArray from "./menusArray";
|
|
11
11
|
import ButtonLink from "./buttonLink";
|
|
12
|
+
import SaveAsTemplate from "./saveAsTemplate";
|
|
12
13
|
const FieldMap = {
|
|
13
14
|
text: Text,
|
|
14
15
|
bannerSpacing: BannerSpacing,
|
|
@@ -20,6 +21,7 @@ const FieldMap = {
|
|
|
20
21
|
elementSize: ElementSize,
|
|
21
22
|
imageTexts: ImageTexts,
|
|
22
23
|
menusArray: MenusArray,
|
|
23
|
-
buttonLink: ButtonLink
|
|
24
|
+
buttonLink: ButtonLink,
|
|
25
|
+
saveAsTemplate: SaveAsTemplate
|
|
24
26
|
};
|
|
25
27
|
export default FieldMap;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Grid, Button, Typography, Select, MenuItem, TextField } from "@mui/material";
|
|
3
|
+
import CloudUploadIcon from "@mui/icons-material/CloudUpload";
|
|
4
|
+
import { convertBase64 } from "../../../utils/helper";
|
|
5
|
+
import { uploadFile } from "../../../service/fileupload";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const SaveAsTemplate = props => {
|
|
9
|
+
const {
|
|
10
|
+
value,
|
|
11
|
+
data,
|
|
12
|
+
customProps,
|
|
13
|
+
elementProps,
|
|
14
|
+
handleClose
|
|
15
|
+
} = props;
|
|
16
|
+
const {
|
|
17
|
+
onSaveTemplate
|
|
18
|
+
} = customProps;
|
|
19
|
+
const {
|
|
20
|
+
key
|
|
21
|
+
} = data;
|
|
22
|
+
const [template, setTemplate] = useState({
|
|
23
|
+
type: "Element",
|
|
24
|
+
category: "",
|
|
25
|
+
img_aws: null
|
|
26
|
+
});
|
|
27
|
+
const [base64, setBase64] = useState(value);
|
|
28
|
+
const [uploading, setUploading] = useState(false);
|
|
29
|
+
const handleChange = async e => {
|
|
30
|
+
const file = e.target.files[0];
|
|
31
|
+
const strImage = await convertBase64(file);
|
|
32
|
+
setBase64(strImage);
|
|
33
|
+
doUpload(strImage);
|
|
34
|
+
};
|
|
35
|
+
const onChange = e => {
|
|
36
|
+
setTemplate({
|
|
37
|
+
...template,
|
|
38
|
+
[e.target.name]: e.target.value
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const doUpload = async strImage => {
|
|
42
|
+
setUploading(true);
|
|
43
|
+
const result = await uploadFile({
|
|
44
|
+
image: strImage
|
|
45
|
+
}, customProps);
|
|
46
|
+
setUploading(false);
|
|
47
|
+
if (result && result?.imageURL) {
|
|
48
|
+
setTemplate({
|
|
49
|
+
...template,
|
|
50
|
+
img_aws: result?.imageURL
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const onRemoveBG = () => {
|
|
55
|
+
setBase64(null);
|
|
56
|
+
onChange({
|
|
57
|
+
[key]: "none"
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const handleSave = () => {
|
|
61
|
+
const formData = new FormData();
|
|
62
|
+
const params = {
|
|
63
|
+
...template,
|
|
64
|
+
thumbnail: null,
|
|
65
|
+
content: JSON.stringify(elementProps)
|
|
66
|
+
};
|
|
67
|
+
for (let key in params) {
|
|
68
|
+
formData.append(key, params[key]);
|
|
69
|
+
}
|
|
70
|
+
onSaveTemplate(formData, params);
|
|
71
|
+
handleClose();
|
|
72
|
+
};
|
|
73
|
+
return /*#__PURE__*/_jsxs(Grid, {
|
|
74
|
+
container: true,
|
|
75
|
+
spacing: 2,
|
|
76
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
77
|
+
item: true,
|
|
78
|
+
xs: 12,
|
|
79
|
+
children: /*#__PURE__*/_jsxs(Select, {
|
|
80
|
+
fullWidth: true,
|
|
81
|
+
value: template?.type,
|
|
82
|
+
name: "type",
|
|
83
|
+
onChange: onChange,
|
|
84
|
+
children: [/*#__PURE__*/_jsx(MenuItem, {
|
|
85
|
+
value: "Element",
|
|
86
|
+
children: "Element"
|
|
87
|
+
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
88
|
+
value: "Section",
|
|
89
|
+
children: "Section"
|
|
90
|
+
}), /*#__PURE__*/_jsx(MenuItem, {
|
|
91
|
+
value: "Templates",
|
|
92
|
+
children: "Templates"
|
|
93
|
+
})]
|
|
94
|
+
})
|
|
95
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
96
|
+
item: true,
|
|
97
|
+
xs: 212,
|
|
98
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
|
99
|
+
fullWidth: true,
|
|
100
|
+
name: "category",
|
|
101
|
+
value: template?.category,
|
|
102
|
+
onChange: onChange
|
|
103
|
+
})
|
|
104
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
|
105
|
+
item: true,
|
|
106
|
+
xs: 12,
|
|
107
|
+
style: {
|
|
108
|
+
display: "flex"
|
|
109
|
+
},
|
|
110
|
+
justifyContent: "space-between",
|
|
111
|
+
alignItems: "center",
|
|
112
|
+
children: [/*#__PURE__*/_jsxs(Button, {
|
|
113
|
+
component: "label",
|
|
114
|
+
variant: "contained",
|
|
115
|
+
startIcon: /*#__PURE__*/_jsx(CloudUploadIcon, {}),
|
|
116
|
+
children: ["Upload file", /*#__PURE__*/_jsx("input", {
|
|
117
|
+
type: "file",
|
|
118
|
+
style: {
|
|
119
|
+
opacity: 0,
|
|
120
|
+
width: "0px"
|
|
121
|
+
},
|
|
122
|
+
onChange: handleChange
|
|
123
|
+
})]
|
|
124
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
|
125
|
+
className: "dflex",
|
|
126
|
+
children: [/*#__PURE__*/_jsx("input", {
|
|
127
|
+
type: "checkbox",
|
|
128
|
+
value: "none",
|
|
129
|
+
checked: value === "none",
|
|
130
|
+
onChange: onRemoveBG
|
|
131
|
+
}), " ", /*#__PURE__*/_jsx(Typography, {
|
|
132
|
+
variant: "body1",
|
|
133
|
+
color: "primary",
|
|
134
|
+
children: "Remove"
|
|
135
|
+
})]
|
|
136
|
+
})]
|
|
137
|
+
}), uploading ? "Uploading..." : "", /*#__PURE__*/_jsx(Grid, {
|
|
138
|
+
item: true,
|
|
139
|
+
xs: 12,
|
|
140
|
+
style: {
|
|
141
|
+
marginTop: "12px",
|
|
142
|
+
width: "100%",
|
|
143
|
+
backgroundImage: base64 ? `url(${base64})` : "none",
|
|
144
|
+
height: "100px",
|
|
145
|
+
backgroundPosition: "center",
|
|
146
|
+
backgroundSize: "contain",
|
|
147
|
+
backgroundRepeat: "no-repeat"
|
|
148
|
+
}
|
|
149
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
150
|
+
item: true,
|
|
151
|
+
xs: 12,
|
|
152
|
+
style: {
|
|
153
|
+
display: "flex",
|
|
154
|
+
justifyContent: "center"
|
|
155
|
+
},
|
|
156
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
157
|
+
onClick: handleSave,
|
|
158
|
+
children: "Save As Template"
|
|
159
|
+
})
|
|
160
|
+
})]
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
export default SaveAsTemplate;
|
|
@@ -43,9 +43,22 @@ const gridStyle = [{
|
|
|
43
43
|
tab: "Background",
|
|
44
44
|
value: "backgroundImage",
|
|
45
45
|
fields: [{
|
|
46
|
+
label: "URL",
|
|
47
|
+
key: "backgroundImage",
|
|
48
|
+
type: "text"
|
|
49
|
+
}, {
|
|
46
50
|
label: "Background Image",
|
|
47
51
|
key: "backgroundImage",
|
|
48
52
|
type: "backgroundImage"
|
|
49
53
|
}]
|
|
54
|
+
}, {
|
|
55
|
+
tab: "Save As Template",
|
|
56
|
+
value: "saveAsTemplate",
|
|
57
|
+
needActions: false,
|
|
58
|
+
fields: [{
|
|
59
|
+
label: "Template Image",
|
|
60
|
+
key: "saveAsTemplate",
|
|
61
|
+
type: "saveAsTemplate"
|
|
62
|
+
}]
|
|
50
63
|
}];
|
|
51
64
|
export default gridStyle;
|
|
@@ -12,7 +12,8 @@ const StyleContent = props => {
|
|
|
12
12
|
renderTabs,
|
|
13
13
|
onChange,
|
|
14
14
|
element,
|
|
15
|
-
customProps
|
|
15
|
+
customProps,
|
|
16
|
+
handleClose
|
|
16
17
|
} = props;
|
|
17
18
|
const tabContent = renderTabs.find(f => f.value === value);
|
|
18
19
|
const {
|
|
@@ -36,7 +37,8 @@ const StyleContent = props => {
|
|
|
36
37
|
value: element[m.key],
|
|
37
38
|
onChange: onChange,
|
|
38
39
|
elementProps: element,
|
|
39
|
-
customProps: customProps
|
|
40
|
+
customProps: customProps,
|
|
41
|
+
handleClose: handleClose
|
|
40
42
|
}, `ei_stt_tab_${value}_${m.key}`) : null;
|
|
41
43
|
})
|
|
42
44
|
})
|
|
@@ -76,6 +78,12 @@ const StyleBuilder = props => {
|
|
|
76
78
|
} = props;
|
|
77
79
|
const [elementProps, setElementProps] = useState(element);
|
|
78
80
|
const [tab, setTab] = useState(renderTabs[0]?.value);
|
|
81
|
+
const tabVal = renderTabs?.find(f => f.value === tab);
|
|
82
|
+
const {
|
|
83
|
+
needActions = true
|
|
84
|
+
} = tabVal || {
|
|
85
|
+
needActions: true
|
|
86
|
+
};
|
|
79
87
|
const handleChange = (e, newValue) => {
|
|
80
88
|
setTab(newValue);
|
|
81
89
|
};
|
|
@@ -88,6 +96,9 @@ const StyleBuilder = props => {
|
|
|
88
96
|
const handleSave = () => {
|
|
89
97
|
onSave(elementProps);
|
|
90
98
|
};
|
|
99
|
+
const handleClose = () => {
|
|
100
|
+
onClose();
|
|
101
|
+
};
|
|
91
102
|
return /*#__PURE__*/_jsx(Dialog, {
|
|
92
103
|
open: true,
|
|
93
104
|
fullWidth: true,
|
|
@@ -135,9 +146,10 @@ const StyleBuilder = props => {
|
|
|
135
146
|
value: tab,
|
|
136
147
|
element: elementProps,
|
|
137
148
|
onChange: onElementPropsChange,
|
|
138
|
-
customProps: customProps
|
|
149
|
+
customProps: customProps,
|
|
150
|
+
handleClose: handleClose
|
|
139
151
|
})]
|
|
140
|
-
}), /*#__PURE__*/_jsxs(DialogActions, {
|
|
152
|
+
}), needActions ? /*#__PURE__*/_jsxs(DialogActions, {
|
|
141
153
|
sx: {
|
|
142
154
|
p: 0,
|
|
143
155
|
pt: 2
|
|
@@ -156,7 +168,7 @@ const StyleBuilder = props => {
|
|
|
156
168
|
className: "primaryBtn",
|
|
157
169
|
children: "Save"
|
|
158
170
|
})]
|
|
159
|
-
})]
|
|
171
|
+
}) : null]
|
|
160
172
|
})
|
|
161
173
|
});
|
|
162
174
|
};
|
|
@@ -6,7 +6,7 @@ import withEmbeds from "../plugins/withEmbeds";
|
|
|
6
6
|
import withEquation from "../plugins/withEquation";
|
|
7
7
|
import withMentions from "../plugins/withMentions";
|
|
8
8
|
import withLayout from "../plugins/withLayout";
|
|
9
|
-
const withCommon = props => {
|
|
10
|
-
return withEquation(withLayout(withHistory(withEmbeds(withTables(withLinks(withMentions(withReact(props))))))));
|
|
9
|
+
const withCommon = (props, rest = {}) => {
|
|
10
|
+
return rest.needLayout ? withEquation(withLayout(withHistory(withEmbeds(withTables(withLinks(withMentions(withReact(props)))))))) : withEquation(withHistory(withEmbeds(withTables(withLinks(withMentions(withReact(props)))))));
|
|
11
11
|
};
|
|
12
12
|
export default withCommon;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { Transforms } from "slate";
|
|
2
2
|
import { gridItem } from "./gridItem";
|
|
3
|
-
export const insertGrid = editor => {
|
|
4
|
-
const grid = {
|
|
3
|
+
export const insertGrid = (editor, item) => {
|
|
4
|
+
const grid = !item ? {
|
|
5
5
|
type: "grid",
|
|
6
6
|
grid: "container",
|
|
7
|
+
backgroundImage: "https://t4.ftcdn.net/jpg/05/06/47/83/360_F_506478399_l0jgZ5ZWj80o8XYdEJtYfQhVYMU56qDJ.jpg",
|
|
7
8
|
children: [{
|
|
8
9
|
...gridItem()
|
|
9
10
|
}]
|
|
10
|
-
};
|
|
11
|
-
|
|
11
|
+
} : item;
|
|
12
|
+
const {
|
|
13
|
+
selection
|
|
14
|
+
} = editor;
|
|
15
|
+
Transforms.insertNodes(editor, grid, {
|
|
16
|
+
at: selection.focus.path
|
|
17
|
+
});
|
|
12
18
|
Transforms.move(editor);
|
|
13
19
|
};
|
|
@@ -6,9 +6,10 @@ export const gridItem = () => {
|
|
|
6
6
|
children: [{
|
|
7
7
|
type: "paragraph",
|
|
8
8
|
children: [{
|
|
9
|
-
text: `
|
|
9
|
+
text: `About Us`
|
|
10
10
|
}]
|
|
11
|
-
}]
|
|
11
|
+
}],
|
|
12
|
+
bgColor: "rgba(255, 255, 255, 0)"
|
|
12
13
|
};
|
|
13
14
|
};
|
|
14
15
|
export const insertGridItem = editor => {
|
|
@@ -17,34 +17,39 @@ export const createAppHeaderNode = ({
|
|
|
17
17
|
}]
|
|
18
18
|
});
|
|
19
19
|
export const insertAppHeader = (editor, props) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
try {
|
|
21
|
+
const {
|
|
22
|
+
selection
|
|
23
|
+
} = editor;
|
|
24
|
+
const appHeader = createAppHeaderNode(props || {});
|
|
25
|
+
if (!!selection) {
|
|
26
|
+
const [parent, parentPath] = Editor.parent(editor, selection.focus.path);
|
|
27
|
+
if (editor.isVoid(parent)) {
|
|
28
|
+
Transforms.insertNodes(editor, {
|
|
29
|
+
type: "paragraph",
|
|
30
|
+
children: [appHeader]
|
|
31
|
+
}, {
|
|
32
|
+
at: Path.next(parentPath),
|
|
33
|
+
select: true
|
|
34
|
+
});
|
|
35
|
+
} else if (Range.isCollapsed(selection)) {
|
|
36
|
+
Transforms.insertNodes(editor, [appHeader], {
|
|
37
|
+
at: selection.focus.path
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
Transforms.wrapNodes(editor, appHeader, {
|
|
41
|
+
split: true
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
27
45
|
Transforms.insertNodes(editor, {
|
|
28
46
|
type: "paragraph",
|
|
29
47
|
children: [appHeader]
|
|
30
|
-
}, {
|
|
31
|
-
at: Path.next(parentPath),
|
|
32
|
-
select: true
|
|
33
|
-
});
|
|
34
|
-
} else if (Range.isCollapsed(selection)) {
|
|
35
|
-
Transforms.insertNodes(editor, appHeader, {
|
|
36
|
-
select: true
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
Transforms.wrapNodes(editor, appHeader, {
|
|
40
|
-
split: true
|
|
41
48
|
});
|
|
42
49
|
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
children: [appHeader]
|
|
47
|
-
});
|
|
50
|
+
} catch (err) {
|
|
51
|
+
alert("Something went wrong");
|
|
52
|
+
console.log(err);
|
|
48
53
|
}
|
|
49
54
|
};
|
|
50
55
|
export const removeAppHeader = (editor, path) => {
|