@flozy/editor 1.1.4 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CollaborativeEditor.js +6 -1
- package/dist/Editor/CommonEditor.js +16 -2
- package/dist/Editor/Editor.css +15 -3
- package/dist/Editor/Elements/Button/EditorButton.js +3 -3
- package/dist/Editor/Elements/Carousel/Carousel.js +19 -5
- package/dist/Editor/Elements/Carousel/CarouselItem.js +5 -1
- package/dist/Editor/Elements/ChipText/ChipText.js +44 -0
- package/dist/Editor/Elements/ChipText/ChipTextButton.js +64 -0
- package/dist/Editor/Elements/ChipText/ChipTextPopup.js +24 -0
- package/dist/Editor/Elements/DrawerMenu/DrawerMenu.js +66 -0
- package/dist/Editor/Elements/DrawerMenu/DrawerMenuButton.js +21 -0
- package/dist/Editor/Elements/Link/Link.js +5 -5
- package/dist/Editor/Elements/Link/LinkButton.js +50 -37
- package/dist/Editor/Elements/Table/Table.js +160 -10
- package/dist/Editor/Elements/Table/TableCell.js +55 -143
- package/dist/Editor/Elements/Table/table.css +13 -0
- package/dist/Editor/Toolbar/Toolbar.js +12 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +6 -0
- package/dist/Editor/common/ColorPickerButton.js +65 -0
- package/dist/Editor/common/StyleBuilder/chipTextStyle.js +35 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +8 -14
- package/dist/Editor/common/StyleBuilder/index.js +8 -3
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +12 -0
- package/dist/Editor/plugins/withLinks.js +40 -2
- package/dist/Editor/plugins/withTable.js +10 -1
- package/dist/Editor/service/fileupload.js +1 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +10 -0
- package/dist/Editor/utils/customHooks/useTableResize.js +46 -0
- package/dist/Editor/utils/insertChipText.js +49 -0
- package/dist/Editor/utils/insertDrawerMenu.js +52 -0
- package/dist/Editor/utils/table.js +26 -3
- package/package.json +2 -1
@@ -1,30 +1,180 @@
|
|
1
|
-
import React from "react";
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Transforms } from "slate";
|
3
|
+
import { useSelected, useSlateStatic } from "slate-react";
|
4
|
+
import { IconButton } from "@mui/material";
|
5
|
+
import AlignHorizontalLeftIcon from "@mui/icons-material/AlignHorizontalLeft";
|
6
|
+
import AlignHorizontalRightIcon from "@mui/icons-material/AlignHorizontalRight";
|
7
|
+
import AlignVerticalTopIcon from "@mui/icons-material/AlignVerticalTop";
|
8
|
+
import AlignVerticalBottomIcon from "@mui/icons-material/AlignVerticalBottom";
|
9
|
+
import DeleteForeverIcon from "@mui/icons-material/DeleteForever";
|
10
|
+
import SettingsIcon from "@mui/icons-material/Settings";
|
11
|
+
import DeleteCellIcon from "./DeleteCellIcon";
|
12
|
+
import DeleteRowIcon from "./DeleteRowIcon";
|
13
|
+
import { TableUtil } from "../../utils/table";
|
14
|
+
import TablePopup from "./TablePopup";
|
15
|
+
import "./table.css";
|
2
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
17
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
18
|
+
const TABLE_MENUS = [{
|
19
|
+
Icon: AlignHorizontalRightIcon,
|
20
|
+
text: "Insert Columns to the Right",
|
21
|
+
action: {
|
22
|
+
type: "insertColumn",
|
23
|
+
position: "after"
|
24
|
+
}
|
25
|
+
}, {
|
26
|
+
Icon: AlignHorizontalLeftIcon,
|
27
|
+
text: "Insert Columns to the Left",
|
28
|
+
action: {
|
29
|
+
type: "insertColumn",
|
30
|
+
position: "at"
|
31
|
+
}
|
32
|
+
}, {
|
33
|
+
Icon: AlignVerticalTopIcon,
|
34
|
+
text: "Insert Row Above",
|
35
|
+
action: {
|
36
|
+
type: "insertRow",
|
37
|
+
positon: "at"
|
38
|
+
}
|
39
|
+
}, {
|
40
|
+
Icon: AlignVerticalBottomIcon,
|
41
|
+
text: "Insert Row Below",
|
42
|
+
action: {
|
43
|
+
type: "insertRow",
|
44
|
+
position: "after"
|
45
|
+
}
|
46
|
+
}, {
|
47
|
+
Icon: DeleteRowIcon,
|
48
|
+
text: "Delete Row",
|
49
|
+
action: {
|
50
|
+
type: "deleteRow"
|
51
|
+
}
|
52
|
+
}, {
|
53
|
+
Icon: DeleteCellIcon,
|
54
|
+
text: "Delete Column",
|
55
|
+
action: {
|
56
|
+
type: "deleteColumn"
|
57
|
+
}
|
58
|
+
}, {
|
59
|
+
Icon: SettingsIcon,
|
60
|
+
text: "Settings",
|
61
|
+
action: {
|
62
|
+
type: "settings"
|
63
|
+
}
|
64
|
+
}, {
|
65
|
+
Icon: DeleteForeverIcon,
|
66
|
+
text: "Remove Table",
|
67
|
+
action: {
|
68
|
+
type: "remove"
|
69
|
+
}
|
70
|
+
}];
|
71
|
+
const Table = props => {
|
72
|
+
const {
|
73
|
+
element,
|
74
|
+
attributes,
|
75
|
+
children,
|
76
|
+
customProps
|
77
|
+
} = props;
|
78
|
+
const [openSetttings, setOpenSettings] = useState(false);
|
8
79
|
const {
|
9
80
|
bgColor,
|
10
81
|
borderColor
|
11
82
|
} = element;
|
12
|
-
|
83
|
+
const editor = useSlateStatic();
|
84
|
+
const selected = useSelected();
|
85
|
+
const table = new TableUtil(editor);
|
86
|
+
const tableProps = table.getTableProps();
|
87
|
+
const handleAction = ({
|
88
|
+
type,
|
89
|
+
position
|
90
|
+
}) => () => {
|
91
|
+
Transforms.select(editor, editor.selection);
|
92
|
+
switch (type) {
|
93
|
+
case "insertRow":
|
94
|
+
table.insertRow(position);
|
95
|
+
break;
|
96
|
+
case "insertColumn":
|
97
|
+
table.insertColumn(position);
|
98
|
+
break;
|
99
|
+
case "deleteRow":
|
100
|
+
table.deleteRow();
|
101
|
+
break;
|
102
|
+
case "deleteColumn":
|
103
|
+
table.deleteColumn();
|
104
|
+
break;
|
105
|
+
case "remove":
|
106
|
+
table.removeTable();
|
107
|
+
break;
|
108
|
+
case "settings":
|
109
|
+
if (tableProps) {
|
110
|
+
onSettings(true);
|
111
|
+
}
|
112
|
+
break;
|
113
|
+
default:
|
114
|
+
return;
|
115
|
+
}
|
116
|
+
};
|
117
|
+
const ToolBar = () => {
|
118
|
+
return selected ? /*#__PURE__*/_jsx("div", {
|
119
|
+
contentEditable: false,
|
120
|
+
style: {
|
121
|
+
position: "absolute",
|
122
|
+
top: "-40px",
|
123
|
+
left: 0,
|
124
|
+
backgroundColor: "#CCC"
|
125
|
+
},
|
126
|
+
children: TABLE_MENUS.map(({
|
127
|
+
Icon,
|
128
|
+
text,
|
129
|
+
action
|
130
|
+
}) => {
|
131
|
+
return /*#__PURE__*/_jsx(IconButton, {
|
132
|
+
title: text,
|
133
|
+
onClick: handleAction(action),
|
134
|
+
children: /*#__PURE__*/_jsx(Icon, {})
|
135
|
+
}, text);
|
136
|
+
})
|
137
|
+
}) : null;
|
138
|
+
};
|
139
|
+
const onSettings = () => {
|
140
|
+
setOpenSettings(true);
|
141
|
+
};
|
142
|
+
const onSave = data => {
|
143
|
+
const updateData = {
|
144
|
+
...data
|
145
|
+
};
|
146
|
+
delete updateData.children;
|
147
|
+
delete updateData.type;
|
148
|
+
table.updateTableStyle(updateData, {
|
149
|
+
...tableProps
|
150
|
+
});
|
151
|
+
onClose();
|
152
|
+
};
|
153
|
+
const onClose = () => {
|
154
|
+
setOpenSettings(false);
|
155
|
+
};
|
156
|
+
return /*#__PURE__*/_jsxs("div", {
|
13
157
|
style: {
|
14
158
|
minWidth: "100%",
|
15
159
|
maxWidth: "100%",
|
16
160
|
position: "relative"
|
17
161
|
},
|
18
|
-
children: /*#__PURE__*/_jsx("table", {
|
162
|
+
children: [/*#__PURE__*/_jsx("table", {
|
19
163
|
style: {
|
20
164
|
backgroundColor: bgColor,
|
21
|
-
border: `1px solid ${borderColor}
|
165
|
+
border: `1px solid ${borderColor}`,
|
166
|
+
width: "auto"
|
22
167
|
},
|
23
168
|
children: /*#__PURE__*/_jsx("tbody", {
|
24
169
|
...attributes,
|
25
170
|
children: children
|
26
171
|
})
|
27
|
-
})
|
172
|
+
}), /*#__PURE__*/_jsx(ToolBar, {}), openSetttings ? /*#__PURE__*/_jsx(TablePopup, {
|
173
|
+
element: tableProps?.styleProps || {},
|
174
|
+
onSave: onSave,
|
175
|
+
onClose: onClose,
|
176
|
+
customProps: customProps
|
177
|
+
}) : null]
|
28
178
|
});
|
29
179
|
};
|
30
180
|
export default Table;
|
@@ -1,89 +1,50 @@
|
|
1
|
-
import React, { useState } from "react";
|
2
|
-
import {
|
1
|
+
import React, { useState, useEffect } from "react";
|
2
|
+
import { Editor, Element } from "slate";
|
3
3
|
import { useSelected, useSlateStatic, ReactEditor } from "slate-react";
|
4
|
-
import
|
5
|
-
import AlignHorizontalLeftIcon from "@mui/icons-material/AlignHorizontalLeft";
|
6
|
-
import AlignHorizontalRightIcon from "@mui/icons-material/AlignHorizontalRight";
|
7
|
-
import AlignVerticalTopIcon from "@mui/icons-material/AlignVerticalTop";
|
8
|
-
import AlignVerticalBottomIcon from "@mui/icons-material/AlignVerticalBottom";
|
9
|
-
import DeleteForeverIcon from "@mui/icons-material/DeleteForever";
|
10
|
-
import SettingsIcon from "@mui/icons-material/Settings";
|
11
|
-
import DeleteCellIcon from "./DeleteCellIcon";
|
12
|
-
import DeleteRowIcon from "./DeleteRowIcon";
|
4
|
+
import useTableResize from "../../utils/customHooks/useTableResize";
|
13
5
|
import { TableUtil } from "../../utils/table";
|
14
|
-
import TablePopup from "./TablePopup";
|
15
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
16
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
17
|
-
const
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
type: "insertRow",
|
36
|
-
positon: "at"
|
37
|
-
}
|
38
|
-
}, {
|
39
|
-
Icon: AlignVerticalBottomIcon,
|
40
|
-
text: "Insert Row Below",
|
41
|
-
action: {
|
42
|
-
type: "insertRow",
|
43
|
-
position: "after"
|
44
|
-
}
|
45
|
-
}, {
|
46
|
-
Icon: DeleteRowIcon,
|
47
|
-
text: "Delete Row",
|
48
|
-
action: {
|
49
|
-
type: "deleteRow"
|
50
|
-
}
|
51
|
-
}, {
|
52
|
-
Icon: DeleteCellIcon,
|
53
|
-
text: "Delete Column",
|
54
|
-
action: {
|
55
|
-
type: "deleteColumn"
|
56
|
-
}
|
57
|
-
}, {
|
58
|
-
Icon: SettingsIcon,
|
59
|
-
text: "Settings",
|
60
|
-
action: {
|
61
|
-
type: "settings"
|
62
|
-
}
|
63
|
-
}, {
|
64
|
-
Icon: DeleteForeverIcon,
|
65
|
-
text: "Remove Table",
|
66
|
-
action: {
|
67
|
-
type: "remove"
|
68
|
-
}
|
69
|
-
}];
|
9
|
+
const Resizer = ({
|
10
|
+
onMouseDown
|
11
|
+
}) => {
|
12
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
13
|
+
children: /*#__PURE__*/_jsx("button", {
|
14
|
+
contentEditable: false,
|
15
|
+
onPointerDown: onMouseDown,
|
16
|
+
className: "cell-resizer",
|
17
|
+
style: {
|
18
|
+
width: "10px",
|
19
|
+
height: "100%",
|
20
|
+
position: "absolute",
|
21
|
+
right: "0px",
|
22
|
+
top: 0
|
23
|
+
}
|
24
|
+
})
|
25
|
+
});
|
26
|
+
};
|
70
27
|
const TableCell = props => {
|
71
28
|
const {
|
72
29
|
element,
|
73
30
|
attributes,
|
74
|
-
children
|
75
|
-
customProps
|
31
|
+
children
|
76
32
|
} = props;
|
77
|
-
const [openSetttings, setOpenSettings] = useState(false);
|
78
33
|
const {
|
79
34
|
bgColor,
|
80
35
|
borderColor
|
81
36
|
} = element;
|
37
|
+
const [parentDOM, setParentDOM] = useState(null);
|
82
38
|
const editor = useSlateStatic();
|
83
39
|
const selected = useSelected();
|
40
|
+
const path = ReactEditor.findPath(editor, element);
|
41
|
+
const isHeader = path.length >= 2 ? path[path.length - 2] === 0 : false;
|
42
|
+
const [size, onMouseDown, resizing, onLoad] = useTableResize({
|
43
|
+
parentDOM,
|
44
|
+
size: element?.size
|
45
|
+
});
|
84
46
|
const table = new TableUtil(editor);
|
85
47
|
const tableProps = table.getTableProps();
|
86
|
-
const path = ReactEditor.findPath(editor, element);
|
87
48
|
const [tableNode] = Editor.nodes(editor, {
|
88
49
|
at: path,
|
89
50
|
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
@@ -94,87 +55,38 @@ const TableCell = props => {
|
|
94
55
|
});
|
95
56
|
const [parentProps] = tableNode || [{}];
|
96
57
|
const [rowProps] = rowNode || [{}];
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
break;
|
106
|
-
case "insertColumn":
|
107
|
-
table.insertColumn(position);
|
108
|
-
break;
|
109
|
-
case "deleteRow":
|
110
|
-
table.deleteRow();
|
111
|
-
break;
|
112
|
-
case "deleteColumn":
|
113
|
-
table.deleteColumn();
|
114
|
-
break;
|
115
|
-
case "remove":
|
116
|
-
table.removeTable();
|
117
|
-
break;
|
118
|
-
case "settings":
|
119
|
-
if (tableProps) {
|
120
|
-
onSettings(true);
|
121
|
-
}
|
122
|
-
break;
|
123
|
-
default:
|
124
|
-
return;
|
58
|
+
useEffect(() => {
|
59
|
+
if (editor && element) {
|
60
|
+
const dom = ReactEditor.toDOMNode(editor, element);
|
61
|
+
setParentDOM(dom);
|
62
|
+
onLoad(element?.size || {
|
63
|
+
width: 100,
|
64
|
+
height: 100
|
65
|
+
});
|
125
66
|
}
|
126
|
-
};
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
Icon,
|
138
|
-
text,
|
139
|
-
action
|
140
|
-
}) => {
|
141
|
-
return /*#__PURE__*/_jsx(IconButton, {
|
142
|
-
title: text,
|
143
|
-
onClick: handleInsert(action),
|
144
|
-
children: /*#__PURE__*/_jsx(Icon, {})
|
145
|
-
}, text);
|
146
|
-
})
|
147
|
-
}) : null;
|
148
|
-
};
|
149
|
-
const onSettings = () => {
|
150
|
-
setOpenSettings(true);
|
151
|
-
};
|
152
|
-
const onSave = data => {
|
153
|
-
const updateData = {
|
154
|
-
...data
|
155
|
-
};
|
156
|
-
delete updateData.children;
|
157
|
-
delete updateData.type;
|
158
|
-
table.updateTableStyle(updateData, {
|
159
|
-
...tableProps
|
160
|
-
});
|
161
|
-
onClose();
|
162
|
-
};
|
163
|
-
const onClose = () => {
|
164
|
-
setOpenSettings(false);
|
165
|
-
};
|
67
|
+
}, []);
|
68
|
+
useEffect(() => {
|
69
|
+
if (!resizing && tableProps) {
|
70
|
+
table.updateTableStyle({
|
71
|
+
"col.size": size
|
72
|
+
}, tableProps);
|
73
|
+
}
|
74
|
+
}, [resizing]);
|
75
|
+
const sizeProps = isHeader ? {
|
76
|
+
width: size?.width || 100
|
77
|
+
} : {};
|
166
78
|
return /*#__PURE__*/_jsxs("td", {
|
167
79
|
...element.attr,
|
168
80
|
...attributes,
|
81
|
+
className: "editor-table-cell",
|
169
82
|
style: {
|
83
|
+
position: "relative",
|
170
84
|
backgroundColor: bgColor,
|
171
|
-
border: `3px solid ${borderColor || rowProps?.borderColor || parentProps?.borderColor}
|
85
|
+
border: `3px solid ${borderColor || rowProps?.borderColor || parentProps?.borderColor}`,
|
86
|
+
...(sizeProps || {})
|
172
87
|
},
|
173
|
-
children: [
|
174
|
-
|
175
|
-
onSave: onSave,
|
176
|
-
onClose: onClose,
|
177
|
-
customProps: customProps
|
88
|
+
children: [children, selected && isHeader ? /*#__PURE__*/_jsx(Resizer, {
|
89
|
+
onMouseDown: onMouseDown
|
178
90
|
}) : null]
|
179
91
|
});
|
180
92
|
};
|
@@ -23,6 +23,8 @@ import SignatureButton from "../Elements/Signature/SignatureButton";
|
|
23
23
|
import ButtonToolIcon from "../Elements/Button/ButtonToolIcon";
|
24
24
|
import PageSettingsButton from "../Elements/PageSettings/PageSettingsButton";
|
25
25
|
import CarouselButton from "../Elements/Carousel/CarouselButton";
|
26
|
+
import ChipTextButton from "../Elements/ChipText/ChipTextButton";
|
27
|
+
import DrawerMenuButton from "../Elements/DrawerMenu/DrawerMenuButton";
|
26
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
27
29
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
28
30
|
const Toolbar = props => {
|
@@ -186,6 +188,16 @@ const Toolbar = props => {
|
|
186
188
|
return /*#__PURE__*/_jsx(CarouselButton, {
|
187
189
|
editor: editor
|
188
190
|
}, element.id);
|
191
|
+
case "chip-text":
|
192
|
+
return /*#__PURE__*/_jsx(ChipTextButton, {
|
193
|
+
editor: editor,
|
194
|
+
customProps: customProps
|
195
|
+
}, element.id);
|
196
|
+
case "drawer":
|
197
|
+
return /*#__PURE__*/_jsx(DrawerMenuButton, {
|
198
|
+
editor: editor,
|
199
|
+
customProps: customProps
|
200
|
+
}, element.id);
|
189
201
|
default:
|
190
202
|
return null;
|
191
203
|
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Grid, Button, Popover } from "@mui/material";
|
3
|
+
import ColorPicker from "react-best-gradient-color-picker";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
6
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
7
|
+
const ColorPickerButton = props => {
|
8
|
+
const {
|
9
|
+
value,
|
10
|
+
onSave
|
11
|
+
} = props;
|
12
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
13
|
+
const [color, setColor] = useState(value);
|
14
|
+
const open = Boolean(anchorEl);
|
15
|
+
const handleColorPicker = e => {
|
16
|
+
setAnchorEl(e.currentTarget);
|
17
|
+
};
|
18
|
+
const handleSave = () => {
|
19
|
+
onSave(color);
|
20
|
+
handleClose();
|
21
|
+
};
|
22
|
+
const handleClose = () => {
|
23
|
+
setAnchorEl(null);
|
24
|
+
};
|
25
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
26
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
27
|
+
style: {
|
28
|
+
background: value,
|
29
|
+
height: "32px",
|
30
|
+
border: "1px solid #000"
|
31
|
+
},
|
32
|
+
onClick: handleColorPicker
|
33
|
+
}), /*#__PURE__*/_jsx(Popover, {
|
34
|
+
open: open,
|
35
|
+
anchorEl: anchorEl,
|
36
|
+
onClose: handleClose,
|
37
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
38
|
+
container: true,
|
39
|
+
padding: 2,
|
40
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
41
|
+
item: true,
|
42
|
+
xs: 12,
|
43
|
+
children: [/*#__PURE__*/_jsx(ColorPicker, {
|
44
|
+
value: color,
|
45
|
+
onChange: setColor
|
46
|
+
}), /*#__PURE__*/_jsxs("div", {
|
47
|
+
style: {
|
48
|
+
display: "flex",
|
49
|
+
justifyContent: "end",
|
50
|
+
marginTop: "16px"
|
51
|
+
},
|
52
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
53
|
+
onClick: handleClose,
|
54
|
+
children: "Cancel"
|
55
|
+
}), /*#__PURE__*/_jsx(Button, {
|
56
|
+
onClick: handleSave,
|
57
|
+
children: "Save"
|
58
|
+
})]
|
59
|
+
})]
|
60
|
+
})
|
61
|
+
})
|
62
|
+
})]
|
63
|
+
});
|
64
|
+
};
|
65
|
+
export default ColorPickerButton;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
const chipTextStyle = [{
|
2
|
+
tab: "Banner Spacing",
|
3
|
+
value: "bannerSpacing",
|
4
|
+
fields: [{
|
5
|
+
label: "Banner Spacing",
|
6
|
+
key: "bannerSpacing",
|
7
|
+
type: "bannerSpacing"
|
8
|
+
}]
|
9
|
+
}, {
|
10
|
+
tab: "Border Radius",
|
11
|
+
value: "borderRadius",
|
12
|
+
fields: [{
|
13
|
+
label: "Border Radius",
|
14
|
+
key: "borderRadius",
|
15
|
+
type: "borderRadius"
|
16
|
+
}]
|
17
|
+
}, {
|
18
|
+
tab: "Colors",
|
19
|
+
value: "colors",
|
20
|
+
fields: [{
|
21
|
+
label: "Text",
|
22
|
+
key: "textColor",
|
23
|
+
type: "color",
|
24
|
+
needPreview: true
|
25
|
+
}, {
|
26
|
+
label: "Background",
|
27
|
+
key: "bgColor",
|
28
|
+
type: "color"
|
29
|
+
}, {
|
30
|
+
label: "Border",
|
31
|
+
key: "borderColor",
|
32
|
+
type: "color"
|
33
|
+
}]
|
34
|
+
}];
|
35
|
+
export default chipTextStyle;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Grid, TextField, InputAdornment } from "@mui/material";
|
3
|
+
import ColorPickerButton from "../../ColorPickerButton";
|
3
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
4
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
5
6
|
const Color = props => {
|
@@ -19,9 +20,9 @@ const Color = props => {
|
|
19
20
|
bgColor,
|
20
21
|
borderColor
|
21
22
|
} = elementProps;
|
22
|
-
const
|
23
|
+
const onSave = color => {
|
23
24
|
onChange({
|
24
|
-
[key]:
|
25
|
+
[key]: color
|
25
26
|
});
|
26
27
|
};
|
27
28
|
return /*#__PURE__*/_jsxs(Grid, {
|
@@ -35,7 +36,7 @@ const Color = props => {
|
|
35
36
|
style: {
|
36
37
|
padding: "8px",
|
37
38
|
color: textColor,
|
38
|
-
|
39
|
+
background: bgColor,
|
39
40
|
border: `1px solid ${borderColor}`
|
40
41
|
},
|
41
42
|
children: "Text Content"
|
@@ -66,19 +67,12 @@ const Color = props => {
|
|
66
67
|
shrink: true
|
67
68
|
},
|
68
69
|
InputProps: {
|
69
|
-
endAdornment: /*#__PURE__*/
|
70
|
+
endAdornment: /*#__PURE__*/_jsx(InputAdornment, {
|
70
71
|
position: "end",
|
71
|
-
children:
|
72
|
-
type: "color",
|
72
|
+
children: /*#__PURE__*/_jsx(ColorPickerButton, {
|
73
73
|
value: value,
|
74
|
-
|
75
|
-
|
76
|
-
}), /*#__PURE__*/_jsx("input", {
|
77
|
-
type: "checkbox",
|
78
|
-
onChange: handleChange,
|
79
|
-
value: "rgba(0,0,0,0)",
|
80
|
-
checked: value === "rgba(0,0,0,0)"
|
81
|
-
})]
|
74
|
+
onSave: onSave
|
75
|
+
})
|
82
76
|
})
|
83
77
|
}
|
84
78
|
})
|
@@ -66,6 +66,7 @@ const StyleBuilder = props => {
|
|
66
66
|
element,
|
67
67
|
onSave,
|
68
68
|
onClose,
|
69
|
+
onDelete,
|
69
70
|
customProps
|
70
71
|
} = props;
|
71
72
|
const [elementProps, setElementProps] = useState(element);
|
@@ -86,8 +87,8 @@ const StyleBuilder = props => {
|
|
86
87
|
return /*#__PURE__*/_jsxs(Dialog, {
|
87
88
|
open: true,
|
88
89
|
fullWidth: true,
|
89
|
-
children: [/*#__PURE__*/
|
90
|
-
children: title
|
90
|
+
children: [/*#__PURE__*/_jsxs(DialogTitle, {
|
91
|
+
children: [title, " "]
|
91
92
|
}), /*#__PURE__*/_jsxs(DialogContent, {
|
92
93
|
children: [/*#__PURE__*/_jsx(StyleTabs, {
|
93
94
|
renderTabs: renderTabs,
|
@@ -101,7 +102,11 @@ const StyleBuilder = props => {
|
|
101
102
|
customProps: customProps
|
102
103
|
})]
|
103
104
|
}), /*#__PURE__*/_jsxs(DialogActions, {
|
104
|
-
children: [/*#__PURE__*/_jsx(Button, {
|
105
|
+
children: [onDelete ? /*#__PURE__*/_jsx(Button, {
|
106
|
+
onClick: onDelete,
|
107
|
+
color: "error",
|
108
|
+
children: "Delete"
|
109
|
+
}) : null, /*#__PURE__*/_jsx(Button, {
|
105
110
|
onClick: onClose,
|
106
111
|
children: "Cancel"
|
107
112
|
}), /*#__PURE__*/_jsx(Button, {
|
@@ -2,9 +2,21 @@ const pageSettingsStyle = [{
|
|
2
2
|
tab: "Colors",
|
3
3
|
value: "colors",
|
4
4
|
fields: [{
|
5
|
+
label: "Text",
|
6
|
+
key: "color",
|
7
|
+
type: "color"
|
8
|
+
}, {
|
5
9
|
label: "Background",
|
6
10
|
key: "pageColor",
|
7
11
|
type: "color"
|
8
12
|
}]
|
13
|
+
}, {
|
14
|
+
tab: "Spacing",
|
15
|
+
value: "spacing",
|
16
|
+
fields: [{
|
17
|
+
label: "bannerSpacing",
|
18
|
+
key: "bannerSpacing",
|
19
|
+
type: "bannerSpacing"
|
20
|
+
}]
|
9
21
|
}];
|
10
22
|
export default pageSettingsStyle;
|