@flozy/editor 1.1.2 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CollaborativeEditor.js +7 -2
- package/dist/Editor/CommonEditor.js +53 -34
- package/dist/Editor/Editor.css +93 -17
- package/dist/Editor/Elements/Accordion/Accordion.js +67 -2
- package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +20 -0
- package/dist/Editor/Elements/Accordion/AccordionButton.js +2 -1
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +59 -4
- package/dist/Editor/Elements/Accordion/AccordionTitlePopup.js +20 -0
- package/dist/Editor/Elements/Button/ButtonPopup.js +20 -0
- package/dist/Editor/Elements/Button/ButtonToolIcon.js +19 -0
- package/dist/Editor/Elements/Button/EditorButton.js +124 -0
- package/dist/Editor/Elements/Carousel/Arrows.js +39 -0
- package/dist/Editor/Elements/Carousel/Carousel.js +82 -0
- package/dist/Editor/Elements/Carousel/CarouselButton.js +19 -0
- package/dist/Editor/Elements/Carousel/CarouselItem.js +13 -0
- package/dist/Editor/Elements/Carousel/slick-theme.min.css +143 -0
- package/dist/Editor/Elements/Carousel/slick.min.css +83 -0
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +1 -1
- package/dist/Editor/Elements/Embed/Embed.css +22 -2
- package/dist/Editor/Elements/Embed/Embed.js +89 -74
- package/dist/Editor/Elements/Embed/EmbedPopup.js +23 -0
- package/dist/Editor/Elements/Embed/Image.js +92 -10
- package/dist/Editor/Elements/Embed/Video.js +1 -0
- package/dist/Editor/Elements/Equation/EquationButton.js +12 -12
- package/dist/Editor/Elements/Grid/Grid.js +64 -8
- package/dist/Editor/Elements/Grid/GridButton.js +2 -4
- package/dist/Editor/Elements/Grid/GridItem.js +59 -5
- package/dist/Editor/Elements/Grid/GridItemPopup.js +20 -0
- package/dist/Editor/Elements/Grid/GridPopup.js +22 -0
- package/dist/Editor/Elements/ID/Id.js +1 -1
- package/dist/Editor/Elements/ImageText/ImageText.js +14 -0
- package/dist/Editor/Elements/ImageText/ImageTextWrapper.js +14 -0
- package/dist/Editor/Elements/Link/LinkButton.js +1 -1
- package/dist/Editor/Elements/NewLine/NewLineButton.js +2 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +88 -0
- package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +22 -0
- package/dist/Editor/Elements/Signature/Signature.js +4 -2
- package/dist/Editor/Elements/Signature/SignatureButton.js +2 -1
- package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +7 -2
- package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -1
- package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +50 -0
- package/dist/Editor/Elements/Signature/SignatureOptions/index.js +2 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +79 -10
- package/dist/Editor/Elements/Table/DeleteCellIcon.js +24 -0
- package/dist/Editor/Elements/Table/DeleteRowIcon.js +24 -0
- package/dist/Editor/Elements/Table/Table.js +9 -1
- package/dist/Editor/Elements/Table/TableCell.js +181 -0
- package/dist/Editor/Elements/Table/TablePopup.js +22 -0
- package/dist/Editor/Elements/Table/TableRow.js +31 -0
- package/dist/Editor/Elements/Table/TableSelector.js +62 -68
- package/dist/Editor/Toolbar/Toolbar.js +22 -7
- package/dist/Editor/Toolbar/styles.css +20 -11
- package/dist/Editor/Toolbar/toolbarGroups.js +9 -9
- package/dist/Editor/common/Button.js +4 -8
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +23 -0
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +35 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +47 -0
- package/dist/Editor/common/StyleBuilder/embedImageStyle.js +63 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +88 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +87 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +136 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +126 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +89 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/elementSize.js +110 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +42 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/imageTexts.js +75 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +21 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +46 -0
- package/dist/Editor/common/StyleBuilder/gridItemStyle.js +51 -0
- package/dist/Editor/common/StyleBuilder/gridStyle.js +51 -0
- package/dist/Editor/common/StyleBuilder/index.js +114 -0
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +10 -0
- package/dist/Editor/common/StyleBuilder/tableStyle.js +38 -0
- package/dist/Editor/common/Uploader.js +87 -0
- package/dist/Editor/plugins/withEmbeds.js +12 -5
- package/dist/Editor/plugins/withTable.js +5 -4
- package/dist/Editor/service/fileupload.js +17 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +46 -12
- package/dist/Editor/utils/button.js +11 -0
- package/dist/Editor/utils/carousel.js +13 -0
- package/dist/Editor/utils/carouselItem.js +19 -0
- package/dist/Editor/utils/customHooks/useContextMenu.js +8 -8
- package/dist/Editor/utils/customHooks/useResize.js +1 -1
- package/dist/Editor/utils/font.js +4 -4
- package/dist/Editor/utils/helper.js +16 -0
- package/dist/Editor/utils/imageText.js +19 -0
- package/dist/Editor/utils/table.js +172 -0
- package/package.json +2 -1
@@ -0,0 +1,181 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Transforms, Editor, Element } from "slate";
|
3
|
+
import { useSelected, useSlateStatic, ReactEditor } 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 { jsx as _jsx } from "react/jsx-runtime";
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
17
|
+
const TABLE_MENUS = [{
|
18
|
+
Icon: AlignHorizontalRightIcon,
|
19
|
+
text: "Insert Columns to the Right",
|
20
|
+
action: {
|
21
|
+
type: "insertColumn",
|
22
|
+
position: "after"
|
23
|
+
}
|
24
|
+
}, {
|
25
|
+
Icon: AlignHorizontalLeftIcon,
|
26
|
+
text: "Insert Columns to the Left",
|
27
|
+
action: {
|
28
|
+
type: "insertColumn",
|
29
|
+
position: "at"
|
30
|
+
}
|
31
|
+
}, {
|
32
|
+
Icon: AlignVerticalTopIcon,
|
33
|
+
text: "Insert Row Above",
|
34
|
+
action: {
|
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
|
+
}];
|
70
|
+
const TableCell = props => {
|
71
|
+
const {
|
72
|
+
element,
|
73
|
+
attributes,
|
74
|
+
children,
|
75
|
+
customProps
|
76
|
+
} = props;
|
77
|
+
const [openSetttings, setOpenSettings] = useState(false);
|
78
|
+
const {
|
79
|
+
bgColor,
|
80
|
+
borderColor
|
81
|
+
} = element;
|
82
|
+
const editor = useSlateStatic();
|
83
|
+
const selected = useSelected();
|
84
|
+
const table = new TableUtil(editor);
|
85
|
+
const tableProps = table.getTableProps();
|
86
|
+
const path = ReactEditor.findPath(editor, element);
|
87
|
+
const [tableNode] = Editor.nodes(editor, {
|
88
|
+
at: path,
|
89
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
90
|
+
});
|
91
|
+
const [rowNode] = Editor.nodes(editor, {
|
92
|
+
at: path,
|
93
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-row"
|
94
|
+
});
|
95
|
+
const [parentProps] = tableNode || [{}];
|
96
|
+
const [rowProps] = rowNode || [{}];
|
97
|
+
const handleInsert = ({
|
98
|
+
type,
|
99
|
+
position
|
100
|
+
}) => () => {
|
101
|
+
Transforms.select(editor, editor.selection);
|
102
|
+
switch (type) {
|
103
|
+
case "insertRow":
|
104
|
+
table.insertRow(position);
|
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;
|
125
|
+
}
|
126
|
+
};
|
127
|
+
const ToolBar = () => {
|
128
|
+
return selected ? /*#__PURE__*/_jsx("div", {
|
129
|
+
contentEditable: false,
|
130
|
+
style: {
|
131
|
+
position: "absolute",
|
132
|
+
top: "-40px",
|
133
|
+
left: 0,
|
134
|
+
backgroundColor: "#CCC"
|
135
|
+
},
|
136
|
+
children: TABLE_MENUS.map(({
|
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
|
+
};
|
166
|
+
return /*#__PURE__*/_jsxs("td", {
|
167
|
+
...element.attr,
|
168
|
+
...attributes,
|
169
|
+
style: {
|
170
|
+
backgroundColor: bgColor,
|
171
|
+
border: `3px solid ${borderColor || rowProps?.borderColor || parentProps?.borderColor}`
|
172
|
+
},
|
173
|
+
children: [/*#__PURE__*/_jsx(ToolBar, {}), children, openSetttings ? /*#__PURE__*/_jsx(TablePopup, {
|
174
|
+
element: tableProps?.styleProps || {},
|
175
|
+
onSave: onSave,
|
176
|
+
onClose: onClose,
|
177
|
+
customProps: customProps
|
178
|
+
}) : null]
|
179
|
+
});
|
180
|
+
};
|
181
|
+
export default TableCell;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import StyleBuilder from "../../common/StyleBuilder";
|
3
|
+
import tableStyle from "../../common/StyleBuilder/tableStyle";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
const TablePopup = props => {
|
6
|
+
const {
|
7
|
+
element,
|
8
|
+
onSave,
|
9
|
+
onClose,
|
10
|
+
customProps
|
11
|
+
} = props;
|
12
|
+
return /*#__PURE__*/_jsx(StyleBuilder, {
|
13
|
+
title: "Table",
|
14
|
+
type: "gridStyle",
|
15
|
+
element: element,
|
16
|
+
onSave: onSave,
|
17
|
+
onClose: onClose,
|
18
|
+
renderTabs: tableStyle,
|
19
|
+
customProps: customProps
|
20
|
+
});
|
21
|
+
};
|
22
|
+
export default TablePopup;
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Editor, Element } from "slate";
|
3
|
+
import { useSlateStatic, ReactEditor } from "slate-react";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
const TableRow = props => {
|
6
|
+
const {
|
7
|
+
attributes,
|
8
|
+
children,
|
9
|
+
element
|
10
|
+
} = props;
|
11
|
+
const {
|
12
|
+
bgColor,
|
13
|
+
borderColor
|
14
|
+
} = element;
|
15
|
+
const editor = useSlateStatic();
|
16
|
+
const path = ReactEditor.findPath(editor, element);
|
17
|
+
const [tableNode] = Editor.nodes(editor, {
|
18
|
+
at: path,
|
19
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
20
|
+
});
|
21
|
+
const [tableProps] = tableNode || [{}];
|
22
|
+
return /*#__PURE__*/_jsx("tr", {
|
23
|
+
...attributes,
|
24
|
+
style: {
|
25
|
+
backgroundColor: bgColor,
|
26
|
+
border: `1px solid ${borderColor || tableProps?.borderColor}`
|
27
|
+
},
|
28
|
+
children: children
|
29
|
+
});
|
30
|
+
};
|
31
|
+
export default TableRow;
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import React, {
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import { Transforms } from
|
5
|
-
import { TableUtil } from
|
6
|
-
import
|
1
|
+
import React, { useRef, useState } from "react";
|
2
|
+
import { Grid, Button, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, TextField } from "@mui/material";
|
3
|
+
import Icon from "../../common/Icon";
|
4
|
+
import { Transforms } from "slate";
|
5
|
+
import { TableUtil } from "../../utils/table.js";
|
6
|
+
import "./TableSelector.css";
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
9
|
const TableSelector = ({
|
@@ -11,91 +11,85 @@ const TableSelector = ({
|
|
11
11
|
}) => {
|
12
12
|
const tableOptionsRef = useRef();
|
13
13
|
const [selection, setSelection] = useState();
|
14
|
-
const [showOptions, setShowOptions] =
|
14
|
+
const [showOptions, setShowOptions] = useState(false);
|
15
15
|
const [tableData, setTableData] = useState({
|
16
|
-
row:
|
17
|
-
column:
|
16
|
+
row: 2,
|
17
|
+
column: 2
|
18
18
|
});
|
19
|
-
const [tableInput, setTableInput] = useState(Array.from({
|
20
|
-
length: 6
|
21
|
-
}, () => Array.from({
|
22
|
-
length: 6
|
23
|
-
}, (v, i) => ({
|
24
|
-
bg: 'lightGray',
|
25
|
-
column: i
|
26
|
-
}))));
|
27
|
-
useEffect(() => {
|
28
|
-
const newTable = Array.from({
|
29
|
-
length: 6
|
30
|
-
}, (obj, row) => Array.from({
|
31
|
-
length: 6
|
32
|
-
}, (v, col) => ({
|
33
|
-
bg: row + 1 <= tableData.row && col + 1 <= tableData.column ? 'orange' : 'lightgray',
|
34
|
-
column: col
|
35
|
-
})));
|
36
|
-
setTableInput(newTable);
|
37
|
-
}, [tableData]);
|
38
|
-
useEffect(() => {
|
39
|
-
if (!showOptions) {
|
40
|
-
setTableData({
|
41
|
-
row: 0,
|
42
|
-
column: 0
|
43
|
-
});
|
44
|
-
}
|
45
|
-
}, [showOptions]);
|
46
19
|
const table = new TableUtil(editor);
|
47
20
|
const handleButtonClick = () => {
|
48
21
|
setSelection(editor.selection);
|
49
|
-
setShowOptions(
|
22
|
+
setShowOptions(true);
|
50
23
|
};
|
51
24
|
const handleInsert = () => {
|
52
25
|
selection && Transforms.select(editor, selection);
|
26
|
+
table.insertTable(tableData.row, tableData.column);
|
27
|
+
setShowOptions(false);
|
28
|
+
};
|
29
|
+
const handleChange = e => {
|
53
30
|
setTableData({
|
54
|
-
|
55
|
-
|
31
|
+
...tableData,
|
32
|
+
[e.target.name]: e.target.value
|
56
33
|
});
|
57
|
-
|
34
|
+
};
|
35
|
+
const onCancel = () => {
|
58
36
|
setShowOptions(false);
|
59
37
|
};
|
60
38
|
return /*#__PURE__*/_jsxs("div", {
|
61
39
|
ref: tableOptionsRef,
|
62
|
-
className: "popup-
|
63
|
-
children: [/*#__PURE__*/_jsx(
|
40
|
+
className: "popup-wrapper1",
|
41
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
64
42
|
style: {
|
65
|
-
border: showOptions ?
|
43
|
+
border: showOptions ? "1px solid lightgray" : "none"
|
66
44
|
},
|
67
45
|
title: "table",
|
68
46
|
onClick: handleButtonClick,
|
69
47
|
children: /*#__PURE__*/_jsx(Icon, {
|
70
48
|
icon: "table"
|
71
49
|
})
|
72
|
-
}), showOptions
|
73
|
-
|
74
|
-
children: [/*#__PURE__*/_jsx(
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
50
|
+
}), showOptions ? /*#__PURE__*/_jsxs(Dialog, {
|
51
|
+
open: showOptions,
|
52
|
+
children: [/*#__PURE__*/_jsx(DialogTitle, {
|
53
|
+
children: "Table"
|
54
|
+
}), /*#__PURE__*/_jsx(DialogContent, {
|
55
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
56
|
+
container: true,
|
57
|
+
padding: 3,
|
58
|
+
spacing: 2,
|
59
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
60
|
+
item: true,
|
61
|
+
xs: 12,
|
62
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
63
|
+
fullWidth: true,
|
64
|
+
name: "row",
|
65
|
+
value: tableData?.row,
|
66
|
+
onChange: handleChange,
|
67
|
+
label: "No.of Rows",
|
68
|
+
placeholder: "No.of Rows"
|
69
|
+
})
|
70
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
71
|
+
item: true,
|
72
|
+
xs: 12,
|
73
|
+
children: /*#__PURE__*/_jsx(TextField, {
|
74
|
+
fullWidth: true,
|
75
|
+
name: "column",
|
76
|
+
value: tableData?.column,
|
77
|
+
onChange: handleChange,
|
78
|
+
label: "No.of Columns",
|
79
|
+
placeholder: "No.of Columns"
|
80
|
+
})
|
81
|
+
})]
|
80
82
|
})
|
81
|
-
}), /*#__PURE__*/
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
row: row + 1,
|
90
|
-
column: column + 1
|
91
|
-
}),
|
92
|
-
className: "table-unit",
|
93
|
-
style: {
|
94
|
-
border: `1px solid ${bg}`
|
95
|
-
}
|
96
|
-
}, row + col)))
|
83
|
+
}), /*#__PURE__*/_jsxs(DialogActions, {
|
84
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
85
|
+
onClick: onCancel,
|
86
|
+
children: "Cancel"
|
87
|
+
}), /*#__PURE__*/_jsx(Button, {
|
88
|
+
onClick: handleInsert,
|
89
|
+
children: "Save"
|
90
|
+
})]
|
97
91
|
})]
|
98
|
-
})]
|
92
|
+
}) : null]
|
99
93
|
});
|
100
94
|
};
|
101
95
|
export default TableSelector;
|
@@ -14,18 +14,21 @@ import Embed from "../Elements/Embed/Embed";
|
|
14
14
|
import TableSelector from "../Elements/Table/TableSelector";
|
15
15
|
import EquationButton from "../Elements/Equation/EquationButton";
|
16
16
|
import Id from "../Elements/ID/Id";
|
17
|
-
import TableContextMenu from "../Elements/TableContextMenu/TableContextMenu";
|
18
17
|
import CodeToTextButton from "../Elements/CodeToText/CodeToTextButton";
|
19
18
|
import HtmlContextMenu from "../Elements/CodeToText/HtmlContextMenu";
|
20
19
|
import GridButton from "../Elements/Grid/GridButton";
|
21
20
|
import NewLineButton from "../Elements/NewLine/NewLineButton";
|
22
21
|
import AccordionButton from "../Elements/Accordion/AccordionButton";
|
23
22
|
import SignatureButton from "../Elements/Signature/SignatureButton";
|
23
|
+
import ButtonToolIcon from "../Elements/Button/ButtonToolIcon";
|
24
|
+
import PageSettingsButton from "../Elements/PageSettings/PageSettingsButton";
|
25
|
+
import CarouselButton from "../Elements/Carousel/CarouselButton";
|
24
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
25
27
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
26
28
|
const Toolbar = props => {
|
27
29
|
const {
|
28
|
-
handleCodeToText
|
30
|
+
handleCodeToText,
|
31
|
+
customProps
|
29
32
|
} = props;
|
30
33
|
const editor = useSlate();
|
31
34
|
const isTable = useFormat(editor, "table");
|
@@ -79,6 +82,7 @@ const Toolbar = props => {
|
|
79
82
|
const value = activeMark(editor, format);
|
80
83
|
return /*#__PURE__*/_jsx(Select, {
|
81
84
|
value: value,
|
85
|
+
className: "editor-dd",
|
82
86
|
onChange: e => changeMarkData(e, format),
|
83
87
|
style: {
|
84
88
|
fontFamily: fontFamilyMap[value],
|
@@ -106,7 +110,7 @@ const Toolbar = props => {
|
|
106
110
|
return /*#__PURE__*/_jsxs("div", {
|
107
111
|
className: "toolbar",
|
108
112
|
children: [toolbarGroups.map((group, index) => /*#__PURE__*/_jsx("span", {
|
109
|
-
className: "toolbar-
|
113
|
+
className: "toolbar-grp1",
|
110
114
|
children: group.map((element, gi) => {
|
111
115
|
switch (element.type) {
|
112
116
|
case "block":
|
@@ -129,7 +133,8 @@ const Toolbar = props => {
|
|
129
133
|
case "embed":
|
130
134
|
return /*#__PURE__*/_jsx(Embed, {
|
131
135
|
format: element.format,
|
132
|
-
editor: editor
|
136
|
+
editor: editor,
|
137
|
+
customProps: customProps
|
133
138
|
}, element.id);
|
134
139
|
case "color-picker":
|
135
140
|
return /*#__PURE__*/_jsx(ColorPicker, {
|
@@ -169,13 +174,23 @@ const Toolbar = props => {
|
|
169
174
|
return /*#__PURE__*/_jsx(SignatureButton, {
|
170
175
|
editor: editor
|
171
176
|
}, element.id);
|
177
|
+
case "button":
|
178
|
+
return /*#__PURE__*/_jsx(ButtonToolIcon, {
|
179
|
+
editor: editor
|
180
|
+
}, element.id);
|
181
|
+
case "page-settings":
|
182
|
+
return /*#__PURE__*/_jsx(PageSettingsButton, {
|
183
|
+
editor: editor
|
184
|
+
}, element.id);
|
185
|
+
case "carousel":
|
186
|
+
return /*#__PURE__*/_jsx(CarouselButton, {
|
187
|
+
editor: editor
|
188
|
+
}, element.id);
|
172
189
|
default:
|
173
190
|
return null;
|
174
191
|
}
|
175
192
|
})
|
176
|
-
}, index)), /*#__PURE__*/_jsx(
|
177
|
-
editor: editor
|
178
|
-
}), /*#__PURE__*/_jsx(HtmlContextMenu, {
|
193
|
+
}, index)), /*#__PURE__*/_jsx(HtmlContextMenu, {
|
179
194
|
editor: editor,
|
180
195
|
handleCodeToText: handleCodeToText
|
181
196
|
})]
|
@@ -1,28 +1,37 @@
|
|
1
|
-
.toolbar{
|
2
|
-
|
3
|
-
background: #ffffff;
|
4
|
-
box-shadow: -8px 8px 13px #ededed,
|
5
|
-
8px -8px 13px #ffffff;
|
1
|
+
.toolbar {
|
2
|
+
background: #ffffff;
|
6
3
|
margin:4px 0;
|
7
4
|
display:flex;
|
8
5
|
flex-wrap:wrap;
|
9
6
|
align-items:center;
|
10
|
-
padding:
|
7
|
+
padding: 12px 0px;
|
11
8
|
row-gap: 15px;
|
12
9
|
position: -webkit-sticky;
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
position: sticky;
|
11
|
+
top: 0;
|
12
|
+
z-index: 2;
|
13
|
+
margin-bottom: 12px;
|
14
|
+
border-bottom: 2px solid #CCC;
|
16
15
|
}
|
17
|
-
.toolbar-
|
16
|
+
.toolbar-grp1>*{
|
18
17
|
margin-right: 10px;
|
19
18
|
cursor: pointer;
|
20
19
|
}
|
21
|
-
.toolbar-
|
20
|
+
.toolbar-grp1{
|
22
21
|
margin:0 10px;
|
22
|
+
display: flex;
|
23
|
+
align-items: center;
|
23
24
|
}
|
24
25
|
select{
|
25
26
|
height: 30px;
|
26
27
|
border: none;
|
27
28
|
width: 6.9rem;
|
28
29
|
}
|
30
|
+
|
31
|
+
.toolbar .editor-dd {
|
32
|
+
width: 200px !important;
|
33
|
+
}
|
34
|
+
|
35
|
+
.toolbar .MuiIconButton-root {
|
36
|
+
|
37
|
+
}
|
@@ -105,15 +105,6 @@ const toolbarGroups = [[{
|
|
105
105
|
id: 23,
|
106
106
|
type: "table"
|
107
107
|
}], [{
|
108
|
-
id: 25,
|
109
|
-
type: "id"
|
110
|
-
}, {
|
111
|
-
id: 26,
|
112
|
-
type: "equation"
|
113
|
-
}, {
|
114
|
-
id: 27,
|
115
|
-
type: "codeToText"
|
116
|
-
}, {
|
117
108
|
id: 28,
|
118
109
|
type: "grid"
|
119
110
|
}, {
|
@@ -125,5 +116,14 @@ const toolbarGroups = [[{
|
|
125
116
|
}, {
|
126
117
|
id: 31,
|
127
118
|
type: "signature"
|
119
|
+
}, {
|
120
|
+
id: 32,
|
121
|
+
type: "button"
|
122
|
+
}, {
|
123
|
+
id: 33,
|
124
|
+
type: "page-settings"
|
125
|
+
}, {
|
126
|
+
id: 34,
|
127
|
+
type: "carousel"
|
128
128
|
}]];
|
129
129
|
export default toolbarGroups;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import React from
|
1
|
+
import React from "react";
|
2
|
+
import { IconButton } from "@mui/material";
|
2
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
3
4
|
const Button = props => {
|
4
5
|
const {
|
@@ -7,15 +8,10 @@ const Button = props => {
|
|
7
8
|
active,
|
8
9
|
...rest
|
9
10
|
} = props;
|
10
|
-
return /*#__PURE__*/_jsx(
|
11
|
-
className: active ?
|
11
|
+
return /*#__PURE__*/_jsx(IconButton, {
|
12
|
+
className: active ? "btnActive" : "",
|
12
13
|
title: format,
|
13
14
|
...rest,
|
14
|
-
style: {
|
15
|
-
width: '30px',
|
16
|
-
height: '20px',
|
17
|
-
margin: '0 2px'
|
18
|
-
},
|
19
15
|
children: children
|
20
16
|
});
|
21
17
|
};
|
@@ -0,0 +1,23 @@
|
|
1
|
+
const accordionTitleBtnStyle = [{
|
2
|
+
tab: "Colors",
|
3
|
+
value: "colors",
|
4
|
+
fields: [{
|
5
|
+
label: "Text",
|
6
|
+
key: "textColor",
|
7
|
+
type: "color",
|
8
|
+
needPreview: true
|
9
|
+
}, {
|
10
|
+
label: "Button",
|
11
|
+
key: "btnBg",
|
12
|
+
type: "color"
|
13
|
+
}, {
|
14
|
+
label: "Background",
|
15
|
+
key: "bgColor",
|
16
|
+
type: "color"
|
17
|
+
}, {
|
18
|
+
label: "Border",
|
19
|
+
key: "borderColor",
|
20
|
+
type: "color"
|
21
|
+
}]
|
22
|
+
}];
|
23
|
+
export default accordionTitleBtnStyle;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
const accordionTitleStyle = [{
|
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 accordionTitleStyle;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
const buttonStyle = [{
|
2
|
+
tab: "Content",
|
3
|
+
value: "content",
|
4
|
+
fields: [{
|
5
|
+
label: "Button Text",
|
6
|
+
key: "label",
|
7
|
+
type: "text"
|
8
|
+
}, {
|
9
|
+
label: "Button URL",
|
10
|
+
type: "text",
|
11
|
+
key: "url"
|
12
|
+
}]
|
13
|
+
}, {
|
14
|
+
tab: "Banner Spacing",
|
15
|
+
value: "bannerSpacing",
|
16
|
+
fields: [{
|
17
|
+
label: "Banner Spacing",
|
18
|
+
key: "bannerSpacing",
|
19
|
+
type: "bannerSpacing"
|
20
|
+
}]
|
21
|
+
}, {
|
22
|
+
tab: "Border Radius",
|
23
|
+
value: "borderRadius",
|
24
|
+
fields: [{
|
25
|
+
label: "Border Radius",
|
26
|
+
key: "borderRadius",
|
27
|
+
type: "borderRadius"
|
28
|
+
}]
|
29
|
+
}, {
|
30
|
+
tab: "Colors",
|
31
|
+
value: "colors",
|
32
|
+
fields: [{
|
33
|
+
label: "Text",
|
34
|
+
key: "textColor",
|
35
|
+
type: "color",
|
36
|
+
needPreview: true
|
37
|
+
}, {
|
38
|
+
label: "Background",
|
39
|
+
key: "bgColor",
|
40
|
+
type: "color"
|
41
|
+
}, {
|
42
|
+
label: "Border",
|
43
|
+
key: "borderColor",
|
44
|
+
type: "color"
|
45
|
+
}]
|
46
|
+
}];
|
47
|
+
export default buttonStyle;
|