@flozy/editor 1.8.7 → 1.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor/Elements/Attachments/Attachments.js +1 -1
- package/dist/Editor/Elements/Colorbox/ColorboxButton.js +31 -0
- package/dist/Editor/Elements/SimpleText.js +1 -1
- package/dist/Editor/Styles/EditorStyles.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/AddElements.js +1 -1
- package/dist/Editor/Toolbar/Toolbar.js +7 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +6 -0
- package/dist/Editor/common/DnD/DragHandleButton.js +11 -4
- package/dist/Editor/common/Section/index.js +9 -4
- package/dist/Editor/common/Shorthands/elements.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +7 -5
- package/dist/Editor/common/StyleBuilder/index.js +2 -2
- package/dist/Editor/common/Uploader.js +0 -1
- package/dist/Editor/common/iconslist.js +15 -4
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ const Attachments = props => {
|
|
|
18
18
|
date
|
|
19
19
|
} = element;
|
|
20
20
|
const getLastName = url?.split("/").pop();
|
|
21
|
-
const fileName = `${
|
|
21
|
+
const fileName = `${decodeURIComponent(getLastName)}`;
|
|
22
22
|
return /*#__PURE__*/_jsxs(Box, {
|
|
23
23
|
component: "div",
|
|
24
24
|
className: "attachment-wrpr-ev2",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ToolbarIcon from "../../common/ToolbarIcon";
|
|
3
|
+
import Icon from "../../common/Icon";
|
|
4
|
+
import { toggleBlock } from "../../utils/SlateUtilityFunctions";
|
|
5
|
+
import { useSlateStatic } from "slate-react";
|
|
6
|
+
import insertNewLine from "../../utils/insertNewLine";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
+
const ColorboxButton = props => {
|
|
10
|
+
const editor = useSlateStatic();
|
|
11
|
+
const {
|
|
12
|
+
icoBtnType
|
|
13
|
+
} = props;
|
|
14
|
+
const onClick = () => {
|
|
15
|
+
toggleBlock(editor, "blockquote", false, {
|
|
16
|
+
bgColor: "rgb(227, 236, 255)"
|
|
17
|
+
});
|
|
18
|
+
insertNewLine(editor);
|
|
19
|
+
};
|
|
20
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
21
|
+
children: /*#__PURE__*/_jsx(ToolbarIcon, {
|
|
22
|
+
title: "Colorbox",
|
|
23
|
+
onClick: onClick,
|
|
24
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
25
|
+
icon: "colorbox"
|
|
26
|
+
}),
|
|
27
|
+
icoBtnType: icoBtnType
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export default ColorboxButton;
|
|
@@ -97,6 +97,7 @@ const editorStyles = ({
|
|
|
97
97
|
justifyContent: "center",
|
|
98
98
|
alignItems: "center",
|
|
99
99
|
position: "relative",
|
|
100
|
+
padding: "0px 12px",
|
|
100
101
|
"&:hover": {
|
|
101
102
|
"& .ed-section-inner": {
|
|
102
103
|
"& .element-toolbar.ss": {
|
|
@@ -106,7 +107,7 @@ const editorStyles = ({
|
|
|
106
107
|
width: "fit-content",
|
|
107
108
|
"& button": {
|
|
108
109
|
boxShadow: "none",
|
|
109
|
-
color: "
|
|
110
|
+
color: "#D7D7D6",
|
|
110
111
|
background: "rgb(221, 221, 221, 0.1)",
|
|
111
112
|
"&:hover": {
|
|
112
113
|
background: "rgb(221, 221, 221, 0.8)"
|
|
@@ -14,7 +14,7 @@ const AddElements = props => {
|
|
|
14
14
|
const {
|
|
15
15
|
hideTools
|
|
16
16
|
} = customProps;
|
|
17
|
-
const filteredElements = elements.filter(f => hideTools.indexOf(f.type) === -1);
|
|
17
|
+
const filteredElements = elements.filter(f => (hideTools || []).indexOf(f.type) === -1);
|
|
18
18
|
return /*#__PURE__*/_jsx(Grid, {
|
|
19
19
|
container: true,
|
|
20
20
|
sx: classes.textFormatWrapper,
|
|
@@ -28,6 +28,7 @@ import EmojiButton from "../Elements/Emoji/EmojiButton.js";
|
|
|
28
28
|
import "./styles.css";
|
|
29
29
|
import TopBannerButton from "../Elements/TopBanner/TopBannerButton.js";
|
|
30
30
|
import AttachmentsButton from "../Elements/Attachments/AttachmentsButton";
|
|
31
|
+
import ColorboxButton from "../Elements/Colorbox/ColorboxButton.js";
|
|
31
32
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
32
33
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
34
|
export const RenderToolbarIcon = props => {
|
|
@@ -186,6 +187,12 @@ export const RenderToolbarIcon = props => {
|
|
|
186
187
|
customProps: customProps,
|
|
187
188
|
icoBtnType: icoBtnType
|
|
188
189
|
}, element.id);
|
|
190
|
+
case "colorbox":
|
|
191
|
+
return /*#__PURE__*/_jsx(ColorboxButton, {
|
|
192
|
+
editor: editor,
|
|
193
|
+
customProps: customProps,
|
|
194
|
+
icoBtnType: icoBtnType
|
|
195
|
+
}, element.id);
|
|
189
196
|
case "docsUpload":
|
|
190
197
|
return /*#__PURE__*/_jsx(AttachmentsButton, {
|
|
191
198
|
editor: editor,
|
|
@@ -170,6 +170,12 @@ export const toolbarGroups = [[{
|
|
|
170
170
|
format: "topbanner",
|
|
171
171
|
type: "topbanner",
|
|
172
172
|
group: "elements"
|
|
173
|
+
}, {
|
|
174
|
+
id: 47,
|
|
175
|
+
format: "colorbox",
|
|
176
|
+
type: "colorbox",
|
|
177
|
+
title: "Colorbox",
|
|
178
|
+
group: "elements"
|
|
173
179
|
}, {
|
|
174
180
|
id: 42,
|
|
175
181
|
type: "table",
|
|
@@ -7,13 +7,13 @@ import { useEditorContext } from "../../hooks/useMouseMove";
|
|
|
7
7
|
import { Transforms } from "slate";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
const DRAGGABLE_TYPES = ["paragraph", "headingOne", "
|
|
10
|
+
const DRAGGABLE_TYPES = ["paragraph", "headingOne", "headingTwo", "headingThree", "grid"];
|
|
11
11
|
const DragHandleStyle = () => ({
|
|
12
12
|
dragHandle: {
|
|
13
13
|
opacity: 0,
|
|
14
14
|
content: '" "',
|
|
15
15
|
position: "absolute",
|
|
16
|
-
top: "
|
|
16
|
+
top: "0px",
|
|
17
17
|
left: "-52px",
|
|
18
18
|
borderRadius: "0px",
|
|
19
19
|
padding: "0px",
|
|
@@ -24,7 +24,7 @@ const DragHandleStyle = () => ({
|
|
|
24
24
|
alignItems: "center",
|
|
25
25
|
justifyContent: "center",
|
|
26
26
|
cursor: "grab",
|
|
27
|
-
color: "
|
|
27
|
+
color: "#D7D7D6",
|
|
28
28
|
background: "rgb(221, 221, 221, 0.1)",
|
|
29
29
|
"& svg": {
|
|
30
30
|
width: "20px"
|
|
@@ -44,11 +44,17 @@ const DragHandleStyle = () => ({
|
|
|
44
44
|
top: 0,
|
|
45
45
|
width: "100%",
|
|
46
46
|
height: "100%",
|
|
47
|
+
pointerEvents: "none",
|
|
48
|
+
zIndex: -1,
|
|
47
49
|
"&.dragging": {
|
|
48
50
|
backgroundColor: "#def4ff"
|
|
49
51
|
}
|
|
50
52
|
},
|
|
51
53
|
dropAreaOver: {
|
|
54
|
+
position: "absolute",
|
|
55
|
+
left: 0,
|
|
56
|
+
top: 0,
|
|
57
|
+
width: "100%",
|
|
52
58
|
height: "4px"
|
|
53
59
|
}
|
|
54
60
|
});
|
|
@@ -84,8 +90,9 @@ const DragHandle = props => {
|
|
|
84
90
|
setDragging(isDragging);
|
|
85
91
|
};
|
|
86
92
|
return canDraggable ? /*#__PURE__*/_jsxs("div", {
|
|
93
|
+
contentEditable: false,
|
|
87
94
|
children: [/*#__PURE__*/_jsx(Box, {
|
|
88
|
-
className: dragging ? "dragging" : ""
|
|
95
|
+
className: `drag-alert ${dragging ? "dragging" : ""}`,
|
|
89
96
|
sx: classes.dropArea
|
|
90
97
|
}), /*#__PURE__*/_jsx(Droppable, {
|
|
91
98
|
id: id,
|
|
@@ -14,6 +14,11 @@ const SectionStyle = () => ({
|
|
|
14
14
|
"& .dh-para": {
|
|
15
15
|
opacity: 1
|
|
16
16
|
}
|
|
17
|
+
},
|
|
18
|
+
"& .element-toolbar": {
|
|
19
|
+
"&:hover": {
|
|
20
|
+
display: "block"
|
|
21
|
+
}
|
|
17
22
|
}
|
|
18
23
|
}
|
|
19
24
|
});
|
|
@@ -58,7 +63,7 @@ const Section = props => {
|
|
|
58
63
|
className: "element-toolbar no-border-button ss hr section-tw",
|
|
59
64
|
style: {
|
|
60
65
|
left: "-28px",
|
|
61
|
-
top: "
|
|
66
|
+
top: "0px"
|
|
62
67
|
},
|
|
63
68
|
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
64
69
|
title: "Section Settings",
|
|
@@ -94,7 +99,7 @@ const Section = props => {
|
|
|
94
99
|
backgroundImage: `url(${sectionBackgroundImage})`
|
|
95
100
|
} : {};
|
|
96
101
|
return path.length === 1 ? /*#__PURE__*/_jsxs(Box, {
|
|
97
|
-
component: "
|
|
102
|
+
component: "div",
|
|
98
103
|
className: `ed-section-wrapper ${readOnly ? "" : "hselect"} ${needHover}`,
|
|
99
104
|
sx: {
|
|
100
105
|
...classes.root,
|
|
@@ -116,9 +121,9 @@ const Section = props => {
|
|
|
116
121
|
...getBreakPointsValue(sectionGridSize || 8, null, "overrideGridSize", true)
|
|
117
122
|
}
|
|
118
123
|
},
|
|
119
|
-
children: [/*#__PURE__*/_jsx(DragHandle, {
|
|
124
|
+
children: [!readOnly ? /*#__PURE__*/_jsx(DragHandle, {
|
|
120
125
|
...props
|
|
121
|
-
}), children, /*#__PURE__*/_jsx(Toolbar, {})]
|
|
126
|
+
}) : null, children, /*#__PURE__*/_jsx(Toolbar, {})]
|
|
122
127
|
}), openSetttings ? /*#__PURE__*/_jsx(SectionPopup, {
|
|
123
128
|
element: {
|
|
124
129
|
...element,
|
|
@@ -206,7 +206,7 @@ const elements = props => {
|
|
|
206
206
|
search,
|
|
207
207
|
hideTools
|
|
208
208
|
} = props;
|
|
209
|
-
const filteredElements = ELEMENTS_LIST.filter(f => hideTools.indexOf(f.type) === -1);
|
|
209
|
+
const filteredElements = ELEMENTS_LIST.filter(f => (hideTools || []).indexOf(f.type) === -1);
|
|
210
210
|
return filteredElements.filter(c => c.name.toLowerCase().includes(search?.toLowerCase()));
|
|
211
211
|
};
|
|
212
212
|
export default elements;
|
|
@@ -32,7 +32,7 @@ const SaveAsTemplate = props => {
|
|
|
32
32
|
const file = e.target.files[0];
|
|
33
33
|
const strImage = await convertBase64(file);
|
|
34
34
|
setBase64(strImage);
|
|
35
|
-
doUpload(
|
|
35
|
+
doUpload(e.target.files[0]);
|
|
36
36
|
};
|
|
37
37
|
const onChange = e => {
|
|
38
38
|
setTemplate({
|
|
@@ -40,11 +40,13 @@ const SaveAsTemplate = props => {
|
|
|
40
40
|
[e.target.name]: e.target.value
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
|
-
const doUpload = async
|
|
43
|
+
const doUpload = async file => {
|
|
44
44
|
setUploading(true);
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const formData = new FormData();
|
|
46
|
+
formData.set("file", file);
|
|
47
|
+
formData.set("resource_type", "pages");
|
|
48
|
+
formData.set("resource_id", customProps?.page_id);
|
|
49
|
+
const result = await uploadFile(formData, customProps);
|
|
48
50
|
setUploading(false);
|
|
49
51
|
if (result && result?.imageURL) {
|
|
50
52
|
setTemplate({
|
|
@@ -17,14 +17,14 @@ const StyleContent = props => {
|
|
|
17
17
|
} = props;
|
|
18
18
|
const {
|
|
19
19
|
hideTools
|
|
20
|
-
} = customProps;
|
|
20
|
+
} = customProps || {};
|
|
21
21
|
const tabContent = renderTabs.find(f => f.value === value);
|
|
22
22
|
const {
|
|
23
23
|
fields
|
|
24
24
|
} = tabContent || {
|
|
25
25
|
fields: []
|
|
26
26
|
};
|
|
27
|
-
const filteredFields = hideTools?.length > 0 ? fields.filter(f => hideTools.indexOf(f.key) === -1) : fields;
|
|
27
|
+
const filteredFields = (hideTools || [])?.length > 0 ? fields.filter(f => (hideTools || []).indexOf(f.key) === -1) : fields;
|
|
28
28
|
return /*#__PURE__*/_jsx(Grid, {
|
|
29
29
|
container: true,
|
|
30
30
|
spacing: 2,
|
|
@@ -28,7 +28,6 @@ const Uploader = props => {
|
|
|
28
28
|
const doUpload = async (strImage, file) => {
|
|
29
29
|
setUploading(true);
|
|
30
30
|
const formData = new FormData();
|
|
31
|
-
// formData.set("image", strImage);
|
|
32
31
|
formData.set("file", file);
|
|
33
32
|
formData.set("resource_type", "pages");
|
|
34
33
|
formData.set("resource_id", customProps?.page_id);
|
|
@@ -1586,8 +1586,8 @@ export const CheckListButton = () => /*#__PURE__*/_jsx("svg", {
|
|
|
1586
1586
|
width: "23",
|
|
1587
1587
|
height: "23",
|
|
1588
1588
|
rx: "11.5",
|
|
1589
|
-
fill: "
|
|
1590
|
-
stroke: "#
|
|
1589
|
+
fill: "none",
|
|
1590
|
+
stroke: "#CCCCCC"
|
|
1591
1591
|
})
|
|
1592
1592
|
});
|
|
1593
1593
|
export const CheckListButtonActive = () => /*#__PURE__*/_jsxs("svg", {
|
|
@@ -1596,13 +1596,24 @@ export const CheckListButtonActive = () => /*#__PURE__*/_jsxs("svg", {
|
|
|
1596
1596
|
viewBox: "0 0 24 24",
|
|
1597
1597
|
fill: "none",
|
|
1598
1598
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1599
|
-
children: [/*#__PURE__*/_jsx("
|
|
1599
|
+
children: [/*#__PURE__*/_jsx("defs", {
|
|
1600
|
+
children: /*#__PURE__*/_jsxs("linearGradient", {
|
|
1601
|
+
id: "Gradient1",
|
|
1602
|
+
children: [/*#__PURE__*/_jsx("stop", {
|
|
1603
|
+
offset: "0%",
|
|
1604
|
+
stopColor: "#5351FC"
|
|
1605
|
+
}), /*#__PURE__*/_jsx("stop", {
|
|
1606
|
+
offset: "50%",
|
|
1607
|
+
stopColor: "#19A9FC"
|
|
1608
|
+
})]
|
|
1609
|
+
})
|
|
1610
|
+
}), /*#__PURE__*/_jsx("rect", {
|
|
1600
1611
|
x: "0.5",
|
|
1601
1612
|
y: "0.5",
|
|
1602
1613
|
width: "23",
|
|
1603
1614
|
height: "23",
|
|
1604
1615
|
rx: "11.5",
|
|
1605
|
-
fill: "#
|
|
1616
|
+
fill: "url(#Gradient1)"
|
|
1606
1617
|
}), /*#__PURE__*/_jsx("path", {
|
|
1607
1618
|
d: "M7.0625 12.0896L10.6849 15.7105L17.9267 8.46875",
|
|
1608
1619
|
stroke: "white",
|