@flozy/editor 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +9 -6
- package/dist/Editor/Editor.css +1 -1
- package/dist/Editor/Elements/AppHeader/AppHeader.js +10 -2
- package/dist/Editor/Elements/Button/EditorButton.js +43 -10
- package/dist/Editor/Elements/ChipText/ChipText.js +7 -2
- package/dist/Editor/Elements/Grid/Grid.js +1 -1
- package/dist/Editor/Elements/Grid/GridItem.js +8 -4
- package/dist/Editor/Elements/Grid/templates/default_grid.js +144 -0
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +5 -1
- package/dist/Editor/Toolbar/FormatTools/Autocomplete.js +33 -0
- package/dist/Editor/Toolbar/FormatTools/Text.js +29 -0
- package/dist/Editor/Toolbar/FormatTools/index.js +3 -1
- package/dist/Editor/Toolbar/PopupTool/index.js +0 -3
- package/dist/Editor/Toolbar/Toolbar.js +16 -9
- package/dist/Editor/common/StyleBuilder/appHeaderStyle.js +17 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +36 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +107 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +11 -4
- package/dist/Editor/common/StyleBuilder/index.js +2 -2
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +2 -2
- package/dist/Editor/utils/SlateUtilityFunctions.js +1 -1
- package/dist/Editor/utils/grid.js +2 -8
- package/package.json +1 -1
@@ -75,13 +75,15 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
75
75
|
pageProps
|
76
76
|
} = pageSettings || {};
|
77
77
|
const {
|
78
|
-
bannerSpacing
|
78
|
+
bannerSpacing,
|
79
|
+
pageBgImage,
|
80
|
+
pageColor
|
79
81
|
} = pageProps || {
|
80
82
|
bannerSpacing: {
|
81
|
-
left:
|
82
|
-
right:
|
83
|
-
top:
|
84
|
-
bottom:
|
83
|
+
left: 0,
|
84
|
+
right: 0,
|
85
|
+
top: 0,
|
86
|
+
bottom: 0
|
85
87
|
}
|
86
88
|
};
|
87
89
|
useEffect(() => {
|
@@ -257,7 +259,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
257
259
|
className: "editor-wrapper",
|
258
260
|
style: {
|
259
261
|
border: "1px solid #f3f3f3",
|
260
|
-
|
262
|
+
backgroundImage: pageBgImage ? `url(${pageBgImage})` : "none",
|
263
|
+
backgroundColor: pageColor || defaultBG || "#FFF",
|
261
264
|
color: pageProps?.color || "#000",
|
262
265
|
paddingLeft: `${bannerSpacing?.left}px`,
|
263
266
|
paddingRight: `${bannerSpacing?.right}px`,
|
package/dist/Editor/Editor.css
CHANGED
@@ -34,6 +34,9 @@ function AppHeader(props) {
|
|
34
34
|
appLogo,
|
35
35
|
menus,
|
36
36
|
bgColor,
|
37
|
+
bgColorHover,
|
38
|
+
textColor,
|
39
|
+
textColorHover,
|
37
40
|
menuStyle,
|
38
41
|
bannerSpacing,
|
39
42
|
fontSize,
|
@@ -210,10 +213,15 @@ function AppHeader(props) {
|
|
210
213
|
component: "a",
|
211
214
|
href: item.url,
|
212
215
|
sx: {
|
213
|
-
color: "#fff",
|
214
216
|
fontFamily: fontFamily,
|
215
217
|
textTransform: "none",
|
216
|
-
fontSize: fontSize || "16px"
|
218
|
+
fontSize: fontSize || "16px",
|
219
|
+
color: textColor || "#FFF",
|
220
|
+
background: bgColor || "none",
|
221
|
+
"&:hover": {
|
222
|
+
color: textColorHover || textColor || "#FFF",
|
223
|
+
background: bgColorHover || bgColor || "none"
|
224
|
+
}
|
217
225
|
},
|
218
226
|
children: item.text
|
219
227
|
}, item)) : null]
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
2
|
import { Transforms } from "slate";
|
3
3
|
import { ReactEditor, useSlateStatic } from "slate-react";
|
4
|
-
import { IconButton, Menu, MenuItem, Tooltip } from "@mui/material";
|
4
|
+
import { IconButton, Menu, MenuItem, Tooltip, Box } from "@mui/material";
|
5
|
+
import * as fIcons from "@mui/icons-material";
|
5
6
|
import SettingsIcon from "@mui/icons-material/Settings";
|
6
7
|
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
7
8
|
import DeleteIcon from "@mui/icons-material/Delete";
|
@@ -13,7 +14,8 @@ const EditorButton = props => {
|
|
13
14
|
const {
|
14
15
|
attributes,
|
15
16
|
element,
|
16
|
-
customProps
|
17
|
+
customProps,
|
18
|
+
children
|
17
19
|
} = props;
|
18
20
|
const {
|
19
21
|
readOnly,
|
@@ -34,7 +36,11 @@ const EditorButton = props => {
|
|
34
36
|
buttonLink,
|
35
37
|
textSize,
|
36
38
|
textAlign,
|
37
|
-
fontFamily
|
39
|
+
fontFamily,
|
40
|
+
textColorHover,
|
41
|
+
bgColorHover,
|
42
|
+
buttonIcon,
|
43
|
+
iconPosition
|
38
44
|
} = element;
|
39
45
|
const {
|
40
46
|
linkType,
|
@@ -52,6 +58,7 @@ const EditorButton = props => {
|
|
52
58
|
right,
|
53
59
|
bottom
|
54
60
|
} = bannerSpacing || {};
|
61
|
+
const BtnIcon = buttonIcon ? fIcons[buttonIcon] : null;
|
55
62
|
const onClick = async e => {
|
56
63
|
if (readOnly) {
|
57
64
|
if (metadata?.buttonLink?.handler) {
|
@@ -121,15 +128,19 @@ const EditorButton = props => {
|
|
121
128
|
return /*#__PURE__*/_jsxs("div", {
|
122
129
|
className: "editor-btn-wrapper",
|
123
130
|
...attributes,
|
131
|
+
style: {
|
132
|
+
display: "inline"
|
133
|
+
},
|
124
134
|
children: [/*#__PURE__*/_jsx("div", {
|
125
135
|
className: "editor-btn-wrapper-inner",
|
126
136
|
style: {
|
127
|
-
textAlign: textAlign || "left"
|
137
|
+
textAlign: textAlign || "left",
|
138
|
+
display: "inline"
|
128
139
|
},
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
140
|
+
contentEditable: false,
|
141
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
142
|
+
component: "button",
|
143
|
+
sx: {
|
133
144
|
background: bgColor || "rgb(30, 75, 122)",
|
134
145
|
borderWidth: "1px",
|
135
146
|
borderBlockStyle: "solid",
|
@@ -141,11 +152,33 @@ const EditorButton = props => {
|
|
141
152
|
paddingBottom: `${bottom || 8}px`,
|
142
153
|
color: `${textColor || "#FFFFFF"}`,
|
143
154
|
fontSize: textSize || "inherit",
|
144
|
-
fontFamily: fontFamily || "PoppinsRegular"
|
155
|
+
fontFamily: fontFamily || "PoppinsRegular",
|
156
|
+
display: "inline-flex",
|
157
|
+
alignItems: "center",
|
158
|
+
"&:hover": {
|
159
|
+
color: `${textColorHover || textColor || "#FFFFFF"}`,
|
160
|
+
background: bgColorHover || bgColor || "rgb(30, 75, 122)"
|
161
|
+
}
|
145
162
|
},
|
146
163
|
onClick: onClick,
|
147
|
-
children:
|
164
|
+
children: [BtnIcon && iconPosition === "start" && /*#__PURE__*/_jsx(BtnIcon, {
|
165
|
+
style: {
|
166
|
+
paddingLeft: "4px",
|
167
|
+
paddingRight: "4px"
|
168
|
+
}
|
169
|
+
}), label || "My Button", BtnIcon && iconPosition === "end" && /*#__PURE__*/_jsx(BtnIcon, {
|
170
|
+
style: {
|
171
|
+
paddingLeft: "4px",
|
172
|
+
paddingRight: "4px"
|
173
|
+
}
|
174
|
+
})]
|
148
175
|
})
|
176
|
+
}), /*#__PURE__*/_jsx("div", {
|
177
|
+
contentEditable: true,
|
178
|
+
style: {
|
179
|
+
display: "inline"
|
180
|
+
},
|
181
|
+
children: children
|
149
182
|
}), /*#__PURE__*/_jsxs(Menu, {
|
150
183
|
className: "editor-btn-options",
|
151
184
|
open: anchorEl !== null,
|
@@ -25,10 +25,12 @@ const ChipText = props => {
|
|
25
25
|
bottomLeft,
|
26
26
|
bottomRight
|
27
27
|
} = borderRadius || {};
|
28
|
-
return /*#__PURE__*/_jsx("
|
28
|
+
return /*#__PURE__*/_jsx("button", {
|
29
29
|
...attributes,
|
30
30
|
className: "editor-chip-text",
|
31
|
+
contentEditable: false,
|
31
32
|
style: {
|
33
|
+
display: "inline",
|
32
34
|
paddingLeft: `${left}px`,
|
33
35
|
paddingRight: `${right}px`,
|
34
36
|
paddingTop: `${top}px`,
|
@@ -38,7 +40,10 @@ const ChipText = props => {
|
|
38
40
|
background: bgColor || "#CCC",
|
39
41
|
color: textColor
|
40
42
|
},
|
41
|
-
children:
|
43
|
+
children: /*#__PURE__*/_jsx("div", {
|
44
|
+
contentEditable: true,
|
45
|
+
children: children
|
46
|
+
})
|
42
47
|
});
|
43
48
|
};
|
44
49
|
export default ChipText;
|
@@ -31,7 +31,8 @@ const GridItem = props => {
|
|
31
31
|
} = bannerSpacing || {};
|
32
32
|
const {
|
33
33
|
vertical,
|
34
|
-
horizantal
|
34
|
+
horizantal,
|
35
|
+
flexDirection
|
35
36
|
} = alignment || {};
|
36
37
|
const editor = useSlateStatic();
|
37
38
|
const selected = useSelected();
|
@@ -62,6 +63,7 @@ const GridItem = props => {
|
|
62
63
|
const updateData = {
|
63
64
|
...data
|
64
65
|
};
|
66
|
+
console.log(updateData);
|
65
67
|
delete updateData.children;
|
66
68
|
Transforms.setNodes(editor, {
|
67
69
|
...updateData
|
@@ -85,7 +87,7 @@ const GridItem = props => {
|
|
85
87
|
...attributes,
|
86
88
|
style: {
|
87
89
|
display: "flex",
|
88
|
-
flexDirection: "column",
|
90
|
+
flexDirection: flexDirection || "column",
|
89
91
|
backgroundColor: bgColor,
|
90
92
|
alignItems: horizantal,
|
91
93
|
justifyContent: vertical,
|
@@ -97,14 +99,16 @@ const GridItem = props => {
|
|
97
99
|
contentEditable: false,
|
98
100
|
children: /*#__PURE__*/_jsx(GridItemToolbar, {})
|
99
101
|
}), /*#__PURE__*/_jsx("div", {
|
102
|
+
className: "gi-inner-cw",
|
100
103
|
style: {
|
101
104
|
display: "flex",
|
102
|
-
flexDirection: "column",
|
105
|
+
flexDirection: flexDirection || "column",
|
103
106
|
width: "100%",
|
104
107
|
paddingLeft: `${left}px`,
|
105
108
|
paddingRight: `${right}px`,
|
106
109
|
paddingTop: `${top}px`,
|
107
|
-
paddingBottom: `${bottom}px
|
110
|
+
paddingBottom: `${bottom}px`,
|
111
|
+
justifyContent: vertical
|
108
112
|
},
|
109
113
|
children: children
|
110
114
|
}), openSetttings ? /*#__PURE__*/_jsx(GridItemPopup, {
|
@@ -0,0 +1,144 @@
|
|
1
|
+
const default_grid = {
|
2
|
+
type: "grid",
|
3
|
+
grid: "container",
|
4
|
+
children: [{
|
5
|
+
type: "grid-item",
|
6
|
+
grid: 12,
|
7
|
+
children: [{
|
8
|
+
type: "alignCenter",
|
9
|
+
children: [{
|
10
|
+
type: "paragraph",
|
11
|
+
children: [{
|
12
|
+
text: "Ship Sites with Style.",
|
13
|
+
fontSize: "huge",
|
14
|
+
fontFamily: "PoppinsBold"
|
15
|
+
}]
|
16
|
+
}]
|
17
|
+
}],
|
18
|
+
bgColor: "rgba(255, 255, 255, 0)",
|
19
|
+
lockSpacing: true,
|
20
|
+
bannerSpacing: {
|
21
|
+
top: "16",
|
22
|
+
left: "16",
|
23
|
+
right: "16",
|
24
|
+
bottom: "16"
|
25
|
+
},
|
26
|
+
alignment: {
|
27
|
+
horizantal: "center"
|
28
|
+
}
|
29
|
+
}, {
|
30
|
+
type: "grid-item",
|
31
|
+
grid: 12,
|
32
|
+
children: [{
|
33
|
+
type: "alignCenter",
|
34
|
+
children: [{
|
35
|
+
type: "paragraph",
|
36
|
+
children: [{
|
37
|
+
text: "Lorem Ipsum je fiktívny text, používaný pri návrhu tlačovín a typografie. Lorem Ipsum je štandardným výplňovým textom už od 16. storočia, keď neznámy tlačiar zobral sadzobnicu plnú tlačových znakov a pomiešal ich, aby tak vytvoril vzorkovú knihu. Prežil nielen päť storočí, ale aj skok do elektronickej sadzby, a pritom zostal v podstate nezmenený. Spopularizovaný bol v 60-tych rokoch 20.storočia, vydaním hárkov Letraset, ktoré obsahovali pasáže Lorem Ipsum, a neskôr aj softvérom ako Aldus PageMaker, ktorý obsahoval verzie Lorem Ipsum."
|
38
|
+
}]
|
39
|
+
}]
|
40
|
+
}],
|
41
|
+
bgColor: "rgba(255, 255, 255, 0)",
|
42
|
+
lockSpacing: true,
|
43
|
+
bannerSpacing: {
|
44
|
+
top: "16",
|
45
|
+
left: "16",
|
46
|
+
right: "16",
|
47
|
+
bottom: "16"
|
48
|
+
}
|
49
|
+
}, {
|
50
|
+
type: "grid-item",
|
51
|
+
grid: 12,
|
52
|
+
children: [{
|
53
|
+
type: "paragraph",
|
54
|
+
children: [{
|
55
|
+
text: ""
|
56
|
+
}]
|
57
|
+
}, {
|
58
|
+
type: "paragraph",
|
59
|
+
children: [{
|
60
|
+
text: ""
|
61
|
+
}]
|
62
|
+
}, {
|
63
|
+
type: "button",
|
64
|
+
children: [{
|
65
|
+
text: " "
|
66
|
+
}],
|
67
|
+
buttonLink: {
|
68
|
+
linkType: "webAddress"
|
69
|
+
},
|
70
|
+
label: "Gettings Started",
|
71
|
+
bgColor: "rgba(192,192,192, 1)",
|
72
|
+
textColor: "rgba(0,0,0,1)",
|
73
|
+
lockSpacing: true,
|
74
|
+
bannerSpacing: {
|
75
|
+
top: "16",
|
76
|
+
left: "16",
|
77
|
+
right: "16",
|
78
|
+
bottom: "16"
|
79
|
+
},
|
80
|
+
lockRadius: true,
|
81
|
+
borderRadius: {
|
82
|
+
topLeft: "12",
|
83
|
+
topRight: "12",
|
84
|
+
bottomLeft: "12",
|
85
|
+
bottomRight: "12"
|
86
|
+
},
|
87
|
+
bgColorHover: "rgba(0, 0, 0, 1)",
|
88
|
+
textColorHover: "rgba(255, 255, 255, 1)",
|
89
|
+
borderColor: "rgba(175, 51, 242, 0)"
|
90
|
+
}, {
|
91
|
+
type: "button",
|
92
|
+
children: [{
|
93
|
+
text: ""
|
94
|
+
}],
|
95
|
+
buttonLink: {
|
96
|
+
linkType: "webAddress"
|
97
|
+
},
|
98
|
+
label: "Learn More",
|
99
|
+
bgColor: "rgba(192,192,192, 1)",
|
100
|
+
textColor: "rgba(0,0,0,1)",
|
101
|
+
lockSpacing: false,
|
102
|
+
bannerSpacing: {
|
103
|
+
top: "16",
|
104
|
+
left: "32",
|
105
|
+
right: "32",
|
106
|
+
bottom: "16"
|
107
|
+
},
|
108
|
+
lockRadius: true,
|
109
|
+
borderRadius: {
|
110
|
+
topLeft: "12",
|
111
|
+
topRight: "12",
|
112
|
+
bottomLeft: "12",
|
113
|
+
bottomRight: "12"
|
114
|
+
},
|
115
|
+
borderColor: "rgba(175, 51, 242, 0)",
|
116
|
+
bgColorHover: "rgba(0,0,0,1)",
|
117
|
+
textColorHover: "rgba(255,255,255, 1)"
|
118
|
+
}],
|
119
|
+
bgColor: "rgba(255, 255, 255, 0)",
|
120
|
+
alignment: {
|
121
|
+
flexDirection: "row",
|
122
|
+
vertical: "center",
|
123
|
+
horizantal: "center"
|
124
|
+
},
|
125
|
+
lockSpacing: true,
|
126
|
+
bannerSpacing: {
|
127
|
+
top: "16",
|
128
|
+
left: "16",
|
129
|
+
right: "16",
|
130
|
+
bottom: "16"
|
131
|
+
}
|
132
|
+
}],
|
133
|
+
alignment: {
|
134
|
+
flexDirection: "column"
|
135
|
+
},
|
136
|
+
lockSpacing: true,
|
137
|
+
bannerSpacing: {
|
138
|
+
top: "16",
|
139
|
+
left: "16",
|
140
|
+
right: "16",
|
141
|
+
bottom: "16"
|
142
|
+
}
|
143
|
+
};
|
144
|
+
export default JSON.stringify(default_grid);
|
@@ -54,6 +54,7 @@ const PageSettingsButton = props => {
|
|
54
54
|
...data
|
55
55
|
};
|
56
56
|
delete updateData.children;
|
57
|
+
console.log(openSetttings);
|
57
58
|
if (openSetttings?.path) {
|
58
59
|
Transforms.setNodes(editor, {
|
59
60
|
pageProps: {
|
@@ -63,6 +64,7 @@ const PageSettingsButton = props => {
|
|
63
64
|
at: openSetttings?.path
|
64
65
|
});
|
65
66
|
} else {
|
67
|
+
console.log(editor.children.length);
|
66
68
|
Transforms.insertNodes(editor, [{
|
67
69
|
type: "page-settings",
|
68
70
|
pageProps: {
|
@@ -71,7 +73,9 @@ const PageSettingsButton = props => {
|
|
71
73
|
children: [{
|
72
74
|
text: ""
|
73
75
|
}]
|
74
|
-
}]
|
76
|
+
}], {
|
77
|
+
at: [editor.children.length]
|
78
|
+
});
|
75
79
|
}
|
76
80
|
onClose();
|
77
81
|
};
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Autocomplete, TextField } from "@mui/material";
|
3
|
+
import { activeMark } from "../../utils/SlateUtilityFunctions.js";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
const SelectFreeSolo = ({
|
6
|
+
editor,
|
7
|
+
format,
|
8
|
+
options
|
9
|
+
}) => {
|
10
|
+
const value = activeMark(editor, format);
|
11
|
+
console.log(options);
|
12
|
+
const changeMarkData = (event, format) => {
|
13
|
+
event.preventDefault();
|
14
|
+
console.log(event.target.value, format);
|
15
|
+
// const value = event.target.value;
|
16
|
+
// addMarkData(editor, { format, value });
|
17
|
+
};
|
18
|
+
|
19
|
+
return /*#__PURE__*/_jsx(Autocomplete, {
|
20
|
+
size: "small",
|
21
|
+
style: {},
|
22
|
+
value: value?.value,
|
23
|
+
className: "editor-dd",
|
24
|
+
onChange: e => changeMarkData(e, format),
|
25
|
+
getOptionLabel: option => option.text,
|
26
|
+
options: options,
|
27
|
+
freeSolo: true,
|
28
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
29
|
+
...params
|
30
|
+
})
|
31
|
+
});
|
32
|
+
};
|
33
|
+
export default SelectFreeSolo;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { TextField } from "@mui/material";
|
3
|
+
import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
|
4
|
+
import { sizeMap } from "../../utils/font.js";
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
6
|
+
const Text = ({
|
7
|
+
editor,
|
8
|
+
format,
|
9
|
+
options,
|
10
|
+
style = {}
|
11
|
+
}) => {
|
12
|
+
const value = activeMark(editor, format);
|
13
|
+
const changeMarkData = (event, format) => {
|
14
|
+
event.preventDefault();
|
15
|
+
const value = event.target.value;
|
16
|
+
addMarkData(editor, {
|
17
|
+
format,
|
18
|
+
value
|
19
|
+
});
|
20
|
+
};
|
21
|
+
return /*#__PURE__*/_jsx(TextField, {
|
22
|
+
size: "small",
|
23
|
+
style: style,
|
24
|
+
value: sizeMap[value],
|
25
|
+
className: "editor-text",
|
26
|
+
onChange: e => changeMarkData(e, format)
|
27
|
+
});
|
28
|
+
};
|
29
|
+
export default Text;
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import BlockButton from "./BlockButton";
|
2
2
|
import Dropdown from "./Dropdown";
|
3
3
|
import MarkButton from "./MarkButton";
|
4
|
-
|
4
|
+
import Autocomplete from "./Autocomplete";
|
5
|
+
import Text from "./Text";
|
6
|
+
export { BlockButton, Dropdown, MarkButton, Autocomplete, Text };
|
@@ -5,7 +5,6 @@ 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";
|
9
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
10
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
11
10
|
const PopupTool = () => {
|
@@ -18,9 +17,7 @@ const PopupTool = () => {
|
|
18
17
|
} = editor;
|
19
18
|
const open = Boolean(anchorEl);
|
20
19
|
const id = open ? "popup-edit-tool" : "";
|
21
|
-
console.log(useFormat(editor, null));
|
22
20
|
useEffect(() => {
|
23
|
-
console.log(selection, inFocus);
|
24
21
|
if (!selection || !inFocus || Range.isCollapsed(selection) || Editor.string(editor, selection) === "") {
|
25
22
|
setAnchorEl(null);
|
26
23
|
} else {
|
@@ -20,8 +20,10 @@ import ButtonToolIcon from "../Elements/Button/ButtonToolIcon";
|
|
20
20
|
import PageSettingsButton from "../Elements/PageSettings/PageSettingsButton";
|
21
21
|
import CarouselButton from "../Elements/Carousel/CarouselButton";
|
22
22
|
import AppHeaderButton from "../Elements/AppHeader/AppHeaderButton";
|
23
|
-
import "./styles.css";
|
24
23
|
import FormButton from "../Elements/Form/FormButton.js";
|
24
|
+
import Text from "./FormatTools/Text";
|
25
|
+
import ChipTextButton from "../Elements/ChipText/ChipTextButton";
|
26
|
+
import "./styles.css";
|
25
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
26
28
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
27
29
|
const Toolbar = props => {
|
@@ -65,6 +67,14 @@ const Toolbar = props => {
|
|
65
67
|
...element,
|
66
68
|
editor: editor
|
67
69
|
}, element.id);
|
70
|
+
case "text":
|
71
|
+
return /*#__PURE__*/_jsx(Text, {
|
72
|
+
...element,
|
73
|
+
editor: editor,
|
74
|
+
style: {
|
75
|
+
width: "80px"
|
76
|
+
}
|
77
|
+
}, element.id);
|
68
78
|
case "link":
|
69
79
|
return /*#__PURE__*/_jsx(LinkButton, {
|
70
80
|
active: isBlockActive(editor, "link"),
|
@@ -128,14 +138,11 @@ const Toolbar = props => {
|
|
128
138
|
return /*#__PURE__*/_jsx(CarouselButton, {
|
129
139
|
editor: editor
|
130
140
|
}, element.id);
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
// customProps={customProps}
|
137
|
-
// />
|
138
|
-
// );
|
141
|
+
case "chip-text":
|
142
|
+
return /*#__PURE__*/_jsx(ChipTextButton, {
|
143
|
+
editor: editor,
|
144
|
+
customProps: customProps
|
145
|
+
}, element.id);
|
139
146
|
// case "drawer":
|
140
147
|
// return (
|
141
148
|
// <DrawerMenuButton
|
@@ -80,5 +80,22 @@ const appHeaderStyle = [{
|
|
80
80
|
key: "borderColor",
|
81
81
|
type: "color"
|
82
82
|
}]
|
83
|
+
}, {
|
84
|
+
tab: "Hover Colors",
|
85
|
+
value: "hoverColors",
|
86
|
+
fields: [{
|
87
|
+
label: "Text",
|
88
|
+
key: "textColorHover",
|
89
|
+
type: "color",
|
90
|
+
needPreview: true
|
91
|
+
}, {
|
92
|
+
label: "Background",
|
93
|
+
key: "bgColorHover",
|
94
|
+
type: "color"
|
95
|
+
}, {
|
96
|
+
label: "Border",
|
97
|
+
key: "borderColorHover",
|
98
|
+
type: "color"
|
99
|
+
}]
|
83
100
|
}];
|
84
101
|
export default appHeaderStyle;
|
@@ -39,6 +39,25 @@ const buttonStyle = [{
|
|
39
39
|
key: "buttonLink",
|
40
40
|
type: "buttonLink"
|
41
41
|
}]
|
42
|
+
}, {
|
43
|
+
tab: "Icon",
|
44
|
+
value: "icon",
|
45
|
+
fields: [{
|
46
|
+
label: "Icon Position",
|
47
|
+
key: "iconPosition",
|
48
|
+
type: "textOptions",
|
49
|
+
options: [{
|
50
|
+
value: "start",
|
51
|
+
label: "Start"
|
52
|
+
}, {
|
53
|
+
value: "end",
|
54
|
+
label: "End"
|
55
|
+
}]
|
56
|
+
}, {
|
57
|
+
label: "Button Icons",
|
58
|
+
key: "buttonIcon",
|
59
|
+
type: "icons"
|
60
|
+
}]
|
42
61
|
}, {
|
43
62
|
tab: "Position",
|
44
63
|
value: "position",
|
@@ -88,6 +107,23 @@ const buttonStyle = [{
|
|
88
107
|
key: "borderColor",
|
89
108
|
type: "color"
|
90
109
|
}]
|
110
|
+
}, {
|
111
|
+
tab: "Hover Colors",
|
112
|
+
value: "hoverColors",
|
113
|
+
fields: [{
|
114
|
+
label: "Text",
|
115
|
+
key: "textColorHover",
|
116
|
+
type: "color",
|
117
|
+
needPreview: true
|
118
|
+
}, {
|
119
|
+
label: "Background",
|
120
|
+
key: "bgColorHover",
|
121
|
+
type: "color"
|
122
|
+
}, {
|
123
|
+
label: "Border",
|
124
|
+
key: "borderColorHover",
|
125
|
+
type: "color"
|
126
|
+
}]
|
91
127
|
}, {
|
92
128
|
tab: "Save As Template",
|
93
129
|
value: "saveAsTemplate",
|
@@ -104,7 +104,7 @@ const Alignment = props => {
|
|
104
104
|
row: true,
|
105
105
|
"aria-labelledby": "demo-row-radio-buttons-group-label",
|
106
106
|
name: "flexDirection",
|
107
|
-
value: value?.flexDirection || "
|
107
|
+
value: value?.flexDirection || "column",
|
108
108
|
onChange: handleChange,
|
109
109
|
children: [/*#__PURE__*/_jsx(FormControlLabel, {
|
110
110
|
value: "row",
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Grid, IconButton, TextField, Tooltip } from "@mui/material";
|
3
|
+
import * as fIcons from "@mui/icons-material";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
6
|
+
const MUIIcons = Object.keys(fIcons).reduce((a, b) => {
|
7
|
+
if (b.indexOf("Outlined") > -1) {
|
8
|
+
a.outlined.push(b);
|
9
|
+
} else if (b.indexOf("Rounded") > -1) {
|
10
|
+
a.rounded.push(b);
|
11
|
+
} else if (b.indexOf("Sharp") > -1) {
|
12
|
+
a.sharp.push(b);
|
13
|
+
} else if (b.indexOf("TwoTone") > -1) {
|
14
|
+
a.tt.push(b);
|
15
|
+
} else {
|
16
|
+
a.filled.push(b);
|
17
|
+
}
|
18
|
+
return a;
|
19
|
+
}, {
|
20
|
+
filled: [],
|
21
|
+
outlined: [],
|
22
|
+
rounded: [],
|
23
|
+
tt: [],
|
24
|
+
sharp: []
|
25
|
+
});
|
26
|
+
const Icons = props => {
|
27
|
+
const {
|
28
|
+
value,
|
29
|
+
data,
|
30
|
+
onChange
|
31
|
+
} = props;
|
32
|
+
const {
|
33
|
+
key
|
34
|
+
} = data;
|
35
|
+
const [val, setVal] = useState("");
|
36
|
+
const [list, setList] = useState(MUIIcons.filled.slice(0, 90));
|
37
|
+
const onSelectIcon = ico => () => {
|
38
|
+
onChange({
|
39
|
+
[key]: ico
|
40
|
+
});
|
41
|
+
};
|
42
|
+
const handleChange = e => {
|
43
|
+
const keyVal = e.target.value?.toLowerCase();
|
44
|
+
setVal(keyVal);
|
45
|
+
if (keyVal) {
|
46
|
+
setList(MUIIcons.filled.filter(f => {
|
47
|
+
return f.toLowerCase().indexOf(keyVal) > -1;
|
48
|
+
}).slice(0, 90));
|
49
|
+
} else {
|
50
|
+
setList(MUIIcons.filled.slice(0, 90));
|
51
|
+
}
|
52
|
+
};
|
53
|
+
const SelectedIcon = value ? fIcons[value] : null;
|
54
|
+
return /*#__PURE__*/_jsxs(Grid, {
|
55
|
+
container: true,
|
56
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
57
|
+
item: true,
|
58
|
+
xs: 12,
|
59
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
60
|
+
container: true,
|
61
|
+
style: {
|
62
|
+
display: "flex",
|
63
|
+
alignItems: "center",
|
64
|
+
padding: "12px"
|
65
|
+
},
|
66
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
67
|
+
item: true,
|
68
|
+
xs: 10,
|
69
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
70
|
+
fullWidth: true,
|
71
|
+
size: "small",
|
72
|
+
placeholder: "Search Icons...",
|
73
|
+
value: val,
|
74
|
+
onChange: handleChange
|
75
|
+
})
|
76
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
77
|
+
item: true,
|
78
|
+
xs: 2,
|
79
|
+
style: {
|
80
|
+
paddingLeft: "8px"
|
81
|
+
},
|
82
|
+
children: SelectedIcon && /*#__PURE__*/_jsx(SelectedIcon, {})
|
83
|
+
})]
|
84
|
+
})
|
85
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
86
|
+
item: true,
|
87
|
+
xs: 12,
|
88
|
+
textAlign: "center",
|
89
|
+
style: {
|
90
|
+
maxHeight: "200px",
|
91
|
+
overflowY: "auto"
|
92
|
+
},
|
93
|
+
children: list.map(m => {
|
94
|
+
const Ico = fIcons[m];
|
95
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
96
|
+
title: m,
|
97
|
+
arrow: true,
|
98
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
99
|
+
onClick: onSelectIcon(m),
|
100
|
+
children: /*#__PURE__*/_jsx(Ico, {})
|
101
|
+
})
|
102
|
+
}, `mui_ico_${m}`);
|
103
|
+
})
|
104
|
+
})]
|
105
|
+
});
|
106
|
+
};
|
107
|
+
export default Icons;
|
@@ -13,6 +13,7 @@ import SaveAsTemplate from "./saveAsTemplate";
|
|
13
13
|
import TextAlign from "./textAlign";
|
14
14
|
import TextOptions from "./textOptions";
|
15
15
|
import SelectBox from "./selectBox";
|
16
|
+
import Icons from "./icons";
|
16
17
|
const FieldMap = {
|
17
18
|
text: Text,
|
18
19
|
bannerSpacing: BannerSpacing,
|
@@ -28,6 +29,7 @@ const FieldMap = {
|
|
28
29
|
saveAsTemplate: SaveAsTemplate,
|
29
30
|
textAlign: TextAlign,
|
30
31
|
textOptions: TextOptions,
|
31
|
-
selectBox: SelectBox
|
32
|
+
selectBox: SelectBox,
|
33
|
+
icons: Icons
|
32
34
|
};
|
33
35
|
export default FieldMap;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import { Grid, MenuItem, Select } from "@mui/material";
|
2
|
+
import { FormControlLabel, Grid, MenuItem, Select } from "@mui/material";
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
4
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
4
5
|
const TextOptions = props => {
|
5
6
|
const {
|
6
7
|
value,
|
@@ -19,13 +20,19 @@ const TextOptions = props => {
|
|
19
20
|
};
|
20
21
|
return /*#__PURE__*/_jsx(Grid, {
|
21
22
|
container: true,
|
22
|
-
children: /*#__PURE__*/
|
23
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
23
24
|
item: true,
|
24
25
|
xs: 12,
|
25
26
|
style: {
|
26
27
|
padding: "10px"
|
27
28
|
},
|
28
|
-
children: /*#__PURE__*/_jsx(
|
29
|
+
children: [/*#__PURE__*/_jsx("label", {
|
30
|
+
style: {
|
31
|
+
marginBottom: "8px",
|
32
|
+
display: "flex"
|
33
|
+
},
|
34
|
+
children: data?.label
|
35
|
+
}), /*#__PURE__*/_jsx(Select, {
|
29
36
|
onChange: handleChange,
|
30
37
|
value: value || options[0]?.value,
|
31
38
|
placeholder: data?.label,
|
@@ -37,7 +44,7 @@ const TextOptions = props => {
|
|
37
44
|
children: renderOption ? renderOption(m) : m.label || m.text
|
38
45
|
}, `${key}_${m.value}`);
|
39
46
|
})
|
40
|
-
})
|
47
|
+
})]
|
41
48
|
})
|
42
49
|
});
|
43
50
|
};
|
@@ -30,7 +30,7 @@ const StyleContent = props => {
|
|
30
30
|
style: {
|
31
31
|
marginTop: "12px"
|
32
32
|
},
|
33
|
-
children: [...fields].map(m => {
|
33
|
+
children: [...fields].map((m, i) => {
|
34
34
|
const FieldComponent = FieldMap[m.type];
|
35
35
|
return FieldComponent ? /*#__PURE__*/_jsx(FieldComponent, {
|
36
36
|
data: m,
|
@@ -39,7 +39,7 @@ const StyleContent = props => {
|
|
39
39
|
elementProps: element,
|
40
40
|
customProps: customProps,
|
41
41
|
handleClose: handleClose
|
42
|
-
}, `ei_stt_tab_${value}_${m.key}`) : null;
|
42
|
+
}, `ei_stt_tab_${value}_${m.key}_${i}`) : null;
|
43
43
|
})
|
44
44
|
})
|
45
45
|
}, value);
|
@@ -7,11 +7,11 @@ const pageSettingsStyle = [{
|
|
7
7
|
type: "color"
|
8
8
|
}, {
|
9
9
|
label: "Background URL",
|
10
|
-
key: "
|
10
|
+
key: "pageBgImage",
|
11
11
|
type: "text"
|
12
12
|
}, {
|
13
13
|
label: "Background Image",
|
14
|
-
key: "
|
14
|
+
key: "pageBgImage",
|
15
15
|
type: "backgroundImage"
|
16
16
|
}, {
|
17
17
|
label: "Background",
|
@@ -166,7 +166,7 @@ export const getMarked = (leaf, children) => {
|
|
166
166
|
});
|
167
167
|
}
|
168
168
|
if (leaf.fontSize) {
|
169
|
-
const size = sizeMap[leaf.fontSize];
|
169
|
+
const size = sizeMap[leaf.fontSize] || leaf.fontSize;
|
170
170
|
children = /*#__PURE__*/_jsx("span", {
|
171
171
|
style: {
|
172
172
|
fontSize: size
|
@@ -1,13 +1,7 @@
|
|
1
1
|
import { Transforms } from "slate";
|
2
|
-
import
|
2
|
+
import default_grid from "../Elements/Grid/templates/default_grid";
|
3
3
|
export const insertGrid = (editor, item) => {
|
4
|
-
const grid = !item ?
|
5
|
-
type: "grid",
|
6
|
-
grid: "container",
|
7
|
-
children: [{
|
8
|
-
...gridItem()
|
9
|
-
}]
|
10
|
-
} : item;
|
4
|
+
const grid = !item ? JSON.parse(default_grid) : item;
|
11
5
|
const {
|
12
6
|
selection
|
13
7
|
} = editor;
|