@flozy/editor 1.9.0 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/Editor.css +9 -0
- package/dist/Editor/Elements/Attachments/Attachments.js +2 -0
- package/dist/Editor/Elements/Divider/Divider.js +30 -0
- package/dist/Editor/Elements/Divider/DividerButton.js +23 -0
- package/dist/Editor/Elements/Embed/Embed.css +6 -1
- package/dist/Editor/Elements/Embed/Image.js +19 -6
- package/dist/Editor/Elements/Form/FormField.js +6 -3
- package/dist/Editor/Styles/EditorStyles.js +0 -1
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +15 -4
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +20 -28
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +26 -3
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +49 -1
- package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +65 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +1 -1
- package/dist/Editor/Toolbar/Toolbar.js +7 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +5 -0
- package/dist/Editor/common/Icon.js +4 -2
- package/dist/Editor/common/Shorthands/elements.js +13 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +1 -0
- package/dist/Editor/common/iconslist.js +25 -0
- package/dist/Editor/helper/theme.js +9 -1
- package/dist/Editor/hooks/useIntersection.js +20 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +6 -0
- package/dist/Editor/utils/attachments.js +1 -1
- package/dist/Editor/utils/divider.js +12 -0
- package/dist/Editor/utils/gridItem.js +6 -0
- package/dist/Editor/utils/helper.js +10 -0
- package/package.json +3 -1
package/dist/Editor/Editor.css
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
.editor-wrapper {
|
2
|
+
font-family: "Inter", sans-serif;
|
3
|
+
color: #0f172a;
|
4
|
+
line-height: 1.43;
|
5
|
+
font-weight: 400;
|
6
|
+
letter-spacing: 0.01071em;
|
7
|
+
}
|
8
|
+
|
1
9
|
.editor-t-wrapper {
|
2
10
|
font-family: "PoppinsRegular", "Helvetica", "Arial", sans-serif;
|
3
11
|
position: relative;
|
@@ -222,6 +230,7 @@ blockquote {
|
|
222
230
|
color: #ffffff;
|
223
231
|
font-weight: bold;
|
224
232
|
opacity: 1;
|
233
|
+
border-radius: 32px;
|
225
234
|
}
|
226
235
|
|
227
236
|
.signature-btn-container button:hover {
|
@@ -55,6 +55,8 @@ const Attachments = props => {
|
|
55
55
|
className: "pdf-i"
|
56
56
|
}) : type === "xls" ? /*#__PURE__*/_jsx(Icon, {
|
57
57
|
icon: "excelIcon"
|
58
|
+
}) : type === "csv" ? /*#__PURE__*/_jsx(Icon, {
|
59
|
+
icon: "csvIcon"
|
58
60
|
}) : /*#__PURE__*/_jsx(TextSnippetIcon, {
|
59
61
|
className: "doc-i"
|
60
62
|
})
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
3
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
4
|
+
const Divider = props => {
|
5
|
+
const {
|
6
|
+
attributes,
|
7
|
+
children
|
8
|
+
} = props;
|
9
|
+
return /*#__PURE__*/_jsxs("div", {
|
10
|
+
...attributes,
|
11
|
+
className: "dividerComponent",
|
12
|
+
contentEditable: "false",
|
13
|
+
style: {
|
14
|
+
userSelect: "none"
|
15
|
+
},
|
16
|
+
children: [/*#__PURE__*/_jsx("hr", {
|
17
|
+
contentEditable: "false",
|
18
|
+
className: "editorDivider",
|
19
|
+
style: {
|
20
|
+
userSelect: "none"
|
21
|
+
}
|
22
|
+
}), /*#__PURE__*/_jsx("span", {
|
23
|
+
style: {
|
24
|
+
display: "none"
|
25
|
+
},
|
26
|
+
children: children
|
27
|
+
})]
|
28
|
+
});
|
29
|
+
};
|
30
|
+
export default Divider;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { insertDivider } from "../../utils/divider";
|
3
|
+
import ToolbarIcon from "../../common/ToolbarIcon";
|
4
|
+
import Icon from "../../common/Icon";
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
6
|
+
const DividerButton = props => {
|
7
|
+
const {
|
8
|
+
editor,
|
9
|
+
icoBtnType
|
10
|
+
} = props;
|
11
|
+
const handleClick = () => {
|
12
|
+
insertDivider(editor);
|
13
|
+
};
|
14
|
+
return /*#__PURE__*/_jsx(ToolbarIcon, {
|
15
|
+
title: "Divider",
|
16
|
+
onClick: handleClick,
|
17
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
18
|
+
icon: "divider"
|
19
|
+
}),
|
20
|
+
icoBtnType: icoBtnType
|
21
|
+
});
|
22
|
+
};
|
23
|
+
export default DividerButton;
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
.embed img {
|
8
8
|
width: 100%;
|
9
|
-
height:
|
9
|
+
height: auto
|
10
10
|
}
|
11
11
|
.embed iframe {
|
12
12
|
width: 100%;
|
@@ -83,3 +83,8 @@
|
|
83
83
|
.link-embed-wrapper-hover-container:hover .link-embed-wrapper {
|
84
84
|
padding-top: 24px;
|
85
85
|
}
|
86
|
+
|
87
|
+
.editorDivider {
|
88
|
+
border-width: 1px 0 0;
|
89
|
+
border-color: rgba(55, 53, 47, .1607843137254902);
|
90
|
+
}
|
@@ -25,7 +25,8 @@ const Image = ({
|
|
25
25
|
bgColor,
|
26
26
|
borderColor,
|
27
27
|
borderRadius,
|
28
|
-
boxShadow
|
28
|
+
boxShadow,
|
29
|
+
width: oldWidth
|
29
30
|
} = element;
|
30
31
|
const {
|
31
32
|
readOnly
|
@@ -39,14 +40,26 @@ const Image = ({
|
|
39
40
|
const {
|
40
41
|
vertical,
|
41
42
|
horizantal
|
42
|
-
} = alignment
|
43
|
+
} = typeof alignment === "object" ? alignment : {
|
44
|
+
horizantal: alignment,
|
45
|
+
vertical: "center"
|
46
|
+
};
|
43
47
|
const editor = useSlateStatic();
|
44
48
|
const [parentDOM, setParentDOM] = useState(null);
|
45
49
|
const [openSetttings, setOpenSettings] = useState(false);
|
46
50
|
const path = ReactEditor.findPath(editor, element);
|
51
|
+
const getSize = () => {
|
52
|
+
if (element?.size === undefined) {
|
53
|
+
return {
|
54
|
+
widthInPercent: parseInt(oldWidth)
|
55
|
+
};
|
56
|
+
} else {
|
57
|
+
return element?.size || {};
|
58
|
+
}
|
59
|
+
};
|
47
60
|
const [size, onMouseDown, resizing, onLoad] = useResize({
|
48
61
|
parentDOM,
|
49
|
-
size:
|
62
|
+
size: getSize(),
|
50
63
|
onChange: uSize => {
|
51
64
|
Transforms.setNodes(editor, {
|
52
65
|
size: uSize
|
@@ -65,7 +78,7 @@ const Image = ({
|
|
65
78
|
if (editor && ele && ele[1] !== undefined) {
|
66
79
|
const dom = ReactEditor.toDOMNode(editor, element);
|
67
80
|
setParentDOM(dom);
|
68
|
-
onLoad(
|
81
|
+
onLoad(getSize());
|
69
82
|
}
|
70
83
|
}, []);
|
71
84
|
const handleImageClick = () => {
|
@@ -165,8 +178,8 @@ const Image = ({
|
|
165
178
|
className: "embed-image-wrpr",
|
166
179
|
style: {
|
167
180
|
position: "relative",
|
168
|
-
width: `${width}
|
169
|
-
height: `${size.height}px
|
181
|
+
width: `${width}`
|
182
|
+
// height: `${size.height}px`,
|
170
183
|
},
|
171
184
|
children: [!readOnly && /*#__PURE__*/_jsx(ToolBar, {}), /*#__PURE__*/_jsx(ImageContent, {}), selected && !readOnly && /*#__PURE__*/_jsx(IconButton, {
|
172
185
|
onPointerDown: onMouseDown,
|
@@ -6,6 +6,7 @@ import DeleteIcon from "@mui/icons-material/Delete";
|
|
6
6
|
import SettingsIcon from "@mui/icons-material/Settings";
|
7
7
|
import FormElements from "./FormElements";
|
8
8
|
import FieldPopup from "./FieldPopup";
|
9
|
+
import { getBreakPointsValue } from "../../helper/theme";
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
10
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
11
12
|
const FormField = props => {
|
@@ -83,11 +84,13 @@ const FormField = props => {
|
|
83
84
|
};
|
84
85
|
return /*#__PURE__*/_jsxs(Grid, {
|
85
86
|
item: true,
|
86
|
-
xs: grid,
|
87
87
|
...attributes,
|
88
88
|
className: "form-field",
|
89
|
-
|
90
|
-
position: "relative"
|
89
|
+
sx: {
|
90
|
+
position: "relative",
|
91
|
+
width: {
|
92
|
+
...getBreakPointsValue(grid, null, "overrideGridSize", true)
|
93
|
+
}
|
91
94
|
},
|
92
95
|
children: [!readOnly && /*#__PURE__*/_jsx(FieldToolbar, {}), /*#__PURE__*/_jsx(FormElement, {
|
93
96
|
fieldProps: elementProps
|
@@ -8,6 +8,7 @@ import AddTemplates from "../PopupTool/AddTemplates";
|
|
8
8
|
import miniToolbarStyles from "./Styles";
|
9
9
|
import usePopupStyle from "../PopupTool/PopupToolStyle";
|
10
10
|
import PopperHeader from "../PopupTool/PopperHeader";
|
11
|
+
import { getSelectedText } from "../../utils/helper";
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
12
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
13
14
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
@@ -34,6 +35,7 @@ const MiniToolbar = props => {
|
|
34
35
|
const [popper, setPopper] = useState(null);
|
35
36
|
const [anchorEl, setAnchorEl] = useState(null);
|
36
37
|
const [fullScreen, setFullScreen] = useState(false);
|
38
|
+
const [search, setSearch] = useState("");
|
37
39
|
const PopupComponent = POPUP_TYPES[popper] || null;
|
38
40
|
const open = Boolean(PopupComponent);
|
39
41
|
const DialogComp = !fullScreen ? Popper : Dialog;
|
@@ -47,8 +49,10 @@ const MiniToolbar = props => {
|
|
47
49
|
}
|
48
50
|
}, [editor.selection]);
|
49
51
|
const handleClick = type => e => {
|
50
|
-
|
51
|
-
|
52
|
+
if (getSelectedText(editor)?.length === 0) {
|
53
|
+
setPopper(type);
|
54
|
+
setAnchorEl(e.currentTarget);
|
55
|
+
}
|
52
56
|
};
|
53
57
|
const onClose = () => {
|
54
58
|
setPopper(null);
|
@@ -57,6 +61,9 @@ const MiniToolbar = props => {
|
|
57
61
|
const toggleFullscreen = () => {
|
58
62
|
setFullScreen(!fullScreen);
|
59
63
|
};
|
64
|
+
const onSearch = e => {
|
65
|
+
setSearch(e?.target?.value || "");
|
66
|
+
};
|
60
67
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
61
68
|
children: [/*#__PURE__*/_jsx(Box, {
|
62
69
|
component: "div",
|
@@ -96,14 +103,18 @@ const MiniToolbar = props => {
|
|
96
103
|
onClose: onClose,
|
97
104
|
needFullscreen: FULLSCREEN_POPUP[popper],
|
98
105
|
fullScreen: fullScreen,
|
99
|
-
toggleFullscreen: toggleFullscreen
|
106
|
+
toggleFullscreen: toggleFullscreen,
|
107
|
+
search: search,
|
108
|
+
onSearch: onSearch
|
100
109
|
}), /*#__PURE__*/_jsx(PopupComponent, {
|
101
110
|
classes: popupStyles,
|
102
111
|
editor: editor,
|
103
112
|
customProps: customProps,
|
104
113
|
fullScreen: fullScreen,
|
105
114
|
setPopper: setPopper,
|
106
|
-
onClose: onClose
|
115
|
+
onClose: onClose,
|
116
|
+
search: search,
|
117
|
+
onSearch: onSearch
|
107
118
|
})]
|
108
119
|
}) : null
|
109
120
|
})]
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
2
|
-
import { Grid, Tabs, Tab,
|
2
|
+
import { Grid, Tabs, Tab, CircularProgress } from "@mui/material";
|
3
|
+
import TemplateCard from "./TemplateCard";
|
3
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
4
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
5
6
|
const Categories = props => {
|
@@ -47,7 +48,9 @@ const AddTemplates = props => {
|
|
47
48
|
editor,
|
48
49
|
fullScreen,
|
49
50
|
customProps,
|
50
|
-
onClose
|
51
|
+
onClose,
|
52
|
+
search,
|
53
|
+
onSearch
|
51
54
|
} = props;
|
52
55
|
const {
|
53
56
|
services
|
@@ -78,6 +81,7 @@ const AddTemplates = props => {
|
|
78
81
|
setLoading(false);
|
79
82
|
};
|
80
83
|
const handleChange = (event, newValue) => {
|
84
|
+
onSearch("");
|
81
85
|
setCategory(newValue);
|
82
86
|
setFilteredTemplates(templates.filter(f => f.category === newValue));
|
83
87
|
};
|
@@ -89,6 +93,13 @@ const AddTemplates = props => {
|
|
89
93
|
console.log(err);
|
90
94
|
}
|
91
95
|
};
|
96
|
+
const filterByTitle = f => {
|
97
|
+
if (!search) {
|
98
|
+
return true;
|
99
|
+
} else {
|
100
|
+
return f.title.toLowerCase().includes(search);
|
101
|
+
}
|
102
|
+
};
|
92
103
|
return /*#__PURE__*/_jsxs(Grid, {
|
93
104
|
container: true,
|
94
105
|
className: `templates ${fullScreen ? "fullscreen" : ""}`,
|
@@ -109,32 +120,13 @@ const AddTemplates = props => {
|
|
109
120
|
sx: classes.templateCardsWrpr,
|
110
121
|
children: [/*#__PURE__*/_jsx(ProgressBar, {
|
111
122
|
loading: loading
|
112
|
-
}), filteredTemplates.map(m => {
|
113
|
-
return /*#__PURE__*/_jsx(
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
children: [/*#__PURE__*/_jsxs(Box, {
|
120
|
-
sx: classes.templateCardMediaWrpr,
|
121
|
-
children: [/*#__PURE__*/_jsx("div", {
|
122
|
-
className: "img-loader-wrapper"
|
123
|
-
}), /*#__PURE__*/_jsx(CardMedia, {
|
124
|
-
className: `template-card-media ${fullScreen ? "fullscreen" : ""}`,
|
125
|
-
component: "div",
|
126
|
-
image: m?.thumbnail,
|
127
|
-
alt: m?.title,
|
128
|
-
sx: classes.templateCardMedia
|
129
|
-
})]
|
130
|
-
}), /*#__PURE__*/_jsx(CardContent, {
|
131
|
-
style: {
|
132
|
-
height: "30px"
|
133
|
-
},
|
134
|
-
children: m?.title
|
135
|
-
})]
|
136
|
-
})
|
137
|
-
}, `template_${m.id}`);
|
123
|
+
}), filteredTemplates.filter(filterByTitle).map(m => {
|
124
|
+
return /*#__PURE__*/_jsx(TemplateCard, {
|
125
|
+
classes: classes,
|
126
|
+
onSelectTemplate: onSelectTemplate,
|
127
|
+
m: m,
|
128
|
+
fullScreen: fullScreen
|
129
|
+
}, `template_Card_${m.id}_popup`);
|
138
130
|
})]
|
139
131
|
})]
|
140
132
|
});
|
@@ -1,10 +1,27 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import { Grid, Typography, IconButton, Tooltip } from "@mui/material";
|
2
|
+
import { Grid, Typography, IconButton, Tooltip, TextField } from "@mui/material";
|
3
3
|
import CloseIcon from "@mui/icons-material/Close";
|
4
4
|
import OpenInFullIcon from "@mui/icons-material/OpenInFull";
|
5
5
|
import CloseFullscreenIcon from "@mui/icons-material/CloseFullscreen";
|
6
|
+
import { Search } from "@mui/icons-material";
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
|
+
const SearchBox = props => {
|
10
|
+
const {
|
11
|
+
search,
|
12
|
+
classes,
|
13
|
+
handleChange
|
14
|
+
} = props;
|
15
|
+
return /*#__PURE__*/_jsx(TextField, {
|
16
|
+
sx: classes.searchBox,
|
17
|
+
size: "small",
|
18
|
+
InputProps: {
|
19
|
+
startAdornment: /*#__PURE__*/_jsx(Search, {})
|
20
|
+
},
|
21
|
+
value: search,
|
22
|
+
onChange: handleChange
|
23
|
+
});
|
24
|
+
};
|
8
25
|
const PopperHeader = props => {
|
9
26
|
const {
|
10
27
|
title,
|
@@ -12,7 +29,9 @@ const PopperHeader = props => {
|
|
12
29
|
onClose,
|
13
30
|
needFullscreen,
|
14
31
|
fullScreen,
|
15
|
-
toggleFullscreen
|
32
|
+
toggleFullscreen,
|
33
|
+
search,
|
34
|
+
onSearch
|
16
35
|
} = props;
|
17
36
|
return /*#__PURE__*/_jsx(Grid, {
|
18
37
|
container: true,
|
@@ -42,7 +61,11 @@ const PopperHeader = props => {
|
|
42
61
|
}), /*#__PURE__*/_jsxs(Grid, {
|
43
62
|
sx: classes.textFormatLabel,
|
44
63
|
justifyContent: "end",
|
45
|
-
children: [needFullscreen ? /*#__PURE__*/_jsx(
|
64
|
+
children: [needFullscreen ? /*#__PURE__*/_jsx(SearchBox, {
|
65
|
+
classes: classes,
|
66
|
+
search: search,
|
67
|
+
handleChange: onSearch
|
68
|
+
}) : null, needFullscreen ? /*#__PURE__*/_jsx(Tooltip, {
|
46
69
|
title: "Toggle Fullscreen",
|
47
70
|
arrow: true,
|
48
71
|
children: /*#__PURE__*/_jsx(IconButton, {
|
@@ -5,6 +5,7 @@ const usePopupStyle = () => ({
|
|
5
5
|
marginBottom: "12px !important",
|
6
6
|
border: "1px solid #E0E0E0",
|
7
7
|
borderRadius: "10px",
|
8
|
+
maxWidth: "100%",
|
8
9
|
"&.fullscreen": {
|
9
10
|
marginBottom: "0px !important",
|
10
11
|
"& .papper-wrpr": {
|
@@ -23,6 +24,7 @@ const usePopupStyle = () => ({
|
|
23
24
|
overflow: "auto",
|
24
25
|
"&.templates": {
|
25
26
|
width: "500px",
|
27
|
+
maxWidth: "100%",
|
26
28
|
"&.fullscreen": {
|
27
29
|
width: "100%",
|
28
30
|
maxHeight: "fit-content"
|
@@ -144,12 +146,16 @@ const usePopupStyle = () => ({
|
|
144
146
|
position: "relative",
|
145
147
|
padding: "4px",
|
146
148
|
margin: "8px",
|
149
|
+
marginBottom: "0px",
|
147
150
|
border: "1px solid rgba(0, 0, 0, 0.1)",
|
148
151
|
borderRadius: "10px",
|
149
152
|
backgroundColor: "#FEFEFE",
|
150
153
|
overflow: "hidden",
|
151
154
|
"&:hover": {
|
152
|
-
border: "1px solid #2563EB"
|
155
|
+
border: "1px solid #2563EB",
|
156
|
+
"& .template-card-action": {
|
157
|
+
display: "flex"
|
158
|
+
}
|
153
159
|
},
|
154
160
|
"& .img-loader-wrapper": {
|
155
161
|
position: "absolute",
|
@@ -172,6 +178,10 @@ const usePopupStyle = () => ({
|
|
172
178
|
height: `${window.innerHeight - 300}px`
|
173
179
|
}
|
174
180
|
},
|
181
|
+
templateCardTitle: {
|
182
|
+
fontSize: "12px",
|
183
|
+
padding: "6px 8px"
|
184
|
+
},
|
175
185
|
pageWidthBtn: {
|
176
186
|
color: "#64748B",
|
177
187
|
marginTop: "8px",
|
@@ -221,6 +231,44 @@ const usePopupStyle = () => ({
|
|
221
231
|
defaultBtn: {
|
222
232
|
color: "#0F172A",
|
223
233
|
textTransform: "none"
|
234
|
+
},
|
235
|
+
templateCardBtnGrp: {
|
236
|
+
display: "none",
|
237
|
+
position: "absolute",
|
238
|
+
flexDirection: "column",
|
239
|
+
left: 0,
|
240
|
+
bottom: 0,
|
241
|
+
alignItems: "center",
|
242
|
+
justifyContent: "center",
|
243
|
+
zIndex: 1,
|
244
|
+
width: "100%",
|
245
|
+
background: "linear-gradient(180deg, #0F172A00, #0f172ae0 96%)",
|
246
|
+
padding: "10px",
|
247
|
+
boxSizing: "border-box",
|
248
|
+
"& .blueBtn": {
|
249
|
+
background: "#2563EB !important",
|
250
|
+
borderRadius: "7px",
|
251
|
+
padding: "7px 15px",
|
252
|
+
color: "#FFF",
|
253
|
+
width: "100px",
|
254
|
+
marginBottom: "10px"
|
255
|
+
},
|
256
|
+
"& .outlineBtn": {
|
257
|
+
border: "1px solid #D7DBEC",
|
258
|
+
borderRadius: "7px",
|
259
|
+
padding: "7px 15px",
|
260
|
+
color: "#FFF",
|
261
|
+
width: "100px"
|
262
|
+
}
|
263
|
+
},
|
264
|
+
searchBox: {
|
265
|
+
marginRight: "12px",
|
266
|
+
"& input": {
|
267
|
+
padding: "6px 12px"
|
268
|
+
},
|
269
|
+
"& svg": {
|
270
|
+
color: "#CCC"
|
271
|
+
}
|
224
272
|
}
|
225
273
|
});
|
226
274
|
export default usePopupStyle;
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Grid, Card, CardMedia, CardContent, Box, Button } from "@mui/material";
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
4
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
5
|
+
const PreviewAndSelect = props => {
|
6
|
+
const {
|
7
|
+
classes,
|
8
|
+
data,
|
9
|
+
onSelectTemplate
|
10
|
+
} = props;
|
11
|
+
return /*#__PURE__*/_jsxs(Box, {
|
12
|
+
className: "template-card-action",
|
13
|
+
component: "div",
|
14
|
+
sx: classes.templateCardBtnGrp,
|
15
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
16
|
+
className: "blueBtn",
|
17
|
+
onClick: onSelectTemplate(data),
|
18
|
+
children: "Select"
|
19
|
+
}), /*#__PURE__*/_jsx(Button, {
|
20
|
+
href: data?.previewLink,
|
21
|
+
target: "_blank",
|
22
|
+
className: "outlineBtn",
|
23
|
+
children: "Preview"
|
24
|
+
})]
|
25
|
+
});
|
26
|
+
};
|
27
|
+
const TemplateCard = props => {
|
28
|
+
const {
|
29
|
+
classes,
|
30
|
+
m,
|
31
|
+
onSelectTemplate,
|
32
|
+
fullScreen
|
33
|
+
} = props;
|
34
|
+
return /*#__PURE__*/_jsx(Grid, {
|
35
|
+
item: true,
|
36
|
+
xs: 4,
|
37
|
+
style: {
|
38
|
+
minWidth: "150px",
|
39
|
+
minHeight: "200px"
|
40
|
+
},
|
41
|
+
children: /*#__PURE__*/_jsxs(Card, {
|
42
|
+
sx: classes.templateCard,
|
43
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
44
|
+
sx: classes.templateCardMediaWrpr,
|
45
|
+
children: [/*#__PURE__*/_jsx("div", {
|
46
|
+
className: "img-loader-wrapper"
|
47
|
+
}), /*#__PURE__*/_jsx(CardMedia, {
|
48
|
+
className: `template-card-media ${fullScreen ? "fullscreen" : ""}`,
|
49
|
+
component: "div",
|
50
|
+
image: m?.thumbnail,
|
51
|
+
alt: m?.title,
|
52
|
+
sx: classes.templateCardMedia
|
53
|
+
}), /*#__PURE__*/_jsx(PreviewAndSelect, {
|
54
|
+
classes: classes,
|
55
|
+
onSelectTemplate: onSelectTemplate,
|
56
|
+
data: m
|
57
|
+
})]
|
58
|
+
}), /*#__PURE__*/_jsx(CardContent, {
|
59
|
+
sx: classes.templateCardTitle,
|
60
|
+
children: m?.title
|
61
|
+
})]
|
62
|
+
})
|
63
|
+
}, `template_${m.id}`);
|
64
|
+
};
|
65
|
+
export default TemplateCard;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
2
|
-
import { Popper, Fade, Paper
|
2
|
+
import { Popper, Fade, Paper } from "@mui/material";
|
3
3
|
import { Editor, Range } from "slate";
|
4
4
|
import { useSlate, useFocused } from "slate-react";
|
5
5
|
import TextFormat from "./TextFormat";
|
@@ -29,6 +29,7 @@ import "./styles.css";
|
|
29
29
|
import TopBannerButton from "../Elements/TopBanner/TopBannerButton.js";
|
30
30
|
import AttachmentsButton from "../Elements/Attachments/AttachmentsButton";
|
31
31
|
import ColorboxButton from "../Elements/Colorbox/ColorboxButton.js";
|
32
|
+
import DividerButton from "../Elements/Divider/DividerButton.js";
|
32
33
|
import { jsx as _jsx } from "react/jsx-runtime";
|
33
34
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
34
35
|
export const RenderToolbarIcon = props => {
|
@@ -199,6 +200,12 @@ export const RenderToolbarIcon = props => {
|
|
199
200
|
customProps: customProps,
|
200
201
|
icoBtnType: icoBtnType
|
201
202
|
}, element.id);
|
203
|
+
case "divider":
|
204
|
+
return /*#__PURE__*/_jsx(DividerButton, {
|
205
|
+
editor: editor,
|
206
|
+
customProps: customProps,
|
207
|
+
icoBtnType: icoBtnType
|
208
|
+
}, element.id);
|
202
209
|
default:
|
203
210
|
return null;
|
204
211
|
}
|
@@ -7,7 +7,7 @@ import { AiFillEdit, AiOutlineInsertRowBelow, AiOutlineInsertRowRight, AiOutline
|
|
7
7
|
import { SiLatex } from "react-icons/si";
|
8
8
|
import { RiDeleteColumn, RiDeleteRow } from "react-icons/ri";
|
9
9
|
import { IoIosImage, IoMdArrowDroprightCircle, IoMdArrowDropdownCircle } from "react-icons/io";
|
10
|
-
import { GridIcon, AccordionIcon, SignatureIcon, ButtonIcon, Carousal, FormIcon, BoldIcon, FontFamilyIcon, FontSizeIcon, ImageIcon, ItalicIcon, LinkIcon, StrikethroughIcon, TableIcon, UnderLineIcon, VideoIcon, CheckboxIcon, AppHeader, MoreHorizontal, UploadImage, DocsUpload, LeftArrow, RightArrow, CheckListButton, CheckListButtonActive, ExcelIcon } from "./iconslist";
|
10
|
+
import { GridIcon, AccordionIcon, SignatureIcon, ButtonIcon, Carousal, FormIcon, BoldIcon, FontFamilyIcon, FontSizeIcon, ImageIcon, ItalicIcon, LinkIcon, StrikethroughIcon, TableIcon, UnderLineIcon, VideoIcon, CheckboxIcon, AppHeader, MoreHorizontal, UploadImage, DocsUpload, LeftArrow, RightArrow, CheckListButton, CheckListButtonActive, ExcelIcon, CsvIcon, DividerIcon } from "./iconslist";
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
12
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
13
13
|
const iconList = {
|
@@ -194,7 +194,9 @@ const iconList = {
|
|
194
194
|
rightArrow: /*#__PURE__*/_jsx(RightArrow, {}),
|
195
195
|
checkListButton: /*#__PURE__*/_jsx(CheckListButton, {}),
|
196
196
|
checkListButtonActive: /*#__PURE__*/_jsx(CheckListButtonActive, {}),
|
197
|
-
excelIcon: /*#__PURE__*/_jsx(ExcelIcon, {})
|
197
|
+
excelIcon: /*#__PURE__*/_jsx(ExcelIcon, {}),
|
198
|
+
csvIcon: /*#__PURE__*/_jsx(CsvIcon, {}),
|
199
|
+
divider: /*#__PURE__*/_jsx(DividerIcon, {})
|
198
200
|
};
|
199
201
|
const Icon = props => {
|
200
202
|
const {
|
@@ -9,6 +9,8 @@ import { toggleBlock } from "../../utils/SlateUtilityFunctions";
|
|
9
9
|
import { TableUtil } from "../../utils/table";
|
10
10
|
import Icon from "../Icon";
|
11
11
|
import EmojiButton from "../../Elements/Emoji/EmojiButton";
|
12
|
+
import DividerButton from "../../Elements/Divider/DividerButton";
|
13
|
+
import { insertDivider } from "../../utils/divider";
|
12
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
15
|
const ELEMENTS_LIST = [{
|
14
16
|
name: "Heading 1",
|
@@ -134,6 +136,17 @@ const ELEMENTS_LIST = [{
|
|
134
136
|
const table = new TableUtil(editor);
|
135
137
|
table.insertTable(3, 3);
|
136
138
|
}
|
139
|
+
}, {
|
140
|
+
name: "Divider",
|
141
|
+
group: "Elements",
|
142
|
+
desc: "",
|
143
|
+
type: "divider",
|
144
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
145
|
+
icon: "divider"
|
146
|
+
}),
|
147
|
+
onInsert: editor => {
|
148
|
+
insertDivider(editor);
|
149
|
+
}
|
137
150
|
}, {
|
138
151
|
name: "Grid",
|
139
152
|
group: "Elements",
|
@@ -1648,4 +1648,29 @@ export const ExcelIcon = () => /*#__PURE__*/_jsx("svg", {
|
|
1648
1648
|
})
|
1649
1649
|
})
|
1650
1650
|
})
|
1651
|
+
});
|
1652
|
+
export const CsvIcon = () => /*#__PURE__*/_jsxs("svg", {
|
1653
|
+
width: "32",
|
1654
|
+
height: "32",
|
1655
|
+
viewBox: "0 0 32 32",
|
1656
|
+
fill: "none",
|
1657
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1658
|
+
children: [/*#__PURE__*/_jsx("rect", {
|
1659
|
+
width: "32",
|
1660
|
+
height: "32",
|
1661
|
+
rx: "3.69038",
|
1662
|
+
fill: "#E0E0E0"
|
1663
|
+
}), /*#__PURE__*/_jsx("path", {
|
1664
|
+
d: "M26.1095 9.38475H20.3567V3.63197C20.3567 3.51461 20.3101 3.40205 20.2271 3.31906C20.1441 3.23608 20.0315 3.18945 19.9142 3.18945H7.52358C7.40621 3.18945 7.29366 3.23608 7.21067 3.31906C7.12768 3.40205 7.08105 3.51461 7.08105 3.63197V16.0226C7.08105 16.1399 7.12768 16.2525 7.21067 16.3355C7.29366 16.4185 7.40621 16.4651 7.52358 16.4651H19.4716V23.5454H7.52358C7.40621 23.5454 7.29366 23.5921 7.21067 23.6751C7.12768 23.758 7.08105 23.8706 7.08105 23.988V27.5281C7.08105 27.6455 7.12768 27.7581 7.21067 27.841C7.29366 27.924 7.40621 27.9707 7.52358 27.9707H26.1095C26.2268 27.9707 26.3394 27.924 26.4224 27.841C26.5054 27.7581 26.552 27.6455 26.552 27.5281V9.82728C26.552 9.70991 26.5054 9.59735 26.4224 9.51437C26.3394 9.43138 26.2268 9.38475 26.1095 9.38475Z",
|
1665
|
+
fill: "white"
|
1666
|
+
}), /*#__PURE__*/_jsx("path", {
|
1667
|
+
d: "M19.9118 15.5752H5.75112C5.50672 15.5752 5.30859 15.7733 5.30859 16.0177V23.9831C5.30859 24.2275 5.50672 24.4256 5.75112 24.4256H19.9118C20.1562 24.4256 20.3543 24.2275 20.3543 23.9831V16.0177C20.3543 15.7733 20.1562 15.5752 19.9118 15.5752Z",
|
1668
|
+
fill: "#66BB6A"
|
1669
|
+
}), /*#__PURE__*/_jsx("path", {
|
1670
|
+
d: "M26.4208 9.5098L20.2255 3.3145C20.1636 3.25209 20.0845 3.20953 19.9983 3.19224C19.9121 3.17495 19.8228 3.18372 19.7416 3.21742C19.6604 3.25113 19.5911 3.30824 19.5425 3.38149C19.4939 3.45474 19.4682 3.54079 19.4688 3.62869V9.82399C19.4688 9.94135 19.5154 10.0539 19.5984 10.1369C19.6814 10.2199 19.7939 10.2665 19.9113 10.2665H26.1066C26.1945 10.267 26.2805 10.2413 26.3538 10.1928C26.427 10.1442 26.4841 10.0749 26.5178 9.99369C26.5515 9.91251 26.5603 9.82313 26.543 9.73695C26.5257 9.65077 26.4832 9.5717 26.4208 9.5098Z",
|
1671
|
+
fill: "#E0E0E0"
|
1672
|
+
}), /*#__PURE__*/_jsx("path", {
|
1673
|
+
d: "M10.1788 20.5847H10.9753C10.9475 20.8284 10.8559 21.0604 10.7098 21.2573C10.5697 21.4397 10.3875 21.5855 10.1788 21.6821C9.9552 21.7844 9.71217 21.8373 9.46631 21.837C9.23734 21.8459 9.00918 21.805 8.79756 21.7171C8.58593 21.6293 8.39588 21.4965 8.24052 21.3281C7.91249 20.9659 7.74073 20.4888 7.7626 20.0006C7.74301 19.5143 7.91093 19.039 8.23167 18.673C8.37983 18.5042 8.56321 18.37 8.76889 18.2797C8.97456 18.1895 9.19753 18.1455 9.42206 18.1508C9.64785 18.1457 9.87206 18.1898 10.0791 18.2799C10.2862 18.3701 10.4712 18.5042 10.6213 18.673C10.8099 18.8938 10.9313 19.1641 10.9709 19.4518H10.1788C10.1395 19.2957 10.0472 19.158 9.91768 19.0624C9.77323 18.9681 9.60336 18.9202 9.43091 18.9252C9.30533 18.9217 9.18061 18.9471 9.06632 18.9992C8.95203 19.0514 8.8512 19.129 8.77155 19.2261C8.59958 19.4467 8.51173 19.7212 8.52374 20.0006C8.51183 20.2814 8.60313 20.5569 8.7804 20.775C8.86139 20.8714 8.96321 20.9482 9.07819 20.9996C9.19317 21.0509 9.31832 21.0755 9.44418 21.0715C9.6028 21.0807 9.76013 21.0382 9.89257 20.9505C10.025 20.8627 10.1254 20.7344 10.1788 20.5847ZM11.6612 20.7174H12.3914C12.4223 20.8647 12.507 20.9953 12.6289 21.0836C12.7507 21.1719 12.9011 21.2118 13.0507 21.1954C13.1892 21.2025 13.3261 21.1636 13.4402 21.0847C13.4868 21.0509 13.5244 21.0062 13.5499 20.9546C13.5753 20.9029 13.5878 20.8458 13.5862 20.7882C13.5903 20.7117 13.5686 20.636 13.5244 20.5734C13.4803 20.5108 13.4163 20.4649 13.3428 20.4431C13.3103 20.4431 13.1628 20.3988 12.9003 20.3103C12.6226 20.2507 12.3565 20.146 12.1126 20.0006C11.9949 19.9147 11.9001 19.8011 11.8368 19.6699C11.7735 19.5387 11.7436 19.3938 11.7497 19.2483C11.7437 19.1007 11.7703 18.9535 11.8277 18.8174C11.8851 18.6812 11.9718 18.5594 12.0816 18.4606C12.3279 18.2522 12.6446 18.1461 12.9667 18.1641C13.2843 18.152 13.5966 18.2488 13.8517 18.4385C13.9632 18.52 14.0542 18.6265 14.1172 18.7494C14.1802 18.8724 14.2135 19.0083 14.2146 19.1465H13.4756C13.452 19.036 13.3871 18.9387 13.2941 18.8745C13.2012 18.8103 13.0872 18.7842 12.9755 18.8013C12.8543 18.7955 12.7346 18.8297 12.6348 18.8987C12.5939 18.9286 12.5609 18.968 12.5386 19.0135C12.5162 19.0589 12.5052 19.1091 12.5064 19.1598C12.5032 19.2161 12.5165 19.2721 12.5448 19.3209C12.5732 19.3697 12.6152 19.4091 12.6657 19.4341C12.8434 19.5084 13.029 19.5619 13.2189 19.5934C13.4646 19.6346 13.7013 19.7184 13.9181 19.8413C14.0591 19.9314 14.1741 20.0568 14.2517 20.205C14.3293 20.3533 14.3669 20.5192 14.3606 20.6865C14.3679 20.8731 14.3255 21.0584 14.2376 21.2233C14.1498 21.3881 14.0196 21.5266 13.8605 21.6246C13.61 21.7706 13.3227 21.8412 13.033 21.8282C12.8135 21.8476 12.5925 21.8121 12.3901 21.7248C12.1877 21.6375 12.0102 21.5012 11.8736 21.3281C11.7519 21.146 11.6787 20.9358 11.6612 20.7174ZM16.0466 21.7706L14.719 18.2305H15.5111L16.3741 20.6201L17.1131 18.2305H17.8875L16.7148 21.7706H16.0466Z",
|
1674
|
+
fill: "white"
|
1675
|
+
})]
|
1651
1676
|
});
|
@@ -13,6 +13,9 @@ export const getDevice = width => {
|
|
13
13
|
}
|
14
14
|
};
|
15
15
|
const copyAllLg = (value, ot) => {
|
16
|
+
if (value && value["lg"] !== undefined) {
|
17
|
+
return value;
|
18
|
+
}
|
16
19
|
return BREAKPOINTS_DEVICES.reduce((a, b) => {
|
17
20
|
return {
|
18
21
|
...a,
|
@@ -42,7 +45,12 @@ export const getBreakPointsValue = (value, breakpoint, ot = null, ov = false) =>
|
|
42
45
|
if (typeof value !== "object") {
|
43
46
|
return value;
|
44
47
|
}
|
45
|
-
|
48
|
+
if (value && value["lg"] === undefined) {
|
49
|
+
let val = copyAllLg(value, ot);
|
50
|
+
return val ? val[breakpoint] || val["lg"] : val;
|
51
|
+
} else {
|
52
|
+
return value ? value[breakpoint] || value["lg"] : value;
|
53
|
+
}
|
46
54
|
} else if (typeof value === "object") {
|
47
55
|
return !breakpoint && value["lg"] ? !ov ? value : overrideValues(value, ot) : value[breakpoint] || copyAllLg(value, ot);
|
48
56
|
} else {
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { useState, useEffect } from "react";
|
2
|
+
const useIntersection = (element, rootMargin, threshold) => {
|
3
|
+
const [isVisible, setState] = useState(false);
|
4
|
+
useEffect(() => {
|
5
|
+
const observer = new IntersectionObserver(([entry]) => {
|
6
|
+
setState(entry.isIntersecting);
|
7
|
+
}, {
|
8
|
+
rootMargin,
|
9
|
+
threshold
|
10
|
+
});
|
11
|
+
element?.current && observer.observe(element.current);
|
12
|
+
return () => {
|
13
|
+
if (element && element?.current) {
|
14
|
+
observer.unobserve(element.current);
|
15
|
+
}
|
16
|
+
};
|
17
|
+
}, [element?.current]);
|
18
|
+
return isVisible;
|
19
|
+
};
|
20
|
+
export default useIntersection;
|
@@ -38,6 +38,7 @@ import Attachments from "../Elements/Attachments/Attachments";
|
|
38
38
|
import { getBreakPointsValue } from "../helper/theme";
|
39
39
|
import Variables from "../Elements/Variables/Variable";
|
40
40
|
import insertNewLine from "./insertNewLine";
|
41
|
+
import Divider from "../Elements/Divider/Divider";
|
41
42
|
import { jsx as _jsx } from "react/jsx-runtime";
|
42
43
|
const alignment = ["alignLeft", "alignRight", "alignCenter"];
|
43
44
|
const list_types = ["orderedList", "unorderedList"];
|
@@ -491,6 +492,7 @@ export const getBlock = props => {
|
|
491
492
|
case "docs":
|
492
493
|
case "pdf":
|
493
494
|
case "xls":
|
495
|
+
case "csv":
|
494
496
|
return /*#__PURE__*/_jsx(Attachments, {
|
495
497
|
...props
|
496
498
|
});
|
@@ -506,6 +508,10 @@ export const getBlock = props => {
|
|
506
508
|
},
|
507
509
|
children: children
|
508
510
|
});
|
511
|
+
case "divider":
|
512
|
+
return /*#__PURE__*/_jsx(Divider, {
|
513
|
+
...props
|
514
|
+
});
|
509
515
|
default:
|
510
516
|
return /*#__PURE__*/_jsx(SimpleText, {
|
511
517
|
...props,
|
@@ -24,7 +24,7 @@ export const insertAttachments = (editor, data) => {
|
|
24
24
|
if (url) {
|
25
25
|
const attachmentsNode = createAttachmentsNode({
|
26
26
|
...data,
|
27
|
-
type: docType?.includes("pdf") ? "pdf" : docType?.includes("doc") || docType?.includes("page") ? "docs" : docType?.includes("xls") || docType?.includes("numbers") ? "xls" : "docs"
|
27
|
+
type: docType?.includes("pdf") ? "pdf" : docType?.includes("doc") || docType?.includes("page") ? "docs" : docType?.includes("xls") || docType?.includes("numbers") ? "xls" : docType?.includes("csv") ? "csv" : "docs"
|
28
28
|
});
|
29
29
|
Transforms.insertNodes(editor, [attachmentsNode]);
|
30
30
|
insertNewLine(editor);
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Transforms } from "slate";
|
2
|
+
import insertNewLine from "./insertNewLine";
|
3
|
+
export const insertDivider = editor => {
|
4
|
+
const divider = {
|
5
|
+
type: "divider",
|
6
|
+
children: [{
|
7
|
+
text: ""
|
8
|
+
}]
|
9
|
+
};
|
10
|
+
Transforms.insertNodes(editor, divider);
|
11
|
+
insertNewLine(editor);
|
12
|
+
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { Editor } from "slate";
|
1
2
|
export const formatDate = (date, format = "MM/DD/YYYY") => {
|
2
3
|
if (!date) return "";
|
3
4
|
var d = new Date(date),
|
@@ -71,4 +72,13 @@ export const isTextSelected = selection => {
|
|
71
72
|
console.log(err);
|
72
73
|
return false;
|
73
74
|
}
|
75
|
+
};
|
76
|
+
export const getSelectedText = editor => {
|
77
|
+
try {
|
78
|
+
console.log("Q1", Editor.string(editor, editor?.selection));
|
79
|
+
return Editor.string(editor, editor?.selection);
|
80
|
+
} catch (err) {
|
81
|
+
console.log(err);
|
82
|
+
return '';
|
83
|
+
}
|
74
84
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flozy/editor",
|
3
|
-
"version": "1.9.
|
3
|
+
"version": "1.9.2",
|
4
4
|
"description": "An Editor for flozy app brain",
|
5
5
|
"files": [
|
6
6
|
"dist"
|
@@ -22,7 +22,9 @@
|
|
22
22
|
"@testing-library/jest-dom": "^5.16.5",
|
23
23
|
"@testing-library/react": "^13.4.0",
|
24
24
|
"@testing-library/user-event": "^13.5.0",
|
25
|
+
"analytics": "^0.8.11",
|
25
26
|
"animate.css": "^4.1.1",
|
27
|
+
"countries-and-timezones": "^3.6.0",
|
26
28
|
"emoji-mart": "^5.5.2",
|
27
29
|
"html2canvas": "^1.4.1",
|
28
30
|
"husky": "^8.0.3",
|