@flozy/editor 1.3.2 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- 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 +40 -13
- 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 +173 -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,173 @@
|
|
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
|
+
title: ""
|
27
|
+
});
|
28
|
+
const [base64, setBase64] = useState(value);
|
29
|
+
const [uploading, setUploading] = useState(false);
|
30
|
+
const handleChange = async e => {
|
31
|
+
const file = e.target.files[0];
|
32
|
+
const strImage = await convertBase64(file);
|
33
|
+
setBase64(strImage);
|
34
|
+
doUpload(strImage);
|
35
|
+
};
|
36
|
+
const onChange = e => {
|
37
|
+
setTemplate({
|
38
|
+
...template,
|
39
|
+
[e.target.name]: e.target.value
|
40
|
+
});
|
41
|
+
};
|
42
|
+
const doUpload = async strImage => {
|
43
|
+
setUploading(true);
|
44
|
+
const result = await uploadFile({
|
45
|
+
image: strImage
|
46
|
+
}, customProps);
|
47
|
+
setUploading(false);
|
48
|
+
if (result && result?.imageURL) {
|
49
|
+
setTemplate({
|
50
|
+
...template,
|
51
|
+
img_aws: result?.imageURL
|
52
|
+
});
|
53
|
+
}
|
54
|
+
};
|
55
|
+
const onRemoveBG = () => {
|
56
|
+
setBase64(null);
|
57
|
+
onChange({
|
58
|
+
[key]: "none"
|
59
|
+
});
|
60
|
+
};
|
61
|
+
const handleSave = () => {
|
62
|
+
const formData = new FormData();
|
63
|
+
const params = {
|
64
|
+
...template,
|
65
|
+
thumbnail: null,
|
66
|
+
content: JSON.stringify(elementProps)
|
67
|
+
};
|
68
|
+
for (let key in params) {
|
69
|
+
formData.append(key, params[key]);
|
70
|
+
}
|
71
|
+
onSaveTemplate(formData, params);
|
72
|
+
handleClose();
|
73
|
+
};
|
74
|
+
return /*#__PURE__*/_jsxs(Grid, {
|
75
|
+
container: true,
|
76
|
+
spacing: 2,
|
77
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
78
|
+
itemx: true,
|
79
|
+
xs: 12,
|
80
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
81
|
+
name: "title",
|
82
|
+
value: template?.title,
|
83
|
+
onChange: onChange,
|
84
|
+
placeholder: "Template Title"
|
85
|
+
})
|
86
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
87
|
+
item: true,
|
88
|
+
xs: 12,
|
89
|
+
children: /*#__PURE__*/_jsxs(Select, {
|
90
|
+
fullWidth: true,
|
91
|
+
value: template?.type,
|
92
|
+
name: "type",
|
93
|
+
onChange: onChange,
|
94
|
+
children: [/*#__PURE__*/_jsx(MenuItem, {
|
95
|
+
value: "Element",
|
96
|
+
children: "Element"
|
97
|
+
}), /*#__PURE__*/_jsx(MenuItem, {
|
98
|
+
value: "Section",
|
99
|
+
children: "Section"
|
100
|
+
}), /*#__PURE__*/_jsx(MenuItem, {
|
101
|
+
value: "Templates",
|
102
|
+
children: "Templates"
|
103
|
+
})]
|
104
|
+
})
|
105
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
106
|
+
item: true,
|
107
|
+
xs: 212,
|
108
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
109
|
+
fullWidth: true,
|
110
|
+
name: "category",
|
111
|
+
value: template?.category,
|
112
|
+
onChange: onChange
|
113
|
+
})
|
114
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
115
|
+
item: true,
|
116
|
+
xs: 12,
|
117
|
+
style: {
|
118
|
+
display: "flex"
|
119
|
+
},
|
120
|
+
justifyContent: "space-between",
|
121
|
+
alignItems: "center",
|
122
|
+
children: [/*#__PURE__*/_jsxs(Button, {
|
123
|
+
component: "label",
|
124
|
+
variant: "contained",
|
125
|
+
startIcon: /*#__PURE__*/_jsx(CloudUploadIcon, {}),
|
126
|
+
children: ["Upload file", /*#__PURE__*/_jsx("input", {
|
127
|
+
type: "file",
|
128
|
+
style: {
|
129
|
+
opacity: 0,
|
130
|
+
width: "0px"
|
131
|
+
},
|
132
|
+
onChange: handleChange
|
133
|
+
})]
|
134
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
135
|
+
className: "dflex",
|
136
|
+
children: [/*#__PURE__*/_jsx("input", {
|
137
|
+
type: "checkbox",
|
138
|
+
value: "none",
|
139
|
+
checked: value === "none",
|
140
|
+
onChange: onRemoveBG
|
141
|
+
}), " ", /*#__PURE__*/_jsx(Typography, {
|
142
|
+
variant: "body1",
|
143
|
+
color: "primary",
|
144
|
+
children: "Remove"
|
145
|
+
})]
|
146
|
+
})]
|
147
|
+
}), uploading ? "Uploading..." : "", /*#__PURE__*/_jsx(Grid, {
|
148
|
+
item: true,
|
149
|
+
xs: 12,
|
150
|
+
style: {
|
151
|
+
marginTop: "12px",
|
152
|
+
width: "100%",
|
153
|
+
backgroundImage: base64 ? `url(${base64})` : "none",
|
154
|
+
height: "100px",
|
155
|
+
backgroundPosition: "center",
|
156
|
+
backgroundSize: "contain",
|
157
|
+
backgroundRepeat: "no-repeat"
|
158
|
+
}
|
159
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
160
|
+
item: true,
|
161
|
+
xs: 12,
|
162
|
+
style: {
|
163
|
+
display: "flex",
|
164
|
+
justifyContent: "center"
|
165
|
+
},
|
166
|
+
children: /*#__PURE__*/_jsx(Button, {
|
167
|
+
onClick: handleSave,
|
168
|
+
children: "Save As Template"
|
169
|
+
})
|
170
|
+
})]
|
171
|
+
});
|
172
|
+
};
|
173
|
+
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) => {
|